diff options
author | Evgeni Golov <evgeni@grml.org> | 2014-03-29 14:28:02 +0100 |
---|---|---|
committer | Daniel Baumann <daniel@laptop.127011.net> | 2014-03-29 14:29:40 +0100 |
commit | e31d7cec9e48617a7509bab38cac32958f431d4e (patch) | |
tree | cfdb1c66522f518e3d6800340bff7e8d17e767a5 /components/9990-main.sh | |
parent | 5c45c7b9faa2b6cc118d5efee4e96bb98dfed4ab (diff) | |
download | live-boot-e31d7cec9e48617a7509bab38cac32958f431d4e.tar.gz live-boot-e31d7cec9e48617a7509bab38cac32958f431d4e.zip |
Supporting resolvconf in the squashfs.
When resolvconf is used in the squashfs, /etc/resolv.conf is a symlink
to the generated version. Depending on the size of the squashfs and
other factors, sometimes we try to write to /etc/resolv.conf while it
still points to nirvana, as resolvconf did not generate it yet.
Instead of being racy and writing to a file which will be regenerated
anyways, let's detect resolvconf and write to its base file instead.
Initial detection idea by Mika Prokop <mika@grml.org>
Diffstat (limited to 'components/9990-main.sh')
-rwxr-xr-x | components/9990-main.sh | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/components/9990-main.sh b/components/9990-main.sh index 83f087f..85b8a1d 100755 --- a/components/9990-main.sh +++ b/components/9990-main.sh @@ -178,10 +178,16 @@ Live () fi fi - if [ -f /etc/resolv.conf ] && [ ! -s ${rootmnt}/etc/resolv.conf ] + if [ -L /root/etc/resolv.conf ] ; then + # assume we have resolvconf + DNSFILE="${rootmnt}/etc/resolvconf/resolv.conf.d/base" + else + DNSFILE="${rootmnt}/etc/resolv.conf" + fi + if [ -f /etc/resolv.conf ] && [ ! -s ${DNSFILE} ] then - log_begin_msg "Copying /etc/resolv.conf to ${rootmnt}/etc/resolv.conf" - cp -v /etc/resolv.conf ${rootmnt}/etc/resolv.conf + log_begin_msg "Copying /etc/resolv.conf to ${DNSFILE}" + cp -v /etc/resolv.conf ${DNSFILE} log_end_msg fi |