#!/usr/bin/env bash # -*- coding: utf-8 -*- # region imports source '/usr/lib/rebash/core.sh' core.import exceptions core.import logging type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh # endregion exceptions.try { source "/etc/openslx" logging.set_commands_level debug logging.set_level debug [[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx logging.set_log_file "$SLX_LOG_FILE_PATH" 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 } exceptions.catch { logging.error "$exceptions_last_traceback" emergency_shell "error in ${BASH_SOURCE[0]}" } # region vim modline # vim: set tabstop=4 shiftwidth=4 expandtab: # vim: foldmethod=marker foldmarker=region,endregion: # endregion