summaryrefslogtreecommitdiffstats
path: root/modules.d/slx-network/hooks/s3-copy-network-files.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d/slx-network/hooks/s3-copy-network-files.sh')
-rwxr-xr-xmodules.d/slx-network/hooks/s3-copy-network-files.sh53
1 files changed, 26 insertions, 27 deletions
diff --git a/modules.d/slx-network/hooks/s3-copy-network-files.sh b/modules.d/slx-network/hooks/s3-copy-network-files.sh
index 5d28669e..46f4ab38 100755
--- a/modules.d/slx-network/hooks/s3-copy-network-files.sh
+++ b/modules.d/slx-network/hooks/s3-copy-network-files.sh
@@ -1,31 +1,30 @@
-#!/bin/bash
+#!/bin/ash
-type -p warn &> /dev/null || . /lib/dracut-lib.sh
+# backup network configuration files found in stage4, copy ours
+for file in "hostname" "hosts" "resolv.conf"; do
+ file="/etc/$file"
+ if ! [ -e "$file" ]; then
+ echo "Missing '$file' - can't move it to stage4. "
+ continue
+ fi
+ if [ -e "${NEWROOT}/${file}" ] || [ -h "${NEWROOT}/${file}" ]; then
+ mv "${NEWROOT}/${file}" "${NEWROOT}/${file}.renamed-by-stage3"
+ fi
+ cp -af -- "$file" "${NEWROOT}${file}"
+done
-if [ -n "$NEWROOT" ]; then
- # backup network configuration files found in stage4
- for file in /etc/{hostname,hosts,resolv.conf}; do
- if [ ! -e "$file" ]; then
- warn "Missing '$file' - can't move it to stage4. "
- continue
- fi
- if [ -e "${NEWROOT}/${file}" ] || [ -h "${NEWROOT}/${file}" ]; then
- mv "${NEWROOT}/${file}" "${NEWROOT}/${file}.renamed-by-stage3"
- fi
- cp -af "$file" "${NEWROOT}/etc/"
- done
- # special handling for resolv.conf:
- # move it to /opt/openslx to detect we are managing it
- mkdir -p "${NEWROOT}/opt/openslx"
- mv "${NEWROOT}/etc/resolv.conf" "${NEWROOT}/opt/openslx/resolv.conf"
- ln -s "/opt/openslx/resolv.conf" "${NEWROOT}/etc/resolv.conf"
+# special handling for resolv.conf:
+# move it to /opt/openslx to detect we are managing it
+mkdir -p "${NEWROOT}/opt/openslx"
+mv "${NEWROOT}/etc/resolv.conf" "${NEWROOT}/opt/openslx/resolv.conf"
+ln -nfs "/opt/openslx/resolv.conf" "${NEWROOT}/etc/resolv.conf"
- # HACK: finally make sure we have rdns helper
- # This should be done more elegantly one day...
- rdns="$(type -p rdns)"
- if [ -n "$rdns" ]; then
- mkdir -p "${NEWROOT}/opt/openslx/bin"
- cp -f "$rdns" "${NEWROOT}/opt/openslx/bin"
- fi
+# HACK: finally make sure we have rdns helper
+# This should be done more elegantly one day...
+rdns="$( command -p rdns )"
+if [ -n "$rdns" ]; then
+ mkdir -p "${NEWROOT}/opt/openslx/bin"
+ cp -f "$rdns" "${NEWROOT}/opt/openslx/bin"
fi
-true
+
+exit 0