Update step configuration handling

Reverse logic for supervisor configuration update
This commit is contained in:
2022-01-11 21:42:26 +01:00
parent 06f960d96d
commit c296c07373
2 changed files with 44 additions and 13 deletions

View File

@@ -0,0 +1,5 @@
#!/bin/bash
MAYAN_DB=
MAYAN_DBUSER=
MAYAN_DBPASS=

View File

@@ -1,7 +1,7 @@
#!/bin/bash
toolName="Mayan EDMS"
toolVersion="3.5.7"
toolVersion="4.1.4"
toolRoot="/opt/mayan-edms"
toolMediaFolder="/opt/mayan-edms/media"
@@ -10,6 +10,35 @@ postgresDb=""
postgresUser=""
postgresPass=""
# Get script working directory
# (when called from a different directory)
WDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)"
APTOPT=
CONFIG=0
SCRIPT_FILE=$(basename -- $0)
SCRIPT_NAME=${SCRIPT_FILE%%.*}
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() {
## or to use sequencer api with global config file:
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then
CONFIG=1
postgresDb="$MAYAN_DB"
postgresUser="$MAYAN_DBUSER"
postgresPass="$MAYAN_DBPASS"
else
# End if no configuration file exists
[ $DRY -eq 0 ] && return -1
fi
## Apt cmdline option to suppress user interaction
[ $QUIET -ne 0 ] && APTOPT="-y"
## Return of non zero value will abort the sequence
return 0
}
step_1_info() { echo "Install libreoffice without gui"; }
step_1_alias() { ALIAS="install"; }
@@ -93,7 +122,8 @@ databases 2"
step_10_info() {
echo "Upgrade $toolName to $toolVersion [OPTIONS]"
echoinfo " [OPTIONS]"
echoinfo " nosuper : skip supervisor configuration generation"
echoinfo " super : update also supervisor configuration"
echoinfo " (manual redis password update may be needed)"
}
step_10_alias() { ALIAS="upgrade"; }
step_10() {
@@ -108,13 +138,9 @@ step_10() {
toolScript performupgrade
#toolScript preparestatic --noinput # only < 3.4
case $1 in
"nosuper")
echo " [I] Skipping supervisor configuration update"
;;
*)
"super")
# Generating new supervisor file
step supervisorconf
;;
step supervisorconf ;;
esac
exe systemctl start supervisor
}
@@ -179,19 +205,19 @@ step_22() {
# Read postgres database information dbname/user/pass if empty
readDatabaseInfos() {
if [ "$postgresDb" == "" ] ; then
if [ -z "$postgresDb" ] ; then
read -p "Enter postgres database name: " postgresDb
endCheckEmpty postgresDb "database"
fi
if [ "$postgresUser" == "" ] ; then
if [ -z "$postgresUser" ] ; then
read -p "Enter postgres user name: " postgresUser
endCheckEmpty postgresUser "user name"
fi
if [ "$postgresPass" == "" ] ; then
if [ -z "$postgresPass" ] ; then
read -s -p "Enter postgres password: " postgresPass
endCheckEmpty postgresPass "password"
fi
echo
echoseq
}
# Needs readDatabaseInfos() to execute some commands
@@ -206,5 +232,5 @@ toolScript() {
${toolRoot}/bin/mayan-edms.py $*"
}
VERSION_SEQREV=10
VERSION_SEQREV=13
. /usr/local/bin/sequencer.sh