-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·46 lines (34 loc) · 1.22 KB
/
install.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
#!/bin/bash
set -e
UNAME=$(uname | tr "[:upper:]" "[:lower:]")
if [ "$UNAME" == "linux" ]; then
if [ -f /etc/lsb-release ]; then
DISTRO=$(cat /etc/lsb-release | grep DISTRIB_ID | cut -d'=' -f2 | tr "[:upper:]" "[:lower:]")
elif [ -d /etc/lsb-release.d ]; then
DISTRO=$(lsb_release -i | cut -d: -f2 | sed s/'^\t'// | tr "[:upper:]" "[:lower:]")
elif [ -f /etc/redhat-release ]; then
DISTRO=redhat
fi
fi
case $DISTRO in
ubuntu)
echo "# Installing dependencies for native extensions: libssh2-1-dev libssl-dev cmake pkg-config"
sudo apt-get install -y libssh2-1-dev libssl-dev cmake pkg-config
echo
;;
redhat)
echo "# Installing dependencies for native extensions: libssh2-devel openssl-devel cmake pkgconfig"
sudo yum install -y libssh2-devel openssl-devel cmake pkgconfig
echo
;;
esac
echo "# Installing dapp gem"
DAPP_VERSION=$1
gem install dapp $(if [[ $DAPP_VERSION ]] ; then echo "--version=$DAPP_VERSION" ; fi)
echo
if [ -z $DAPP_VERSION ]; then
DAPP_VERSION=$(dapp --version | cut -d' ' -f2)
fi
echo "# Installing dapp update cron job into /etc/cron.d/dapp-update"
sudo mkdir -p /etc/cron.d
echo "* * * * * $USER /bin/bash -lec 'dapp update'" | sudo tee /etc/cron.d/dapp-update