diskimage-builder/diskimage_builder/elements/dib-init-system/environment.d/99-dib-init-system
Andreas Florath 3636b40f74 Introduce manual setting of DIB_INIT_SYSTEM
The current implementation evauates the dib-init-system
script too early.  Also it looks that there is no simple
way of getting the info about the init system automatically:
another element can install (later on) a different
init system.  Therefore the only reliable way of setting
this is manual.

Change-Id: I6e9ffa1bdb3154f488f4fd335b197699b86aacd4
Signed-off-by: Andreas Florath <andreas@florath.net>
2019-11-21 12:38:15 +11:00

31 lines
791 B
Plaintext

#
# This runs last in the environment to ensure DIB_INIT_SYSTEM is set.
# We expect the base environments to set this variable particular to
# their platform. Note we used to try and guess this automatically
# inside the chroot, but there's a chicken-and-egg issue when you're
# building from scratch and you're guessing before you've even
# installed the init system.
#
if [ -z "${DIB_INIT_SYSTEM:-}" ]; then
echo "DIB_INIT_SYSTEM is not set! Can not continue"
exit 1
fi
# whitelist known systems
case $DIB_INIT_SYSTEM in
upstart) ;;
openrc) ;;
systemd) ;;
sysv) ;;
*)
echo "Unrecognised init system: ${DIB_INIT_SYSTEM}!"
echo "Can not continue"
exit 1
esac
# Tell emacs to use shell-mode
# Local variables:
# mode: sh
# End: