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

@@ -62,7 +62,7 @@ step_11_info() { echo "Installing $toolName dependencies"; }
step_11_alias() { echo "install"; }
step_11() {
exe apt update
endReturn -o $? "Updating apt repositories failed"
endReturn "Updating apt repositories failed"
exe apt install $toolDeps ${sq_aptOpt}
}
@@ -71,7 +71,7 @@ step_20_alias() { echo "createdb"; }
step_20() {
readDatabaseInfos
exe cd ~postgres
exe cd ~postgres
exe su ${toolUser} -c "psql -c \"CREATE USER ${postgresUser} WITH ENCRYPTED password '${postgresPass}';\""
exe su ${toolUser} -c "psql -c \"CREATE DATABASE ${postgresDb} ENCODING \"UTF8\" LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER ${postgresUser};\""
exe su ${toolUser} -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE \"${postgresDb}\" to ${postgresUser};\""
@@ -137,7 +137,7 @@ step_40() {
dbname="$postgresDb"
fi
#if [ ! -s ~/.pgpass ] ; then
# echo " [I] For unattended backup please define ~/.pgpass containing credentials"
# info "For unattended backup please define ~/.pgpass containing credentials"
# echo " e.g. localhost:5432:database:user:pass"
#fi
# -Fc custom format
@@ -150,7 +150,7 @@ step_40() {
step_42_info() { echo "Postgres database restore"; }
step_42_alias() { echo "restoredb"; }
step_42() {
echo " [I] Postgres database restore procedure"
info "Postgres database restore procedure"
echo "1. Create a empty postgres database first (step 4)"
echo "2. psql -h <host> -U <database user> -d <database name> -W -f <sql dump file>"
echo " e.g. psql -h 127.0.0.1 -U synapse -d synapse -W -f 2018-06-07_18-10-56.sql"
@@ -165,7 +165,7 @@ step_42() {
exe su ${toolUser} -c "psql -c '\du'"
}
step_44_info() {
step_44_info() {
local DELYEAR=$(($(date +%Y)-2))
echo "Clean all ${DELYEAR} backups of a database";
}