-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.sh
52 lines (40 loc) · 1.25 KB
/
update.sh
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
#!/bin/bash
set -e
# Change to the script's working directory
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
cd "$SCRIPT_DIR"
# Despite the code above, quickly confirm our assumption
CURRENT_DIR=$(pwd)
if [[ ! "$CURRENT_DIR" == *"/ext/quiz" ]]; then
echo "ERROR"
echo "$CURRENT_DIR"
echo "You must run update.sh from the same folder"
echo "It was detected that this is not the case"
echo "ABORTING"
exit 1
fi
cd ..
echo "Downloading ZIP file..."
# No Git Bash support: wget https://github.com/ljacqu/NightbotQuiz/archive/refs/heads/master.zip
curl -kLSs https://github.com/ljacqu/NightbotQuiz/archive/refs/heads/master.zip -o quiz-new.zip
echo "Extracting to quiz-new/"
unzip -q quiz-new.zip
mv NightbotQuiz-master/ quiz-new/
echo "Synchronizing configuration file"
cp -f quiz/Configuration.php quiz-new/Configuration.php
echo "Synchronizing generated files"
# No Git Bash support: rsync -a quiz/gen/ quiz-new/gen/
cp -rf quiz/gen/* quiz-new/gen/
echo "Replacing quiz/ with quiz-new/"
rm -rf quiz/
mv quiz-new/ quiz/
echo "Removing repo-only files"
rm quiz/.editorconfig
rm quiz/.gitattributes
rm quiz/.gitignore
rm quiz/README.md
echo "Deleting zip"
rm quiz-new.zip
echo "Making update.sh executable"
chmod +rx quiz/update.sh
echo "Update complete."