refactoring changes from sequpgrade (endReturn, ...) and some modernizations

This commit is contained in:
2023-01-03 15:49:08 +01:00
parent 215135e8aa
commit 3c22d5729f
69 changed files with 553 additions and 654 deletions

View File

@@ -20,7 +20,7 @@ seq_config() {
# End if no configuration file exists
dry || return 1
fi
# Apt cmdline option to suppress user interaction
interactive || sq_aptOpt="-y"
@@ -66,7 +66,7 @@ step_2() {
step_3_info() { echo "Configure $toolName"; }
step_3_alias() { echo "config"; }
step_3() {
echo " [I] Recommended composer packages to be added to \"require\" section:"
info "Recommended composer packages to be added to \"require\" section:"
echo ' "alexandregz/twofactor_gauthenticator": "dev-master",'
echo ' "johndoh/contextmenu": "*",'
echo ' "kitist/html5_notifier": "*",'
@@ -76,12 +76,12 @@ step_3() {
exe vi "$RC_LOC/composer.json"
step postupgrade
echo " [I] Generating mysql database $RC_DATABASE"
info "Generating mysql database $RC_DATABASE"
echo
exe ${seq_origin:?}/mysql.sh createdb -c utf8mb4
echo
echo " [I] Now visit: http://url-to-roundcube/installer/"
info "Now visit: http://url-to-roundcube/installer/"
echo
echo " ! Check the database password in $RC_LOC/config/config.inc.php"
echo " afterwards, the installer may have corrupted some special character"
@@ -132,7 +132,7 @@ I also installed 'php-pear' since one error indicated connection to it.
TROUBLE_END
}
step_20_info() {
step_20_info() {
echo -n "Create a backup"
if (( ${sq_config} )) ; then
echo " at $RC_BACKUP"
@@ -151,7 +151,7 @@ step_20() {
fi
exe ${seq_origin:?}/mysql.sh -qq backup "$RC_DATABASE" "$RC_BACKUP"
local wwwBackup="$RC_BACKUP/${toolName}_www_`date +%Y%m%d-%H%M%S`.tar.gz"
echo " [I] Backing up webserver directory to $wwwBackup"
info "Backing up webserver directory to $wwwBackup"
exe cd "$RC_LOC/.."
exe tar czf "$wwwBackup" $(basename "$RC_LOC")
}
@@ -195,16 +195,16 @@ step_22() {
downloadLatest
step backup
echo " [I] Installing version $latestVersion to $RC_LOC"
info "Installing version $latestVersion to $RC_LOC"
exe "$tempInstall" "$RC_LOC"
echo " [I] Make sure to check composer.json-dist file for upstream changes"
info "Make sure to check composer.json-dist file for upstream changes"
}
step_23_info() { echo "Post upgrade procedure"; }
step_23_alias() { echo "postupgrade"; }
step_23() {
exe cd "$RC_LOC"
echo " [I] Starting post update procedure"
info "Starting post update procedure"
exe php composer.phar update --no-dev
}
@@ -233,12 +233,12 @@ downloadLatest() {
if [ ! -e "$tempExtract" ] ; then
exe mkdir -p "$tempDown"
exe wget -O "$tempLoc" $downUrl
endReturn -o $? "Download failed: $downUrl"
endReturn "Download failed: $downUrl"
exe cd "$tempDown"
exe tar -xf "$tempLoc"
endReturn -o $? "Extract failed: $tempLoc"
endReturn "Extract failed: $tempLoc"
else
echo " [I] Found existing download: $tempExtract"
info "Found existing download: $tempExtract"
fi
}
tempDown="/tmp/roundcube"