-
Notifications
You must be signed in to change notification settings - Fork 1
/
bs
executable file
·50 lines (45 loc) · 1.3 KB
/
bs
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
#!/bin/bash
# check for presence of bootstrap scripts
[ -f './yarn' ] && [ -f './node' ] && [ -f './nodeBootstrap.sh' ] || {
# Something is missing, download from github
downloadDir=`pwd`/download
mkdir -p $downloadDir
if [ `getconf LONG_BIT` == "64" ]; then
arch=64
else
arch=86
fi
uname=`uname -s`
# we need jq to parse the package.json
jqCmd=$(which jq 2>/dev/null || echo "$downloadDir/jq")
if [ ! -f $jqCmd ]; then
if [[ $uname =~ ^Darwin* ]]; then
jqName=jq-osx-amd64
elif [[ $uname =~ ^Linux* ]]; then
jqName=jq-linux$arch
else
echo Unknown os: $uname
exit
fi
jqDl=https://github.com/stedolan/jq/releases/download/jq-1.6/$jqName
echo Downloading $jqDl to $jqCmd
curl -L -o $jqCmd $jqDl
chmod +x $jqCmd
fi
cliUrl=$(curl -L https://api.github.com/repos/murrayju/build-strap-cli/releases/latest | $jqCmd -r .tarball_url)
cliGz=bs-cli.tar.gz
cliDl=$downloadDir/$cliGz
if [ ! -f $cliDl ]; then
echo Downloading $cliUrl to $cliDl
curl -L -o $cliDl $cliUrl
fi
cliDir=$downloadDir/bs-cli
if [ ! -d $cliDir ]; then
echo Extracting $cliGz
tar xzf $cliDl -C $downloadDir
mv $downloadDir/murrayju-build-strap-cli* $cliDir
fi
cp $cliDir/bs* $cliDir/node* $cliDir/yarn* .
}
./yarn install
exec ./yarn run run "$@"