forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbs
More file actions
executable file
·54 lines (49 loc) · 1.44 KB
/
Copy pathbs
File metadata and controls
executable file
·54 lines (49 loc) · 1.44 KB
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
#!/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
if [[ $(arch) == "arm64" ]]; then
jqName=jq-macos-arm64
else
jqName=jq-macos-amd64
fi
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.7.1/$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"/{node,nodeBootstrap.sh,yarn} .
}
./yarn install
exec ./yarn run target "$@"