-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall_phpbrew.sh
executable file
·130 lines (86 loc) · 3.47 KB
/
install_phpbrew.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
# tested on ubuntu 16.04 (gnome)
# tested on ubuntu 14.04.3 (gnome)
SCRIPT_NAME=$(basename $BASH_SOURCE)
SCRIPT_LOGFILE="./logs/"$(basename -s .sh $BASH_SOURCE)".log"
SCRIPT_ENVFILE="./logs/"$(basename -s .sh $BASH_SOURCE)".env"
mkdir -p ./logs && chmod 755 ./logs
echo "running "$SCRIPT_NAME
#
# CHECK DISTRO VERSION
#
. /etc/lsb-release
echo $DISTRIB_DESCRIPTION
#
# UBUNTU 14.04 VERSION
#
if [ "$DISTRIB_RELEASE" = "14.04" ]; then
if hash phpbrew 2>/dev/null; then
echo " phpbrew already installed"
else
echo " phpbrew not installed => installing phpbrew"
sudo apt-get -y build-dep php5
sudo apt-get install -y php5 php5-dev php-pear autoconf automake curl libcurl3-openssl-dev build-essential libxslt1-dev re2c libxml2 libxml2-dev php5-cli bison libbz2-dev libreadline-dev libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev libjpeg8 libgd-dev libgd3 libxpm4 libltdl7 libltdl-dev libssl-dev openssl gettext libgettextpo-dev libgettextpo0 libicu-dev libmhash-dev libmhash2 libmcrypt-dev libmcrypt4
cd ~
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/local/bin/phpbrew
fi
if grep -Fxq '# installed by ubuntu-desktop-post-install/install_phpbrew.sh #' ~/.bashrc
then
echo " phpbrew already added to bashrc"
else
phpbrew init
echo '' >> ~/.bashrc
echo '#' >> ~/.bashrc
echo '# phpbrew' >> ~/.bashrc
echo '#' >> ~/.bashrc
echo '# installed by ubuntu-desktop-post-install/install_phpbrew.sh #' >> ~/.bashrc
echo '#' >> ~/.bashrc
echo '' >> ~/.bashrc
echo '[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc' >> ~/.bashrc
fi
echo " !!! PLEASE LOGOUT AND LOGIN AGAIN AFTER INSTALLATION FINISHES"
echo " cool tricks"
echo " phpbrew known"
echo " phpbrew install 7.0 +default"
echo " phpbrew use 7.0"
#
# UBUNTU 16.04 VERSION
#
elif [ "$DISTRIB_RELEASE" = "16.04" ]; then
echo "running UBUNTU 16.04 version"
if hash phpbrew 2>/dev/null; then
echo " phpbrew already installed"
else
echo " phpbrew not installed => installing phpbrew"
sudo apt-get -y build-dep php7.0
sudo apt-get install -y php7.0 php7.0-dev php7.0-cli php7.0-curl
sudo apt-get install -y php-pear autoconf automake curl libcurl3-openssl-dev build-essential libxslt1-dev re2c libxml2 libxml2-dev bison libbz2-dev libreadline-dev libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev libjpeg8 libgd-dev libgd3 libxpm4 libltdl7 libltdl-dev libssl-dev openssl gettext libgettextpo-dev libgettextpo0 libicu-dev libmhash-dev libmhash2 libmcrypt-dev libmcrypt4
cd ~
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/local/bin/phpbrew
fi
if grep -Fxq '# installed by ubuntu-desktop-post-install/install_phpbrew.sh #' ~/.bashrc
then
echo " phpbrew already added to bashrc"
else
phpbrew init
echo '' >> ~/.bashrc
echo '#' >> ~/.bashrc
echo '# phpbrew' >> ~/.bashrc
echo '#' >> ~/.bashrc
echo '# installed by ubuntu-desktop-post-install/install_phpbrew.sh #' >> ~/.bashrc
echo '#' >> ~/.bashrc
echo '' >> ~/.bashrc
echo '[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc' >> ~/.bashrc
fi
echo " !!! PLEASE LOGOUT AND LOGIN AGAIN AFTER INSTALLATION FINISHES"
echo " cool tricks"
echo " phpbrew known"
echo " phpbrew install 7.0 +default"
echo " phpbrew use 7.0"
else
echo "no compatible installer found for your distribution"
fi