From cc550392863a6762ec7c0c08a34b9a6a1c1d848c Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 8 Oct 2019 16:17:48 +0200 Subject: [PATCH] fix pg volume in compose file + optional clean at the end --- scripts/postgre-upgrade.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/postgre-upgrade.sh b/scripts/postgre-upgrade.sh index 80a42e719..afb8ff8d6 100644 --- a/scripts/postgre-upgrade.sh +++ b/scripts/postgre-upgrade.sh @@ -5,7 +5,7 @@ config() if [ "$(whoami)" = "root" ] then echo "It is not recommended to run this script as root. As a normal user, elevation will be prompted if needed." - read -rp "Continue anyway? (y/n) " confirm "$FM_PATH/.awktmpfile" && mv "$FM_PATH/.awktmpfile" "$FM_PATH/docker-compose.yml" + awk "BEGIN { FS=\"\n\"; RS=\"\"; } { print gensub(/(image: postgres:$NEW(\n|.)+volumes:)/, \"\\\\1\n - ${NEW_PATH}:/var/lib/postgresql/data\", \"g\") }" "$FM_PATH/docker-compose.yml" > "$FM_PATH/.awktmpfile" && mv "$FM_PATH/.awktmpfile" "$FM_PATH/docker-compose.yml" docker-compose pull docker-compose up -d } -upgrade_elastic() +clean() +{ + read -rp "Remove the previous PostgreSQL data folder? (y/N) " confirm