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() {
else
dry || return 1
fi
return 0
}
@@ -30,13 +30,13 @@ step_1() {
exe apt update
}
step_2_info() {
step_2_info() {
echo "Installing $toolName dependencies:"
echoinfo "$libreDeps"
}
step_2() {
exe apt install $libreDeps ${sq_aptOpt}
endReturn -o $? "Failed to install $toolName dependencies"
endReturn "Failed to install $toolName dependencies"
}
step_3_info() {
@@ -47,7 +47,7 @@ step_3_info() {
step_3() {
fetchPhpVersion
exe apt install "${librePhpDeps[@]/#/php${phpVersion}-}" ${sq_aptOpt}
endReturn -o $? "Failed to install $toolName php dependencies"
endReturn "Failed to install $toolName php dependencies"
}
step_4_info() { echo "Adding $toolName user ($toolUser)"; }
@@ -67,7 +67,7 @@ step_5() {
step_6_info() { echo "Installing $toolName using composer"; }
step_6() {
exe sudo -u librenms "${LNMS_DIR}/scripts/composer_wrapper.php" install --no-dev
endReturn -o $? "Failed to install php dependencies"
endReturn "Failed to install php dependencies"
}
step_10_info() { echo "Create mysql database for $toolName"; }
@@ -77,7 +77,7 @@ step_10() {
libreDbOpt="-d $LNMS_DB_NAME"
fi
exe "${seq_origin}"/mysql.sh ${sqr_args} createdb --charset utf8 "$libreDbOpt"
endReturn -o $? "Failed to create mysql database $LNMS_DB_NAME"
endReturn "Failed to create mysql database $LNMS_DB_NAME"
}
step_11_info() { echo "MariaDB configuration"; }
@@ -256,12 +256,12 @@ step_42() {
exe setfacl -R -m g::rwx "${LNMS_DIR}/rrd" "${LNMS_DIR}/logs" "${LNMS_DIR}/bootstrap/cache/" "${LNMS_DIR}/storage/"
}
fetchPhpVersion() {
if [ -n "${phpVersion}" ] ; then
return 0
fi
fetchPhpVersion() {
if [ -n "${phpVersion}" ] ; then
return 0
fi
phpVersion="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')"
phpVersion="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')"
}
# shellcheck disable=SC2034 # Appears unused