From db56c768c559bdae127c08d870844148a3c272dd Mon Sep 17 00:00:00 2001 From: libvoid <135131094+libvoid@users.noreply.github.com> Date: Thu, 2 May 2024 17:31:22 +0200 Subject: [PATCH] build(deb): fix mariadb config overwrite on upgrade bug in postinstall script always replacing /etc/systemd/system/sshportal.service.d/custom.conf with the sqlite3 config --- packaging/postinstall.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/postinstall.sh b/packaging/postinstall.sh index e6219813..33e3113c 100755 --- a/packaging/postinstall.sh +++ b/packaging/postinstall.sh @@ -2,7 +2,9 @@ mkdir -p /etc/systemd/system/sshportal.service.d/ -if [ -f /tmp/sshportal_mariadb ]; then +# Only do this on new install or during upgrade if no DB configuration found +if [ -f /tmp/sshportal_mariadb ] && + { [ -z "$2" ] || [ ! -f /etc/systemd/system/sshportal.service.d/custom.conf ]; }; then SOCKET="$(mysqladmin variables | grep ".sock " | awk '{print $4}')" readonly SOCKET @@ -13,7 +15,7 @@ Environment=SSHPORTAL_DB_DRIVER=mysql Environment=SSHPORTAL_DATABASE_URL=sshportal@unix($SOCKET)/sshportal?charset=utf8&parseTime=true&loc=Local END rm -f /tmp/sshportal_mariadb -else +elif [ -z "$2" ] || [ ! -f /etc/systemd/system/sshportal.service.d/custom.conf ]; then tee /etc/systemd/system/sshportal.service.d/custom.conf >/dev/null 2>&1 << END [Service]