summaryrefslogtreecommitdiffstats
path: root/builder/modules.d/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh
blob: ee308af65088e813408013adc95978af631e1199 (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
#!/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
{
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"

systemd_system_unit_path="$(dirname "$(find / -name dracut-mount.service \
    -type f -print -quit)")"
new_systemd_system_unit_path="${NEWROOT}/lib/systemd/system"
cp "${systemd_system_unit_path}/dnbd3root.service" \
    "${new_systemd_system_unit_path}/dnbd3root.service"
mkdir --parents "${new_systemd_system_unit_path}/sysinit.target.wants"
! ln --symbolic '../dnbd3root.service' \
    "${new_systemd_system_unit_path}/sysinit.target.wants/dnbd3root.service"
}
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