Commit 83c14c11 authored by Jan-Oliver Opdenhövel's avatar Jan-Oliver Opdenhövel
Browse files

Fixing the upgrade preparation script

parent bc77e48e
......@@ -4,17 +4,16 @@
set -e
export DATA_DIR=/var/lib/postgres/data
data_dir=/var/lib/postgres/data
export PG_DATA_VERSION=$(cat $DATA_DIR/PG_VERSION)
export UPDATE_VERSION=$(pacman -Qu postgresql) # Fails if no update, script stops.
export MAJOR_UPDATE_AVAIL=$(echo $UPDATE_VERSION | grep "$(($PG_DATA_VERSION + 1))[^ ]*$" | wc -l)
if [ $MAJOR_UPDATE_AVAIL -gt 0 ]
then
echo "Preparing for major PostgreSQL update"
systemctl stop synapse.service
systemctl start pgdump.service
systemctl stop postgresql.service
mv $DATA_DIR $DATA_DIR.$PG_DATA_VERSION
pg_data_version=$(cat $data_dir/PG_VERSION)
if update_version=$(pacman -Qu postgresql); then
update_version=$(echo "$update_version" | tr " " "\n" | tail -n 1 | cut -d . -f 1)
if [ "$pg_data_version" != "$update_version" ]; then
echo "Preparing for major PostgreSQL update"
systemctl stop synapse.service
systemctl start pgdump.service
systemctl stop postgresql.service
mv $data_dir $data_dir.$pg_data_version
fi
fi
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment