Skip to content

Commit eeebc9a

Browse files
committed
check for existing /var/www/ directory before doing anything
1 parent af12f1d commit eeebc9a

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

install.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ function check_apache(){
2424
fi
2525
}
2626

27+
function check_www(){
28+
29+
# check if directory exist
30+
if [ -d "/var/www/" ]; then
31+
echo "Contents of /var/www/ will be removed."
32+
read -p "Do you want to continue? [Y/n] "
33+
34+
if [[ $REPLY =~ ^[Yy]$ ]]; then
35+
rm -rf /var/www/
36+
else
37+
exit
38+
fi
39+
fi
40+
}
41+
2742
function install_cron(){
2843

2944
# brackets = list of commands to be executed as one unit
@@ -51,12 +66,15 @@ function install_composer(){
5166
alias composer='php -d suhosin.executor.include.whitelist=phar /usr/local/bin/composer'
5267
}
5368

54-
## fresh installations may need to update package locations
55-
update
56-
5769
# should we even run this script?
5870
check_apache
5971

72+
# does /var/www/ already exist?
73+
check_www
74+
75+
## fresh installations may need to update package locations
76+
update
77+
6078
## git for composer and bc for math operations - vnstat for bandwidth
6179
apt-get -y install git bc curl vnstat
6280

0 commit comments

Comments
 (0)