X-Git-Url: https://plomlompom.com/repos/?p=config;a=blobdiff_plain;f=buster%2Fsetup_scripts%2Frestore_app.sh;h=b5bef5a9d6370c494ec4b8035ea980c053de411a;hp=363a5f6edb4c859d7e81532ee317322b3a1fc270;hb=d0ea846a4695f6d14ee8ae517425f91489e1aa7e;hpb=f1901562e5d3859b4e9a9eb7c5f48c6db73fc8b1 diff --git a/buster/setup_scripts/restore_app.sh b/buster/setup_scripts/restore_app.sh index 363a5f6..b5bef5a 100755 --- a/buster/setup_scripts/restore_app.sh +++ b/buster/setup_scripts/restore_app.sh @@ -12,17 +12,21 @@ if [ ! "$1" = "pleroma_otp" ] && [ ! "$1" = "pleroma_sourc" ] && [ ! "$1" = "pee fi app="$1" db_name="$2" +service="$1" +if [ "${app}" = "pleroma_source" || "${app}" = "pleroma_otp" ]; then + service=pleroma +fi -service "${app}" stop +service "${service}" stop -mv "/home/plom/${app}_backup.tar" /tmp/ +mv "/home/plom/${service}_backup.tar" /tmp/ cd /tmp -tar xf "${app}_backup.tar" +tar xf "${service}_backup.tar" -su postgres -c "pg_restore -c -1 -d ${db_name} ${app}_backup/${db_name}.pgdump" +su postgres -c "pg_restore -c -1 -d ${db_name} ${service}_backup/${db_name}.pgdump" rm "${app}_backup/${db_name}.pgdump" -cd "${app}_backup" +cd "${service}_backup" for path in $(find . -type f); do if [ "${app}" = "pleroma_source" ]; then if [ "${path}" = '/opt/pleroma/config/prod.secret.exs' ]; then @@ -44,4 +48,4 @@ elif [ "${app}" = "peertube" ]; then fi su postgres -lc "psql -c \"ALTER USER ${app} WITH PASSWORD '${db_pw}';\"" -service "${app}" start +service "${service}" start