summaryrefslogtreecommitdiffstats
path: root/builder/modules.d/systemd-networkd-ext
diff options
context:
space:
mode:
Diffstat (limited to 'builder/modules.d/systemd-networkd-ext')
-rw-r--r--builder/modules.d/systemd-networkd-ext/hooks/copy-networkd-files-to-newroot.sh21
1 files changed, 12 insertions, 9 deletions
diff --git a/builder/modules.d/systemd-networkd-ext/hooks/copy-networkd-files-to-newroot.sh b/builder/modules.d/systemd-networkd-ext/hooks/copy-networkd-files-to-newroot.sh
index 1b5badc7..ec61616c 100644
--- a/builder/modules.d/systemd-networkd-ext/hooks/copy-networkd-files-to-newroot.sh
+++ b/builder/modules.d/systemd-networkd-ext/hooks/copy-networkd-files-to-newroot.sh
@@ -13,18 +13,21 @@ for UNIT in \
systemd-resolved.service
do
UNIT_PATH="$(systemctl show -p FragmentPath $UNIT | cut -c 14-)"
+ [ -z "${UNIT_PATH}" ] && continue
mkdir -p "${NEWROOT}/${UNIT_PATH%/*}"
cp "${UNIT_PATH}" "${NEWROOT}/${UNIT_PATH}"
ln -sf "${UNIT_PATH}" "${NEWROOT_SYSINIT_TARGET_DIR}/${UNIT}"
done
-# this drop-in is needed to prevent a pull-in loop sysinit.target <-> basic.target
-mkdir -p "${NEWROOT_SYSTEMD_DIR}/systemd-resolved.service.d/"
-cat <<-EOF > "${NEWROOT_SYSTEMD_DIR}/systemd-resolved.service.d/00-no-default-deps.conf"
- [Unit]
- DefaultDependencies=no
-EOF
+if [ -e "${NEWROOT_SYSTEMD_DIR}/systemd-resolved.service" ]; then
+ # this drop-in is needed to prevent a pull-in loop sysinit.target <-> basic.target
+ mkdir -p "${NEWROOT_SYSTEMD_DIR}/systemd-resolved.service.d/"
+ cat <<-EOF > "${NEWROOT_SYSTEMD_DIR}/systemd-resolved.service.d/00-no-default-deps.conf"
+ [Unit]
+ DefaultDependencies=no
+ EOF
-# finally make sure the NEWROOT resolv.conf links to the one managed by resolved.
-rm "${NEWROOT}"/etc/resolv.conf
-ln -s /run/systemd/resolve/resolv.conf "${NEWROOT}"/etc/resolv.conf
+ # finally make sure the NEWROOT resolv.conf links to the one managed by resolved.
+ rm "${NEWROOT}"/etc/resolv.conf
+ ln -s /run/systemd/resolve/resolv.conf "${NEWROOT}"/etc/resolv.conf
+fi