Fix unbound variable errors

This commit is contained in:
2022-06-02 16:08:07 +02:00
parent a6eeccb417
commit 4f8c1b5388
15 changed files with 85 additions and 86 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash
toolName=postfixadmin
toolPhpDeps='php${PFA_PHP_VERSION}-fpm php${PFA_PHP_VERSION}-imap php${PFA_PHP_VERSION}-mbstring php${PFA_PHP_VERSION}-mysql php${PFA_PHP_VERSION}-json php${PFA_PHP_VERSION}-curl php${PFA_PHP_VERSION}-zip php${PFA_PHP_VERSION}-xml php${PFA_PHP_VERSION}-bz2 php${PFA_PHP_VERSION}-intl php${PFA_PHP_VERSION}-gmp'
toolPhpDeps='php${PFA_PHP_VERSION:-}-fpm php${PFA_PHP_VERSION:-}-imap php${PFA_PHP_VERSION:-}-mbstring php${PFA_PHP_VERSION:-}-mysql php${PFA_PHP_VERSION:-}-json php${PFA_PHP_VERSION:-}-curl php${PFA_PHP_VERSION:-}-zip php${PFA_PHP_VERSION:-}-xml php${PFA_PHP_VERSION:-}-bz2 php${PFA_PHP_VERSION:-}-intl php${PFA_PHP_VERSION:-}-gmp'
toolConfName="config.local.php"
toolTemplates="templates_c"
toolTemplatesLoc="$PFA_SRV_LOC/$toolTemplates"
@@ -18,12 +18,13 @@ CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
seq_config() {
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then
echo " ${toolName} path: ${PFA_WEB_LOC}"
echo " ${toolName} backup: ${PFA_BACKUP}"
echo " php Version: ${PFA_PHP_VERSION}"
if initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" ; then
info "${toolName} path: ${PFA_WEB_LOC:-}"
info -a "${toolName} backup: ${PFA_BACKUP:-}"
info -a " php Version: ${PFA_PHP_VERSION:-}"
CONFIG=1
else
dry || return 1
fi
}
@@ -45,7 +46,7 @@ step_1() {
exe apt install $localDeps $aptOpt
}
step_2_info() { echo "Install $toolName to $PFA_SRV_LOC"; }
step_2_info() { echo "Install $toolName to ${PFA_SRV_LOC:-}"; }
step_2() {
step upgrade
}
@@ -149,7 +150,7 @@ step_18() {
shift
local isInstalled=
local latestVersion=
if [ ! -z $1 ] ; then
if [ -n "${1:-}" ] ; then
latestVersion="$1"
else
latestVersion=$(curl --silent "$latestUrl" | grep -Po '"tag_name": "postfixadmin-\K.*?(?=")')
@@ -186,7 +187,7 @@ step_20() {
if [ ! -z $PFA_BACKUP ] ; then
exe mkdir -p "$PFA_BACKUP"
fi
if [ ! -z $1 ] ; then
if [ -n "${1:-}" ] ; then
tempRoot="$1"
else
tempRoot="$PFA_SRV_LOC"
@@ -219,7 +220,7 @@ step_22_alias() { echo "upgrade"; }
step_22() {
shift # don't need step number
local latestVersion=
if [ ! -z $1 ] ; then
if [ -n "${1:-}" ] ; then
latestVersion="$1"
else
latestVersion=$(curl --silent "$latestUrl" | grep -Po '"tag_name": "postfixadmin-\K.*?(?=")')