diff options
Diffstat (limited to 'modules.d/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh')
-rwxr-xr-x | modules.d/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules.d/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh b/modules.d/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh new file mode 100755 index 00000000..ff01474f --- /dev/null +++ b/modules.d/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh +source "/etc/openslx" + +mkdir --parents "${NEWROOT}/opt/openslx" +cp "/etc/openslx" "${NEWROOT}/opt/openslx/config" + +echo "## Generated by '$0' in stage3" >> "${NEWROOT}/opt/openslx/config" +cat "/run/openslx/network.conf" >> "${NEWROOT}/opt/openslx/config" + +# Set root/demo password for stage4, if set +if [ -n "${SLX_ROOT_PASS}" ]; then + sed -i "s#^root:[^:]*:#root:$SLX_ROOT_PASS:#" $NEWROOT/etc/shadow +fi +if [ -n "${SLX_DEMO_PASS}" ] && grep -q '^demo' $NEWROOT/etc/shadow; then + sed -i "s#^demo:[^:]*:#demo:$SLX_DEMO_PASS:#" $NEWROOT/etc/shadow +fi |