From: Christian Heller Date: Sun, 26 Jan 2020 22:41:28 +0000 (+0100) Subject: Fix Pleroma migration scripts. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/te%22st.html?a=commitdiff_plain;h=06e7f865feb169f359e28382200fe7d6c5d42673;p=config Fix Pleroma migration scripts. --- diff --git a/buster/setup_scripts/migrate_pleroma.sh b/buster/setup_scripts/migrate_pleroma.sh index bff9872..5eefc39 100755 --- a/buster/setup_scripts/migrate_pleroma.sh +++ b/buster/setup_scripts/migrate_pleroma.sh @@ -11,10 +11,15 @@ server_ip="$1" config_tree_prefix="${HOME}/config/buster" setup_scripts_dir="${config_tree_prefix}/setup_scripts" + +# So we're only asked once … +eval $(ssh-agent) +ssh-add + cd "${setup_scripts_dir}" ./prepare_to_meet_server.sh "${server_ip}" read -p'Hit Enter when you are done.' ignore ssh plom@"${server_ip}" 'su -lc "cd config && git pull"' ssh plom@"${server_ip}" 'su -lc "cd config/buster/setup_scripts && ./backup_pleroma.sh"' scp plom@"${server_ip}":~/pleroma_backup.tar /home/plom/pleroma_backup.tar -./backup_pleroma.sh +./restore_pleroma.sh diff --git a/buster/setup_scripts/restore_pleroma.sh b/buster/setup_scripts/restore_pleroma.sh index 844a655..325aa23 100755 --- a/buster/setup_scripts/restore_pleroma.sh +++ b/buster/setup_scripts/restore_pleroma.sh @@ -10,4 +10,9 @@ tar xf pleroma_backup.tar cp -a pleroma_backup/uploads/* /var/lib/pleroma/uploads/ cp -a pleroma_backup/etc_files/* /etc/pleroma/ su postgres -lc 'pg_restore --clean -d pleroma -v -1 /tmp/pleroma_backup/pleroma.pgdump' + +# TODO: Horrible hack, improve. +db_pw=$(cat /etc/pleroma/config.exs | grep password | sed 's/[ ]*password\: *//g' | sed 's/,//g' | sed 's/"//g') +su postgres -lc "psql -c \"ALTER USER pleroma WITH PASSWORD '${db_pw}';\"" + service pleroma start