Last active
January 8, 2022 18:51
-
-
Save rizemon/232bc93a9a296ac17e51a7cc7ec70314 to your computer and use it in GitHub Desktop.
Script used to construct the submission zip file according to the assignment requirement (v2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# CS2106 Lab Assignment 1 Zip Build Script v2 by @rizemon | |
# Improvements added: | |
# - No longer requires creation of temp directory to house copies of necessary files | |
# - Now checks for missing files and reports them | |
# - Add reminder for student to check whether they have entered their information into the files | |
# Modify this | |
NUSNET_ID="" | |
# ---------------------------------- | |
# Colors (From https://gist.github.com/jonsuh/3c89c004888dfc7352be) | |
# ---------------------------------- | |
NOCOLOR='\033[0m' | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
ORANGE='\033[0;33m' | |
BLUE='\033[0;34m' | |
PURPLE='\033[0;35m' | |
CYAN='\033[0;36m' | |
LIGHTGRAY='\033[0;37m' | |
DARKGRAY='\033[1;30m' | |
LIGHTRED='\033[1;31m' | |
LIGHTGREEN='\033[1;32m' | |
YELLOW='\033[1;33m' | |
LIGHTBLUE='\033[1;34m' | |
LIGHTPURPLE='\033[1;35m' | |
LIGHTCYAN='\033[1;36m' | |
WHITE='\033[1;37m' | |
echo -e "[*] ${CYAN}CS2106 Lab Assignment 1 Zip Build Script v2 by @rizemon${NOCOLOR}" | |
FILES=( | |
ex2/node.c | |
ex3/function_pointers.c | |
ex3/node.c | |
ex3/ex3.c | |
ex5/check_system.sh | |
ex6/check_syscalls.sh | |
) | |
MISSING=$( | |
for f in "${FILES[@]}" | |
do | |
[ -f $f ] || echo $f | |
done | |
) | |
if [ ! -z "$MISSING" ] | |
then | |
echo -e "${RED}[x] Missing files: \n$MISSING${NOCOLOR}" | |
exit 1 | |
fi | |
echo -e "[*] Zipping up files and placing ${YELLOW}$NUSNET_ID.zip${NOCOLOR} into ${YELLOW}$(pwd)/ex7/${NOCOLOR} ..." | |
echo -ne "${DARKGRAY}" | |
zip -r ex7/$NUSNET_ID.zip ${FILES[@]} | |
echo -ne "${NOCOLOR}" | |
echo -e "[+] Completed! Now change your current working directory to ${YELLOW}$(pwd)/ex7/${NOCOLOR} to do the verification by running: ${GREEN}./check_zip.sh $NUSNET_ID.zip${NOCOLOR}" | |
echo -e "[*] Ensure that all your required files have your ${RED}name, student number and lab group number${NOCOLOR}!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment