check permissions before executing chmod

This commit is contained in:
Matheson Steplock 2023-10-06 05:39:19 +00:00 committed by GitHub
parent f000d4f733
commit eb0265e028
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"