aboutsummaryrefslogtreecommitdiff
path: root/mautrix-whatsapp/doinst.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mautrix-whatsapp/doinst.sh')
-rw-r--r--mautrix-whatsapp/doinst.sh16
1 files changed, 14 insertions, 2 deletions
diff --git a/mautrix-whatsapp/doinst.sh b/mautrix-whatsapp/doinst.sh
index 792310f..743e861 100644
--- a/mautrix-whatsapp/doinst.sh
+++ b/mautrix-whatsapp/doinst.sh
@@ -11,6 +11,18 @@ config() {
# Otherwise, we leave the .new copy for the admin to consider...
}
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+
if ! getent passwd mautrix-whatsapp >/dev/null; then
useradd mautrix-whatsapp \
--comment 'Mautrix whatsapp matrix bridge' \
@@ -20,8 +32,8 @@ if ! getent passwd mautrix-whatsapp >/dev/null; then
|| true
fi
-config etc/rc.d/rc.mautrix-whatsapp.new
-config etc/mautrix-whatsapp/config.yaml.new
+preserve_perms etc/rc.d/rc.mautrix-whatsapp.new
+preserve_perms etc/mautrix-whatsapp/config.yaml.new
chown root:mautrix-whatsapp etc/mautrix-whatsapp
chown mautrix-whatsapp:mautrix-whatsapp var/lib/mautrix-whatsapp