From eb0265e028256f6083c1e8f86ee10caa94801aea Mon Sep 17 00:00:00 2001 From: Matheson Steplock Date: Fri, 6 Oct 2023 05:39:19 +0000 Subject: [PATCH] check permissions before executing chmod --- homeassistant-supervised/DEBIAN/postinst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant-supervised/DEBIAN/postinst b/homeassistant-supervised/DEBIAN/postinst index 9a15ab1..22a406e 100755 --- a/homeassistant-supervised/DEBIAN/postinst +++ b/homeassistant-supervised/DEBIAN/postinst @@ -25,8 +25,11 @@ info "Restarting NetworkManager" systemctl restart "${SERVICE_NM}" # Set permissions of /etc/systemd/resolved.conf -info "Setting permissions of /etc/systemd/resolved.conf" -chmod 644 /etc/systemd/resolved.conf +# check if file has correct permissions +if [ "$(stat -c %a /etc/systemd/resolved.conf)" != "644" ]; then + info "Setting permissions of /etc/systemd/resolved.conf" + chmod 644 /etc/systemd/resolved.conf +fi # Enable and restart systemd-resolved info "Enable systemd-resolved"