Skip to content

Commit

Permalink
build(deb): fix mariadb config overwrite on upgrade
Browse files Browse the repository at this point in the history
bug in postinstall script always replacing /etc/systemd/system/sshportal.service.d/custom.conf with the sqlite3 config
  • Loading branch information
libvoid committed May 2, 2024
1 parent b79e51c commit db56c76
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packaging/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]
Expand Down

0 comments on commit db56c76

Please sign in to comment.