-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup.sh
executable file
·55 lines (48 loc) · 1.62 KB
/
setup.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
53
54
55
#!/bin/bash
set -x
set -e
echo "Start Install/Update"
if [[ "$DOWLOAD_ASSETS" == "" ]]; then
DOWLOAD_ASSETS="y"
echo "Assets will be downloaded too"
echo "To disable that, run: 'DOWLOAD_ASSETS=y ./setup.sh'"
elif [[ "$DOWLOAD_ASSETS" == "y" ]]; then
echo "Assets will be downloaded too"
else
echo "Assets will NOT be downloaded"
fi
SOURCE_REPO_URL="https://github.com/ARCADE-TEK-2026/archi_arcade.git"
SOURCE_CLONE_FOLDER="__tmp"
SOURCE_ASSETS_FOLDER="$SOURCE_CLONE_FOLDER/assets"
SOURCE_INCLUDE_FOLDER="$SOURCE_CLONE_FOLDER/include"
SOURCE_SETUP_SCRIPT="$SOURCE_CLONE_FOLDER/setup.sh"
TARGET_INCLUDE_FOLDER="src"
TARGET_ASSETS_FOLDER="assets"
TARGET_SETUP_SCRIPT="update-archi.sh"
rm -rf "$SOURCE_CLONE_FOLDER"
git clone "$SOURCE_REPO_URL" "$SOURCE_CLONE_FOLDER"
if [[ "$1" == "--dev" ]]; then
echo "Install dev dependencies"
OLD_PWD="$PWD"
cd "$SOURCE_CLONE_FOLDER" && git switch dev && cd "$OLD_PWD"
fi
mkdir -p "$TARGET_INCLUDE_FOLDER"
cp -r "$SOURCE_INCLUDE_FOLDER/"* "$TARGET_INCLUDE_FOLDER"
cp "$SOURCE_SETUP_SCRIPT" "$TARGET_SETUP_SCRIPT"
chmod +x "$TARGET_SETUP_SCRIPT"
if [[ "$DOWLOAD_ASSETS" == "y" ]]; then
echo "Download assets..."
if [[ ! -d "$TARGET_ASSETS_FOLDER" ]]; then
cp -r "$SOURCE_ASSETS_FOLDER" "$TARGET_ASSETS_FOLDER"
else
cp -r "$SOURCE_ASSETS_FOLDER/"* "$TARGET_ASSETS_FOLDER"
fi
fi
rm -rf "$SOURCE_CLONE_FOLDER"
# Add a gitignore file if it doesn't exist
if [ ! -f .gitignore ]; then
echo "$TARGET_SETUP_SCRIPT" > .gitignore
elif ! grep -q "$TARGET_SETUP_SCRIPT" .gitignore; then
echo "$TARGET_SETUP_SCRIPT" >> .gitignore
fi
echo "Fnishing Install/Update"