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
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