X-Git-Url: https://plomlompom.com/repos/test.html?a=blobdiff_plain;ds=sidebyside;f=buster%2Fsetup_scripts%2Frestore_app.sh;h=817c07d1a062988c597184af43dbb921abf2236e;hb=1e122e234af3af5a644fa85c03690101618f5313;hp=b5bef5a9d6370c494ec4b8035ea980c053de411a;hpb=d0ea846a4695f6d14ee8ae517425f91489e1aa7e;p=config
diff --git a/buster/setup_scripts/restore_app.sh b/buster/setup_scripts/restore_app.sh
index b5bef5a..817c07d 100755
--- a/buster/setup_scripts/restore_app.sh
+++ b/buster/setup_scripts/restore_app.sh
@@ -6,14 +6,14 @@ if [ "$#" -lt 2 ]; then
echo 'Need two arguments: service name and DB name.'
false
fi
-if [ ! "$1" = "pleroma_otp" ] && [ ! "$1" = "pleroma_sourc" ] && [ ! "$1" = "peertube" ]; then
+if [ ! "$1" = "pleroma_otp" ] && [ ! "$1" = "pleroma_source" ] && [ ! "$1" = "peertube" ]; then
echo "Need legal service name (pleroma_otp or pleroma_source or peertube)."
false
fi
app="$1"
db_name="$2"
service="$1"
-if [ "${app}" = "pleroma_source" || "${app}" = "pleroma_otp" ]; then
+if [ "${app}" = "pleroma_source" ] || [ "${app}" = "pleroma_otp" ]; then
service=pleroma
fi
@@ -24,12 +24,12 @@ cd /tmp
tar xf "${service}_backup.tar"
su postgres -c "pg_restore -c -1 -d ${db_name} ${service}_backup/${db_name}.pgdump"
-rm "${app}_backup/${db_name}.pgdump"
+rm "${service}_backup/${db_name}.pgdump"
cd "${service}_backup"
for path in $(find . -type f); do
if [ "${app}" = "pleroma_source" ]; then
- if [ "${path}" = '/opt/pleroma/config/prod.secret.exs' ]; then
+ if [ "${path}" = './opt/pleroma/config/prod.secret.exs' ]; then
continue # skip file that contains passwords
fi
fi
@@ -46,6 +46,8 @@ if [ "${app}" = "pleroma_otp" ]; then
elif [ "${app}" = "peertube" ]; then
db_pw=$(cat /var/www/peertube/config/production.yaml | grep password | head -1 | sed "s/[ ]*password\: *//g" | sed "s/'//g")
fi
-su postgres -lc "psql -c \"ALTER USER ${app} WITH PASSWORD '${db_pw}';\""
+if [ "${app}" = "pleroma_otp" ] || [ "${app}" = "peertube" ]; then
+ su postgres -lc "psql -c \"ALTER USER ${service} WITH PASSWORD '${db_pw}';\""
+fi
service "${service}" start