summaryrefslogtreecommitdiffstats
path: root/builder/modules.d/dnbd3-rootfs/hooks/mount-root-device.sh
blob: 36e4f091fa0a7903d611c8d6b5a97f7619d00a3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
# region imports

sleep 10
source '/usr/lib/rebash/core.sh'
core.import exceptions
type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
# endregion
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"

exceptions.try
{
if ! getarg root=; then
    source "/etc/openslx"
    mount "$SLX_DNBD3_DEVICE_COW" "$NEWROOT" $SLX_MOUNT_ROOT_OPTIONS
    if [ -n "$SLX_GENERATE_FSTAB_SCRIPT" ]; then
        eval "$SLX_GENERATE_FSTAB_SCRIPT"
    else
        echo "" > "$NEWROOT/etc/fstab"
    fi
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