Skip to content

Commit 1203123

Browse files
committed
Little fixs on setup.sh and launch.sh
1 parent 41389d6 commit 1203123

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

launch.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
#!/usr/bin/env bash
22

3-
OPTION=$(dialog --title "Twitch Bot" --menu "What do you want ?" 10 78 3 \
3+
VERSION=1.3
4+
TITLE="Twitch Bot $VERSION"
5+
OPTION=$(dialog --title "$TITLE" --menu "What do you want ?" 10 78 3 \
46
"1" "Launch the bot" \
57
"2" "Launch in screen" \
68
"3" "Dump autoload" 3>&1 1>&2 2>&3)
79

810
STATUS=$?
9-
if [ $STATUS = 0 ]; then
10-
case $OPTION in
11+
if [ ${STATUS} = 0 ]; then
12+
case ${OPTION} in
1113
1)
1214
php bot.php
1315
;;
1416
2)
1517
screen -Sdm twitch-bot php bot.php
16-
dialog --title "Twitch Bot" --msgbox "You can re-attach the screen by typing: screen -r twitch-bot" 10 78
18+
dialog --title "$TITLE" --msgbox "You can re-attach the screen by typing: screen -r twitch-bot" 10 78
1719
;;
1820
3)
1921
php composer.phar dumpautoload &> /dev/null

setup.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
11
#!/usr/bin/env bash
22

3+
VERSION=1.3
4+
TITLE="Twitch Bot $VERSION"
35

46
function installPhpOrDie() {
5-
if (dialog --title "PHP Checks" --yes-button "Yes" --no-button "No" --yesno "Do you want to install PHP and PHP-CURL ?" 10 78); then
7+
if (dialog --title "$TITLE - PHP Checks" --yes-button "Yes" --no-button "No" --yesno "Do you want to install PHP and PHP-CURL ?" 10 78); then
68
clear
79
apt-get update
8-
apt-get install -y php5-cli php5-curl
10+
apt-get install -y php-cli php-curl
911
else
10-
dialog --title "Twitch Bot" --msgbox "PHP is required to use this bot, thanks." 10 78
12+
dialog --title "$TITLE" --msgbox "PHP is required to use this bot, thanks." 10 78
1113
fi
1214
}
1315

1416
# Step 1
15-
dialog --title "Twitch Bot" --msgbox "
17+
dialog --title "$TITLE" --msgbox "
1618
Welcome to the installer, it checks if your system passes all requirements and configures the bot for you.
1719
1820
Choose Ok to begin." 10 78
1921

2022

2123
# Step 2
2224
PHPVERSION=$(php --version 2> /dev/null | head -n 1 | cut -d " " -f 2 | cut -c 1,3);
23-
if [ $PHPVERSION < 56 ] || [ -z $PHPVERSION ]; then
25+
if [ ${PHPVERSION} < 56 ] || [ -z ${PHPVERSION} ]; then
2426
installPhpOrDie
2527
fi
2628

2729
# Step 3
28-
dialog --title "Twitch Bot" --msgbox "
30+
dialog --title "$TITLE" --msgbox "
2931
The next step will download composer on getcomposer.org and install it locally
3032
31-
Choose Ok to continue." 10 78
33+
Choose Ok to continue and wait." 10 78
3234

3335
wget https://getcomposer.org/installer -O composer-setup.php &> /dev/null
3436
php composer-setup.php &> /dev/null
37+
rm composer-setup.php
3538

3639

3740
# Step 4
38-
dialog --title "Twitch Bot" --msgbox "
41+
dialog --title "$TITLE" --msgbox "
3942
To finish, launch composer update by pressing Ok on this step
4043
4144
Choose Ok to continue." 10 78
4245
php composer.phar update &> /dev/null
4346

4447
# Step 5
45-
dialog --title "Twitch Bot" --msgbox "It' done ! Installation ended successfully. You can launch the bot by typing: bash launch.sh in your terminal" 10 78
48+
dialog --title "$TITLE" --msgbox "It' done ! Installation ended successfully. You can launch the bot by typing: bash launch.sh in your terminal" 10 78

0 commit comments

Comments
 (0)