From 435d97600b17889a4053845eb4ed593bcb927a6d Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 12 Aug 2019 12:29:16 +0200 Subject: [slx-network] fix symlink handling --- builder/modules.d/slx-network/hooks/copy-network-files.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'builder') diff --git a/builder/modules.d/slx-network/hooks/copy-network-files.sh b/builder/modules.d/slx-network/hooks/copy-network-files.sh index 10725595..759867bd 100644 --- a/builder/modules.d/slx-network/hooks/copy-network-files.sh +++ b/builder/modules.d/slx-network/hooks/copy-network-files.sh @@ -1,13 +1,19 @@ #!/bin/bash +type -p warn &> /dev/null || . /lib/dracut-lib.sh + if [ -n "$NEWROOT" ]; then # backup network configuration files found within stage4 # before copying ours over. for file in /etc/{hostname,resolv.conf,hosts}; do - if [ -e "${NEWROOT}/${file}" ]; then + if [ -e "$file" ]; then + warn "Missing '$file' - won't move it to stage4. " + continue + fi + if [ -e "${NEWROOT}/${file}" ] || [ -h "${NEWROOT}/${file}" ]; then mv "${NEWROOT}/${file}" "${NEWROOT}/${file}.stage4" fi - cp -f "$file" "${NEWROOT}/etc" + cp -af "$file" "${NEWROOT}/etc" done # move resolv.conf to /opt/openslx to detect we are managing it mkdir -p "${NEWROOT}/opt/openslx" -- cgit v1.2.3-55-g7522