-
Notifications
You must be signed in to change notification settings - Fork 65
/
setup.sh
executable file
·66 lines (52 loc) · 1.63 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
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
## To configure the installation of conscripted application,
## set up the environment variable CONSCRIPT_HOME to something like $HOME/.conscript
## This would the directory where launch JARs and launchconfigs will be donwloaded.
##
## By default, the scripts for the conscripted apps (g8, cs, etc.)
## will be created under CONSCRIPT_HOME/bin.
## This can also be configured using the environment variable CONSCRIPT_BIN.
if [ -z "$CONSCRIPT_HOME" ]
then
CS_DEFAULT=$HOME/.conscript
read -p "CONSCRIPT_HOME is not set. Is it ok to use $CS_DEFAULT? (Y/n): " YN
YN=${YN:-Yes}
case $YN in
[Yy]* ) break;;
* ) exit;;
esac
CS="${CS:-$CS_DEFAULT}"
else
CS="$CONSCRIPT_HOME"
fi
BIN="${CONSCRIPT_BIN:-$CS/bin}"
CSCS="$CS/foundweekends/conscript/cs"
CLC="$CSCS/launchconfig"
mkdir -p $CSCS
mkdir -p "$BIN"
echo "Fetching current launch configuration..."
wget https://raw.githubusercontent.com/foundweekends/conscript/master/src/main/conscript/cs/launchconfig -O $CLC
echo "
[boot]
directory: $CS/boot" >> "$CLC"
echo "#!/bin/sh
java \$JAVA_OPTS -jar $CS/sbt-launch.jar @$CLC \"\$@\"" > "$BIN/cs"
chmod a+x "$BIN/cs"
LJV=1.4.4
LJ="launcher-$LJV.jar"
# If launcher is not in configuration directory
if [ ! -f "$CS/$LJ" ]; then
echo "Fetching launcher..."
wget "https://repo1.maven.org/maven2/org/scala-sbt/launcher/$LJV/launcher-$LJV.jar" -O "$CS/$LJ"
ln -sf "$CS/$LJ" "$CS/sbt-launch.jar"
fi
# Check if BIN is in PATH
bin_in_path=$(echo "$PATH" | grep -i "$BIN")
if [ -z "$bin_in_path" ]
then
echo 'PATH="$PATH:'"$BIN"'"' >> $HOME/.bashrc
exec bash
fi
echo "conscript installed to $BIN/cs"
# Execute Conscript
cs