-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakedist
executable file
·52 lines (37 loc) · 873 Bytes
/
makedist
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
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DL="https://nodejs.org/en/download/"
cd "$DIR"
if [ -e "dist" ]; then
echo "dist directory exists - exiting"
exit 1
fi
if [ -e "dist.tgz" ]; then
echo "dist.tgz exists - exiting"
exit 1
fi
URL="$( /usr/bin/curl -s "$DL" | /usr/bin/grep darwin | /usr/bin/sed 's/.*"\(.*\)".*/\1/' )"
FILE="$( echo "$URL" | /usr/bin/sed 's,.*/,,' )"
/bin/mkdir dist
cd dist
echo ""
echo "Downloading $URL"
/usr/bin/curl -O "$URL"
echo ""
echo "Extracting..."
/usr/bin/tar xvzf "$FILE"
/bin/rm -f "$FILE"
/bin/ln -s * node
echo ""
echo "Adding homebridge scripts..."
cd ..
/usr/bin/tar cf - homebridge | (cd dist; /usr/bin/tar xvf -)
echo ""
echo "Installing homebridge..."
cd dist
./homebridge/installhomebridge
echo ""
echo "Creating distribution..."
/usr/bin/tar cvzf ../dist.tgz .
echo ""
echo "Done."