Skip to content

Commit f461034

Browse files
committed
chore: cleanup on rollback method
1 parent d501d00 commit f461034

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
## Script status
1212

13-
Version: v3.1.1.882
14-
Build: 882
13+
Version: v3.1.1.883
14+
Build: 883
1515

1616
[![MIT License](https://img.shields.io/badge/license-MIT%20License-blue.svg?style=flat-square)](https://github.com/JMSDOnline/vstacklet/blob/main/LICENSE)
1717

docs/setup/vstacklet-server-stack.sh.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# vstacklet-server-stack.sh - v3.1.2172
1+
# vstacklet-server-stack.sh - v3.1.2176
22

33

44
---
@@ -1288,7 +1288,7 @@ Displays the current version of vStacklet. [see function](https://github.com/JMS
12881288

12891289
### vstacklet::error::display()
12901290

1291-
Displays error messages for vStacklet. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3461-L3626)
1291+
Displays error messages for vStacklet. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3461-L3631)
12921292

12931293
*function has no options*
12941294

@@ -1298,7 +1298,7 @@ Displays error messages for vStacklet. [see function](https://github.com/JMSDOnl
12981298

12991299
### vstacklet::rollback()
13001300

1301-
This function is called when a rollback is required. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3651-L3943)
1301+
This function is called when a rollback is required. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3656-L3949)
13021302

13031303
*function has no options*
13041304

@@ -1326,7 +1326,7 @@ This function is called when a rollback is required. [see function](https://gith
13261326
13271327
### vstacklet::update::check()
13281328
1329-
Checks for updates to the vStacklet script. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3953-L4022)
1329+
Checks for updates to the vStacklet script. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3959-L4028)
13301330
13311331
*function has no options*
13321332

setup/vstacklet-server-stack.sh

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
##################################################################################
33
# <START METADATA>
44
# @file_name: vstacklet-server-stack.sh
5-
# @version: 3.1.2172
5+
# @version: 3.1.2176
66
# @description: Lightweight script to quickly install a LEMP stack with Nginx,
77
# Varnish, PHP7.4/8.1/8.3 (PHP-FPM), OPCode Cache, IonCube Loader, MariaDB, Sendmail
88
# and more on a fresh Ubuntu 20.04/22.04 or Debian 11/12 server for
@@ -457,7 +457,7 @@ vstacklet::args::process() {
457457
[[ -n ${web_root} && $(sed -e 's/[\\/]/\\/g;s/[\/\/]/\\\//g;' <<<"${web_root}") == "" ]] && vstacklet::shell::text::error "invalid web root. please provide a valid web root. (e.g. /var/www/html/vsapp)" && exit 1
458458
;;
459459
--rollback)
460-
vstacklet::rollback
460+
declare -gi rollback="1" && vstacklet::rollback
461461
;;
462462
--check_update)
463463
vstacklet::update::check
@@ -3452,7 +3452,7 @@ vstacklet::version::display() {
34523452

34533453
################################################################################
34543454
# @name: vstacklet::error::display - vStacklet Error Messages
3455-
# @description: Displays error messages for vStacklet. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3461-L3626)
3455+
# @description: Displays error messages for vStacklet. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3461-L3631)
34563456
#
34573457
# @nooptions
34583458
# @noargs
@@ -3612,22 +3612,27 @@ vstacklet::error::display() {
36123612
else
36133613
vstacklet::shell::text::warning "installer has been interrupted"
36143614
fi
3615-
vstacklet::shell::text::error "a fatal error has occurred, you can rollback the installation process by running the following command:"
3616-
vstacklet::shell::text::white "vstacklet --rollback"
3617-
vstacklet::shell::misc::nl
3618-
vstacklet::shell::text::error "please report this issue to the vStacklet GitHub repository."
3619-
vstacklet::shell::text::white " - include the error message above"
3620-
vstacklet::shell::text::white " - include the vStacklet log file: ${vslog}"
3621-
vstacklet::shell::text::white " - include the vStacklet version: ${vstacklet_version}"
3622-
vstacklet::shell::text::white " - include the server OS and version"
3623-
vstacklet::shell::misc::nl
3615+
if [[ "${rollback}" != "1" ]]; then
3616+
vstacklet::shell::text::error "a fatal error has occurred, you can rollback the installation process by running the following command:"
3617+
vstacklet::shell::text::white "vstacklet --rollback"
3618+
vstacklet::shell::misc::nl
3619+
vstacklet::shell::text::error "please report this issue to the vStacklet GitHub repository."
3620+
vstacklet::shell::text::white " - include the error message above"
3621+
vstacklet::shell::text::white " - include the vStacklet log file: ${vslog}"
3622+
vstacklet::shell::text::white " - include the vStacklet version: ${vstacklet_version}"
3623+
vstacklet::shell::text::white " - include the server OS and version"
3624+
vstacklet::shell::misc::nl
3625+
else
3626+
vstacklet::shell::text::error "The rollback process has been cancelled."
3627+
vstacklet::shell::misc::nl
3628+
fi
36243629
exit 1
36253630
}
36263631
trap 'vstacklet::error::display' SIGINT
36273632

36283633
################################################################################
36293634
# @name: vstacklet::rollback
3630-
# @description: This function is called when a rollback is required. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3651-L3943)
3635+
# @description: This function is called when a rollback is required. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3656-L3949)
36313636
#
36323637
# @example: vstacklet --rollback
36333638
#
@@ -3695,6 +3700,7 @@ vstacklet::rollback() {
36953700
vstacklet::shell::text::white " The rollback process will remove the changes made by the above command."
36963701
vstacklet::shell::text::white " The rollback process will remove NGINX, PHP, MariaDB, Varnish, CSF, phpMyAdmin, ionCube,
36973702
Domain Certificate, and the WordPress installation directory specified in the command."
3703+
vstacklet::shell::misc::nl
36983704
rollback_continue
36993705
}
37003706
rollback_continue() {
@@ -3703,7 +3709,7 @@ vstacklet::rollback() {
37033709
vstacklet::shell::misc::nl
37043710
}
37053711
rollback_intro
3706-
vstacklet::shell::text::white "Select a rollback file to restore the server to:"
3712+
vstacklet::shell::text::white "Select a rollback file for the server to restore from:"
37073713
for ((i = 0; i < ${#rollback_files[@]}; i++)); do
37083714
vstacklet::shell::misc::nl
37093715
# @script-note: display the contents of the rollback file
@@ -3715,7 +3721,7 @@ vstacklet::rollback() {
37153721
done
37163722
vstacklet::shell::misc::nl
37173723
# @script-note: prompt the user to select a rollback file
3718-
vstacklet::shell::text::yellow::sl "Select a rollback file to restore the server to: "
3724+
vstacklet::shell::text::yellow::sl "Select a rollback file for the server to restore from: "
37193725
vstacklet::shell::icon::arrow::white && vstacklet::shell::text::green::sl " #" && read -r input
37203726
# @script-note: check if the input is a number
37213727
if [[ ! ${input} =~ ^[0-9]+$ ]]; then
@@ -3944,7 +3950,7 @@ vstacklet::rollback() {
39443950

39453951
################################################################################
39463952
# @name: vstacklet::update::check
3947-
# @description: Checks for updates to the vStacklet script. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3953-L4022)
3953+
# @description: Checks for updates to the vStacklet script. [see function](https://github.com/JMSDOnline/vstacklet/blob/main/setup/vstacklet-server-stack.sh#L3959-L4028)
39483954
#
39493955
# @nooptions
39503956
# @noargs

0 commit comments

Comments
 (0)