diff --git a/etc/resolv.conf-generate.bash b/etc/resolv.conf-generate.bash index e2ebff57..9851b275 100755 --- a/etc/resolv.conf-generate.bash +++ b/etc/resolv.conf-generate.bash @@ -19,10 +19,19 @@ rm -v /etc/resolv.conf # tee -p = operate in a more appropriate MODE with pipes. printf 'nameserver ::1\nnameserver 127.0.0.1\nnameserver 127.0.0.53\nsearch .\noptions timeout:1 attempts:5 rotate edns0 trust-ad\n' | tee -p /etc/resolv.conf -# Remove all other permissions than everyone reading resolv.conf -chmod -v a=r /etc/resolv.conf -# Make resolv.conf immutable again so it's pretty sure nothing else edits it. -#chattr -V +i /etc/resolv.conf +# Are we on Fedora Atomic? +if [[ ! -d /sysroot/ostree ]]; then + # Remove all other permissions than everyone reading resolv.conf + chmod -v a=r /etc/resolv.conf + # Make resolv.conf immutable again so it's pretty sure nothing else edits it + chattr -V +i /etc/resolv.conf +else + # We are on Fedora Atomic and thus won't want to cause additional errors + chmod -v 0644 /sysroot/ostree/deploy/fedora/deploy/*/etc/resolv.conf | true + chmod -v 0644 /sysroot/ostree/repo/extensions/rpmostree/private/commit/usr/etc/resolv.conf | true + chattr -V -i /sysroot/ostree/deploy/fedora/deploy/*/etc/resolv.conf | true + chattr -V -i /sysroot/ostree/repo/extensions/rpmostree/private/commit/usr/etc/resolv.conf | true +fi # Let's just see it's ok ls -l /etc/resolv.conf diff --git a/etc/systemd-resolv.conf-generate.bash b/etc/systemd-resolv.conf-generate.bash index 4569519a..f4f8d29d 100755 --- a/etc/systemd-resolv.conf-generate.bash +++ b/etc/systemd-resolv.conf-generate.bash @@ -31,10 +31,19 @@ rm -v /etc/resolv.conf # tee -p = operate in a more appropriate MODE with pipes. printf 'nameserver 127.0.0.53\nnameserver 127.0.0.53\nnameserver 127.0.0.53\nsearch .\noptions timeout:1 attempts:5 rotate edns0 trust-ad\n' | tee -p /etc/resolv.conf -# Remove all other permissions than everyone reading resolv.conf -chmod -v a=r /etc/resolv.conf -# Make resolv.conf immutable again so it's pretty sure nothing else edits it. -#chattr -V +i /etc/resolv.conf +# Are we on Fedora Atomic? +if [[ ! -d /sysroot/ostree ]]; then + # Remove all other permissions than everyone reading resolv.conf + chmod -v a=r /etc/resolv.conf + # Make resolv.conf immutable again so it's pretty sure nothing else edits it + chattr -V +i /etc/resolv.conf +else + # We are on Fedora Atomic and thus won't want to cause additional errors + chmod -v 0644 /sysroot/ostree/deploy/fedora/deploy/*/etc/resolv.conf | true + chmod -v 0644 /sysroot/ostree/repo/extensions/rpmostree/private/commit/usr/etc/resolv.conf | true + chattr -V -i /sysroot/ostree/deploy/fedora/deploy/*/etc/resolv.conf | true + chattr -V -i /sysroot/ostree/repo/extensions/rpmostree/private/commit/usr/etc/resolv.conf | true +fi # Let's just see it's ok ls -l /etc/resolv.conf diff --git a/etc/traditional-resolv.conf-generate.bash b/etc/traditional-resolv.conf-generate.bash index 63f341fc..32fdf5a4 100755 --- a/etc/traditional-resolv.conf-generate.bash +++ b/etc/traditional-resolv.conf-generate.bash @@ -24,10 +24,19 @@ rm -v /etc/resolv.conf # tee -p = operate in a more appropriate MODE with pipes. printf "nameserver %b\nnameserver %b\nnameserver %b\nsearch .\noptions timeout:1 attempts:5 rotate edns0 trust-ad\n" "$1" "$2" "$3" | tee -p /etc/resolv.conf -# Remove all other permissions than everyone reading resolv.conf -chmod -v a=r /etc/resolv.conf -# Make resolv.conf immutable again so it's pretty sure nothing else edits it. -#chattr -V +i /etc/resolv.conf +# Are we on Fedora Atomic? +if [[ ! -d /sysroot/ostree ]]; then + # Remove all other permissions than everyone reading resolv.conf + chmod -v a=r /etc/resolv.conf + # Make resolv.conf immutable again so it's pretty sure nothing else edits it + chattr -V +i /etc/resolv.conf +else + # We are on Fedora Atomic and thus won't want to cause additional errors + chmod -v 0644 /sysroot/ostree/deploy/fedora/deploy/*/etc/resolv.conf | true + chmod -v 0644 /sysroot/ostree/repo/extensions/rpmostree/private/commit/usr/etc/resolv.conf | true + chattr -V -i /sysroot/ostree/deploy/fedora/deploy/*/etc/resolv.conf | true + chattr -V -i /sysroot/ostree/repo/extensions/rpmostree/private/commit/usr/etc/resolv.conf | true +fi # Let's just see it's ok ls -l /etc/resolv.conf