-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·74 lines (55 loc) · 1.61 KB
/
install
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
#!/usr/bin/env bash
# Define colors
CYAN="\033[0;36m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
END="\033[m"
TMP_INSTALL=".install.tmp"
# Execute a copy of the script in case updating it would cause side-effects
if [ $# == 0 ]; then
echo -e $YELLOW"Bootstrapping..."$END
SELF_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $SELF_DIRECTORY
cp $0 ./$TMP_INSTALL
exec ./$TMP_INSTALL --bootstrapped
fi
# Perform cleanup
if [ $1 == "--cleanup" ]; then
rm -f ./$TMP_INSTALL
exit 0
fi
echo -e $GREEN"Bootstrapped!"$END
if [ $1 != "--no-update" ]; then
echo -e $GREEN"Updating Bootstrap..."$END
git remote update
# Compare the working directory to the repo
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
if [ $LOCAL = $REMOTE ]; then
echo -e "Up-to-date"
else
# Force clean the repo and update
git clean -fxd --exclude=/$TMP_INSTALL
git reset --hard origin/master
echo -e $GREEN"Updated..."$END
# Run the new version of install
echo -e $YELLOW"Relaunching..."$END
exec ./install
fi
echo -e $GREEN"Updating Dependencies..."$END
swift package update
fi
echo -e $GREEN"Building Bootstrap..."$END
swift build --configuration release
echo -e $GREEN"Copying Executables..."$END
mkdir -p bin
cp -f .build/release/Bootstrap ./bin/bootstrap
cp -f .build/release/Build ./bin/build
cp -f .build/release/*.so bin/
echo -e $GREEN"Creating Additional Directories..."$END
mkdir -p ../Modules/
echo -e ""
echo -e $CYAN"ADD THE FOLLOWING TO YOUR BASH PROFILE:"$END
echo -e "export BOOTSTRAP_PATH=\"$(pwd)/bin\""
echo -e "export PATH=\"\${BOOTSTRAP_PATH}\":\"\${PATH}\""
exec ./install --cleanup