Update step configuration handling
Reverse logic for supervisor configuration update
This commit is contained in:
5
seqs/mayan-edms.cfg.example
Normal file
5
seqs/mayan-edms.cfg.example
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
MAYAN_DB=
|
||||||
|
MAYAN_DBUSER=
|
||||||
|
MAYAN_DBPASS=
|
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
toolName="Mayan EDMS"
|
toolName="Mayan EDMS"
|
||||||
toolVersion="3.5.7"
|
toolVersion="4.1.4"
|
||||||
toolRoot="/opt/mayan-edms"
|
toolRoot="/opt/mayan-edms"
|
||||||
toolMediaFolder="/opt/mayan-edms/media"
|
toolMediaFolder="/opt/mayan-edms/media"
|
||||||
|
|
||||||
@@ -10,6 +10,35 @@ postgresDb=""
|
|||||||
postgresUser=""
|
postgresUser=""
|
||||||
postgresPass=""
|
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_info() { echo "Install libreoffice without gui"; }
|
||||||
step_1_alias() { ALIAS="install"; }
|
step_1_alias() { ALIAS="install"; }
|
||||||
@@ -93,7 +122,8 @@ databases 2"
|
|||||||
step_10_info() {
|
step_10_info() {
|
||||||
echo "Upgrade $toolName to $toolVersion [OPTIONS]"
|
echo "Upgrade $toolName to $toolVersion [OPTIONS]"
|
||||||
echoinfo " [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_alias() { ALIAS="upgrade"; }
|
||||||
step_10() {
|
step_10() {
|
||||||
@@ -108,13 +138,9 @@ step_10() {
|
|||||||
toolScript performupgrade
|
toolScript performupgrade
|
||||||
#toolScript preparestatic --noinput # only < 3.4
|
#toolScript preparestatic --noinput # only < 3.4
|
||||||
case $1 in
|
case $1 in
|
||||||
"nosuper")
|
"super")
|
||||||
echo " [I] Skipping supervisor configuration update"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Generating new supervisor file
|
# Generating new supervisor file
|
||||||
step supervisorconf
|
step supervisorconf ;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
exe systemctl start supervisor
|
exe systemctl start supervisor
|
||||||
}
|
}
|
||||||
@@ -179,19 +205,19 @@ step_22() {
|
|||||||
|
|
||||||
# Read postgres database information dbname/user/pass if empty
|
# Read postgres database information dbname/user/pass if empty
|
||||||
readDatabaseInfos() {
|
readDatabaseInfos() {
|
||||||
if [ "$postgresDb" == "" ] ; then
|
if [ -z "$postgresDb" ] ; then
|
||||||
read -p "Enter postgres database name: " postgresDb
|
read -p "Enter postgres database name: " postgresDb
|
||||||
endCheckEmpty postgresDb "database"
|
endCheckEmpty postgresDb "database"
|
||||||
fi
|
fi
|
||||||
if [ "$postgresUser" == "" ] ; then
|
if [ -z "$postgresUser" ] ; then
|
||||||
read -p "Enter postgres user name: " postgresUser
|
read -p "Enter postgres user name: " postgresUser
|
||||||
endCheckEmpty postgresUser "user name"
|
endCheckEmpty postgresUser "user name"
|
||||||
fi
|
fi
|
||||||
if [ "$postgresPass" == "" ] ; then
|
if [ -z "$postgresPass" ] ; then
|
||||||
read -s -p "Enter postgres password: " postgresPass
|
read -s -p "Enter postgres password: " postgresPass
|
||||||
endCheckEmpty postgresPass "password"
|
endCheckEmpty postgresPass "password"
|
||||||
fi
|
fi
|
||||||
echo
|
echoseq
|
||||||
}
|
}
|
||||||
|
|
||||||
# Needs readDatabaseInfos() to execute some commands
|
# Needs readDatabaseInfos() to execute some commands
|
||||||
@@ -206,5 +232,5 @@ toolScript() {
|
|||||||
${toolRoot}/bin/mayan-edms.py $*"
|
${toolRoot}/bin/mayan-edms.py $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION_SEQREV=10
|
VERSION_SEQREV=13
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
Reference in New Issue
Block a user