From a405f918c7184afe3aef68976c9826c28abf5776 Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Sat, 17 May 2025 09:50:04 +0300 Subject: [PATCH] workaround resolv.conf unlinkat by throwing res-options to profile.d --- etc/NetworkManager-resolv.conf-restore.bash | 5 +++++ etc/profile.d/99-resolv.conf-options.sh | 2 ++ etc/resolv.conf-generate.bash | 5 +++++ etc/systemd-resolv.conf-generate.bash | 5 +++++ etc/systemd-resolv.conf-restore.bash | 5 +++++ etc/traditional-resolv.conf-generate.bash | 5 +++++ 6 files changed, 27 insertions(+) create mode 100644 etc/profile.d/99-resolv.conf-options.sh diff --git a/etc/NetworkManager-resolv.conf-restore.bash b/etc/NetworkManager-resolv.conf-restore.bash index 3ab66a44..4405586e 100755 --- a/etc/NetworkManager-resolv.conf-restore.bash +++ b/etc/NetworkManager-resolv.conf-restore.bash @@ -5,6 +5,11 @@ set -x # well. I think it's even less likely I use this than the systemd-resolved # one, but anyway +if [[ ! -d /sysroot/ostree ]]; then + echo "Let's not mess up with Fedora Atomic. Try \$RES_OPTIONS instead? In profile.d?" + exit 1 +fi + # I know there are old versions that used something else, but I don't remember # that name and they are ancient. if ! hash nmcli 2> /dev/null; then diff --git a/etc/profile.d/99-resolv.conf-options.sh b/etc/profile.d/99-resolv.conf-options.sh new file mode 100644 index 00000000..3208df1f --- /dev/null +++ b/etc/profile.d/99-resolv.conf-options.sh @@ -0,0 +1,2 @@ +# This is equivalent to options in /etc/resolv.conf +export RES_OPTIONS="timeout:1 attempts:5 rotate edns0 trust-ad" diff --git a/etc/resolv.conf-generate.bash b/etc/resolv.conf-generate.bash index 9851b275..b9d1f9d7 100755 --- a/etc/resolv.conf-generate.bash +++ b/etc/resolv.conf-generate.bash @@ -1,6 +1,11 @@ #!/usr/bin/env bash set -x +if [[ ! -d /sysroot/ostree ]]; then + echo "Let's not mess up with Fedora Atomic. Try \$RES_OPTIONS instead? In profile.d?" + exit 1 +fi + # Require root or exit if [ "$(id -u)" != "0" ]; then echo "This script requires root." 1>&2 diff --git a/etc/systemd-resolv.conf-generate.bash b/etc/systemd-resolv.conf-generate.bash index f4f8d29d..0e655bfe 100755 --- a/etc/systemd-resolv.conf-generate.bash +++ b/etc/systemd-resolv.conf-generate.bash @@ -5,6 +5,11 @@ set -x # systemd-resolved as a DNS server. And then it also took parts of the # restore script. +if [[ ! -d /sysroot/ostree ]]; then + echo "Let's not mess up with Fedora Atomic. Try \$RES_OPTIONS instead? In profile.d?" + exit 1 +fi + # I know there are old versions that used something else, but I don't remember # that name and they are ancient. if ! hash resolvectl 2> /dev/null; then diff --git a/etc/systemd-resolv.conf-restore.bash b/etc/systemd-resolv.conf-restore.bash index e638d50b..05d06fc4 100755 --- a/etc/systemd-resolv.conf-restore.bash +++ b/etc/systemd-resolv.conf-restore.bash @@ -4,6 +4,11 @@ set -x # I just had a feeling I should also have a quick script to quickly restore # systemd-resolved handling of the file. +if [[ ! -d /sysroot/ostree ]]; then + echo "Let's not mess up with Fedora Atomic. Try \$RES_OPTIONS instead? In profile.d?" + exit 1 +fi + # I know there are old versions that used something else, but I don't remember # that name and they are ancient. if ! hash resolvectl 2> /dev/null; then diff --git a/etc/traditional-resolv.conf-generate.bash b/etc/traditional-resolv.conf-generate.bash index 32fdf5a4..3a21dc96 100755 --- a/etc/traditional-resolv.conf-generate.bash +++ b/etc/traditional-resolv.conf-generate.bash @@ -1,6 +1,11 @@ #!/usr/bin/env bash set -x +if [[ ! -d /sysroot/ostree ]]; then + echo "Let's not mess up with Fedora Atomic. Try \$RES_OPTIONS instead? In profile.d?" + exit 1 +fi + # Require root or exit if [ "$(id -u)" != "0" ]; then echo "This script requires root. (And the 3 nameserver IPs as arguments)" 1>&2