Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 3fdbfe8

Browse files
author
Antonios Papadakis
committed
Script Now Displays Warnings About Outdated PHP Version -m macOS
1 parent 3058cce commit 3fdbfe8

File tree

1 file changed

+82
-52
lines changed

1 file changed

+82
-52
lines changed

macos/install.sh

Lines changed: 82 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,71 +8,101 @@ function setup {
88

99
# Setup Correct files depending on PHP installation version choice
1010
if [ "$PHPINSTALLVERSION" = latest-7.1 ]; then
11-
cd ../releases/ || exit
12-
ls latest-7.1
13-
ISFOLDERPRESENT=$?
14-
if [ "$ISFOLDERPRESENT" = 1 ]; then
15-
unzip php-src-php-7.1.32.zip -d latest-7.1
16-
cd latest-7.1 || exit
17-
elif [ "$ISFOLDERPRESENT" = 0 ]; then
18-
read -p 'There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
19-
FOLDERCHOICE=${FOLDERCHOICE:-n}
20-
if [ "$FOLDERCHOICE" = y ] || [ "$FOLDERCHOICE" = Y ]; then
21-
sudo rm -r latest-7.1
11+
read -p 'latest-7.1 is outdated and has been superseded by latest-7.2. Would you like to continue installation?[y/Y/default: n/N] ' OUTDATEDCHOICE
12+
OUTDATEDCHOICE=${OUTDATEDCHOICE:-n}
13+
if [ "$OUTDATEDCHOICE" = y ] || [ "$OUTDATEDCHOICE" = Y ]; then
14+
cd ../releases/ || exit
15+
ls latest-7.1
16+
ISFOLDERPRESENT=$?
17+
if [ "$ISFOLDERPRESENT" = 1 ]; then
2218
unzip php-src-php-7.1.32.zip -d latest-7.1
2319
cd latest-7.1 || exit
24-
elif [ "$FOLDERCHOICE" = n ] || [ "$FOLDERCHOICE" = N ]; then
25-
echo cancelling installation
26-
setup
27-
else
28-
echo invalid argument, exiting...
29-
setup
20+
elif [ "$ISFOLDERPRESENT" = 0 ]; then
21+
read -p 'There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
22+
FOLDERCHOICE=${FOLDERCHOICE:-n}
23+
if [ "$FOLDERCHOICE" = y ] || [ "$FOLDERCHOICE" = Y ]; then
24+
sudo rm -r latest-7.1
25+
unzip php-src-php-7.1.32.zip -d latest-7.1
26+
cd latest-7.1 || exit
27+
elif [ "$FOLDERCHOICE" = n ] || [ "$FOLDERCHOICE" = N ]; then
28+
echo cancelling installation
29+
setup
30+
else
31+
echo invalid argument, exiting...
32+
setup
33+
fi
3034
fi
35+
elif [ "$OUTDATEDCHOICE" = n ] || [ "$OUTDATEDCHOICE" = N ]; then
36+
echo cancelling installation
37+
setup
38+
else
39+
echo invalid argument, exiting...
40+
setup
3141
fi
32-
42+
3343
elif [ "$PHPINSTALLVERSION" = latest-7.2 ]; then
34-
cd ../releases/ || exit
35-
ls latest-7.2
36-
ISFOLDERPRESENT=$?
37-
if [ "$ISFOLDERPRESENT" = 1 ]; then
38-
unzip php-src-php-7.2.33.zip -d latest-7.2
39-
cd latest-7.2 || exit
40-
elif [ "$ISFOLDERPRESENT" = 0 ]; then
41-
read -p 'There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
42-
FOLDERCHOICE=${FOLDERCHOICE:-n}
43-
if [ "$FOLDERCHOICE" = y ] || [ "$FOLDERCHOICE" = Y ]; then
44-
sudo rm -r latest-7.2
44+
read -p 'latest-7.2 is outdated and has been superseded by latest-7.3. Would you like to continue installation?[y/Y/default: n/N] ' OUTDATEDCHOICE
45+
OUTDATEDCHOICE=${OUTDATEDCHOICE:-n}
46+
if [ "$OUTDATEDCHOICE" = y ] || [ "$OUTDATEDCHOICE" = Y ]; then
47+
cd ../releases/ || exit
48+
ls latest-7.2
49+
ISFOLDERPRESENT=$?
50+
if [ "$ISFOLDERPRESENT" = 1 ]; then
4551
unzip php-src-php-7.2.33.zip -d latest-7.2
4652
cd latest-7.2 || exit
47-
elif [ "$FOLDERCHOICE" = n ] || [ "$FOLDERCHOICE" = N ]; then
48-
echo cancelling installation
49-
setup
50-
else
51-
echo invalid argument, exiting...
52-
setup
53+
elif [ "$ISFOLDERPRESENT" = 0 ]; then
54+
read -p 'There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
55+
FOLDERCHOICE=${FOLDERCHOICE:-n}
56+
if [ "$FOLDERCHOICE" = y ] || [ "$FOLDERCHOICE" = Y ]; then
57+
sudo rm -r latest-7.2
58+
unzip php-src-php-7.2.33.zip -d latest-7.2
59+
cd latest-7.2 || exit
60+
elif [ "$FOLDERCHOICE" = n ] || [ "$FOLDERCHOICE" = N ]; then
61+
echo cancelling installation
62+
setup
63+
else
64+
echo invalid argument, exiting...
65+
setup
66+
fi
5367
fi
68+
elif [ "$OUTDATEDCHOICE" = n ] || [ "$OUTDATEDCHOICE" = N ]; then
69+
echo cancelling installation
70+
setup
71+
else
72+
echo invalid argument, exiting...
73+
setup
5474
fi
5575
elif [ "$PHPINSTALLVERSION" = latest-7.3 ]; then
56-
cd ../releases/ || exit
57-
ls latest-7.3
58-
ISFOLDERPRESENT=$?
59-
if [ "$ISFOLDERPRESENT" = 1 ]; then
60-
unzip php-src-php-7.3.22RC1.zip -d latest-7.3
61-
cd latest-7.3 || exit
62-
elif [ "$ISFOLDERPRESENT" = 0 ]; then
63-
read -p 'There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
64-
FOLDERCHOICE=${FOLDERCHOICE:-n}
65-
if [ "$FOLDERCHOICE" = y ] || [ "$FOLDERCHOICE" = Y ]; then
66-
sudo rm -r latest-7.3
76+
read -p 'latest-7.3 is outdated and has been superseded by latest-7.4. Would you like to continue installation?[y/Y/default: n/N] ' OUTDATEDCHOICE
77+
OUTDATEDCHOICE=${OUTDATEDCHOICE:-n}
78+
if [ "$OUTDATEDCHOICE" = y ] || [ "$OUTDATEDCHOICE" = Y ]; then
79+
cd ../releases/ || exit
80+
ls latest-7.3
81+
ISFOLDERPRESENT=$?
82+
if [ "$ISFOLDERPRESENT" = 1 ]; then
6783
unzip php-src-php-7.3.22RC1.zip -d latest-7.3
6884
cd latest-7.3 || exit
69-
elif [ "$FOLDERCHOICE" = n ] || [ "$FOLDERCHOICE" = N ]; then
70-
echo cancelling installation
71-
setup
72-
else
73-
echo invalid argument, exiting...
74-
setup
85+
elif [ "$ISFOLDERPRESENT" = 0 ]; then
86+
read -p 'There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
87+
FOLDERCHOICE=${FOLDERCHOICE:-n}
88+
if [ "$FOLDERCHOICE" = y ] || [ "$FOLDERCHOICE" = Y ]; then
89+
sudo rm -r latest-7.3
90+
unzip php-src-php-7.3.22RC1.zip -d latest-7.3
91+
cd latest-7.3 || exit
92+
elif [ "$FOLDERCHOICE" = n ] || [ "$FOLDERCHOICE" = N ]; then
93+
echo cancelling installation
94+
setup
95+
else
96+
echo invalid argument, exiting...
97+
setup
98+
fi
7599
fi
100+
elif [ "$OUTDATEDCHOICE" = n ] || [ "$OUTDATEDCHOICE" = N ]; then
101+
echo cancelling installation
102+
setup
103+
else
104+
echo invalid argument, exiting...
105+
setup
76106
fi
77107
elif [ "$PHPINSTALLVERSION" = latest-7.4 ]; then
78108
cd ../releases/ || exit

0 commit comments

Comments
 (0)