-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
91 lines (76 loc) · 3.56 KB
/
Copy pathsetup.sh
File metadata and controls
91 lines (76 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# this script most recently updated/maintained in January 2026
# extract username from current working directory (expects format: username.github.io)
current_dir=$(basename "$PWD")
# extract username from current working directory (expects format: username.github.io)
if [[ "$current_dir" =~ ^([^.]+)\.github\.io$ ]]; then
username="${BASH_REMATCH[1]}"
echo $username
else
echo "Error: Current directory name must be in the format username.github.io."
echo "Please check which directory you are in. Check with your instructor if you need help. Cancelling operation."
exit 1
fi
# check if iot-projects folder already exists
if [ -d "iot-projects" ]; then
echo "Error: iot-projects directory already exists."
echo "You may have already run this script. Check with your instructor before proceeding. Cancelling operation."
exit 1
fi
mkdir iot-projects
cd iot-projects
git clone https://github.com/operationspark/underpants-lite underpants-lite
git clone https://github.com/operationspark/are-you-being-served are-you-being-served
git clone https://github.com/operationspark/catch-server catch-server
git clone https://github.com/operationspark/interface-inyourface interface-inyourface
git clone https://github.com/operationspark/hardware-setup hardware-setup
git clone https://github.com/operationspark/first-slice-of-pi first-slice-of-pi
git clone https://github.com/operationspark/second-slice-of-pi second-slice-of-pi
git clone https://github.com/operationspark/pi-inyourface pi-inyourface
git clone https://github.com/operationspark/iot-automatic-routing automatic-routing
if ! test -e underpants-lite || ! test -e catch-server || ! test -e are-you-being-served || ! test -e interface-inyourface || ! test -e hardware-setup || ! test -e first-slice-of-pi || ! test -e second-slice-of-pi || ! test -e pi-inyourface || ! test -e automatic-routing; then
printf "\nFAILURE: Some projects could not be accessed on GitHub. Please run the script again."
else
# Check for existing project-instructions folder, creates directory if missing
if ! test -e project-instructions; then
mkdir ../project-instructions
fi
# Copy READMEs for projects into project-instructions dir
mkdir ../project-instructions/iot
cp underpants-lite/README.md ../project-instructions/iot/underpants-lite.md
cp catch-server/README.md ../project-instructions/iot/catch-server.md
cp are-you-being-served/README.md ../project-instructions/iot/are-you-being-served.md
cp interface-inyourface/README.md ../project-instructions/iot/interface-inyourface.md
cp hardware-setup/README.md ../project-instructions/iot/hardware-setup.md
cp first-slice-of-pi/README.md ../project-instructions/iot/first-slice-of-pi.md
cp second-slice-of-pi/README.md ../project-instructions/iot/second-slice-of-pi.md
cp pi-inyourface/README.md ../project-instructions/iot/pi-inyourface.md
cp automatic-routing/README.md ../project-instructions/iot/automatic-routing.md
#underpants-lite
cd underpants-lite
rm -rf .git* .master
#test-guru
cd ../catch-server
rm -rf .git* .master
#are-you-being-served
cd ../are-you-being-served
rm -rf .git* .master
#interface-inyourface
cd ../interface-inyourface
rm -rf .git* .master
#hardware-setup
cd ../hardware-setup
rm -rf .git* .master
#first-slice-of-pi
cd ../first-slice-of-pi
rm -rf .git* .master
#second-slice-of-pi
cd ../second-slice-of-pi
rm -rf .git* .master
#pi-inyouface
cd ../pi-inyourface
rm -rf .git* .master
#automatic-routing
cd ../automatic-routing
rm -rf .git* .master
printf "\nSUCCESS: All projects successfully installed.\n"
fi