-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch-binary.sh
executable file
·48 lines (40 loc) · 1.2 KB
/
fetch-binary.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
#!/bin/sh
### this will fetch phantomas script from github
# app version
BINVER="0.11.1"
# operating system
OS=linux
# architecture
ARCH=x86_64
BINTARBALL="v${BINVER}.tar.gz"
#CHKSUMFILE=SHASUMS.txt
TARGETDIR=binpkg
# base download url
BASEURL="https://github.com/macbre/phantomas/archive"
# cheap verify if we're on an rpm or dpkg system
if [ -e /etc/redhat-release ]
then
PKGTOOL=rpm
else
PKGTOOL=dpkg
fi
# install wget if it is missing
echo "### Verifying wget is installed"
if [ "${PKGTOOL}" == "rpm" ]
then
rpm -q wget || yum install wget
else
dpkg -s wget || apt-get --yes install wget
fi
# download binary tarball
mkdir -p ${TARGETDIR}
echo "### Downloading app binary tarball, if not present"
[ -e ${TARGETDIR}/${BINTARBALL} ] || wget -O ${TARGETDIR}/${BINTARBALL} "${BASEURL}/${BINTARBALL}"
# download checksum
##echo "### Downloading checksum file, if not present"
##wget -O ${TARGETDIR}/${CHKSUMFILE} "${BASEURL}/${CHKSUMFILE}"
##cd ${TARGETDIR}
### verify checksum, consider flipping a table if it fails
##echo "### Verifying checksum of tarball"
##grep node-v${BINVER}-${OS}-${ARCH}.tar.gz SHASUMS.txt | sha1sum -c || echo ### ERROR in download, delete from ${TARGETDIR} and try again
##cd ..