summary refs log tree commit diff
path: root/nixos/modules/system/boot/stage-2-init.sh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-18 16:40:27 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-18 16:48:11 +0200
commit21573af9fb0b53806703c44b46d813b0c5d6efa5 (patch)
treef45c95aa793604f3eb0c11010b52f5d65d348723 /nixos/modules/system/boot/stage-2-init.sh
parent5c62d3d26b07bb78ec92aec69e99dbee542f5e9d (diff)
downloadnixpkgs-21573af9fb0b53806703c44b46d813b0c5d6efa5.tar
nixpkgs-21573af9fb0b53806703c44b46d813b0c5d6efa5.tar.gz
nixpkgs-21573af9fb0b53806703c44b46d813b0c5d6efa5.tar.bz2
nixpkgs-21573af9fb0b53806703c44b46d813b0c5d6efa5.tar.lz
nixpkgs-21573af9fb0b53806703c44b46d813b0c5d6efa5.tar.xz
nixpkgs-21573af9fb0b53806703c44b46d813b0c5d6efa5.tar.zst
nixpkgs-21573af9fb0b53806703c44b46d813b0c5d6efa5.zip
Containers: Use /etc/resolv.conf supplied by the host
This used to work with systemd-nspawn 203, because it bind-mounted
/etc/resolv.conf (so openresolv couldn't overwrite it). Now it's just
copied, so we need some special handling.
Diffstat (limited to 'nixos/modules/system/boot/stage-2-init.sh')
-rw-r--r--nixos/modules/system/boot/stage-2-init.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index 6657897750e..62e08bb9ece 100644
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -96,8 +96,6 @@ mkdir -m 0755 -p /etc/nixos
 
 # Miscellaneous boot time cleanup.
 rm -rf /var/run /var/lock
-rm -f /etc/resolv.conf
-touch /etc/resolv.conf
 rm -f /etc/{group,passwd,shadow}.lock
 
 if test -n "@cleanTmpDir@"; then
@@ -149,6 +147,12 @@ if test -n "$resumeDevice"; then
 fi
 
 
+# Use /etc/resolv.conf supplied by systemd-nspawn, if applicable.
+if [ -n "@useHostResolvConf@" -a -e /etc/resolv.conf ]; then
+    cat /etc/resolv.conf | resolvconf -m 1000 -a host
+fi
+
+
 # Run the script that performs all configuration activation that does
 # not have to be done at boot time.
 echo "running activation script..."