package/systemd: add setting for systemd default.target

This adds the option to set systemd's default.target in
the System Configuration subheading if systemd is
specified as the init system.

The argument for default.target is specified pre-build
as opposed to overriding the hardcoded "multi-user.target"
symlink with post-build scripts or a rootfs overlay

Signed-off-by: Sen Hastings <sen@phobosdpl.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
This commit is contained in:
Sen Hastings 2022-04-26 16:43:12 -05:00 committed by Arnout Vandecappelle (Essensium/Mind)
parent 4b12336d1f
commit 985e9f733c
2 changed files with 12 additions and 1 deletions

View File

@ -571,7 +571,7 @@ SYSTEMD_CONF_OPTS += -Dfallback-hostname=$(SYSTEMD_FALLBACK_HOSTNAME)
endif
define SYSTEMD_INSTALL_INIT_HOOK
ln -fs multi-user.target \
ln -fs "$(call qstrip,$(BR2_PACKAGE_SYSTEMD_DEFAULT_TARGET))" \
$(TARGET_DIR)/usr/lib/systemd/system/default.target
endef

View File

@ -154,6 +154,17 @@ source "$BR2_BASE_DIR/.br2-external.in.init"
endchoice
config BR2_PACKAGE_SYSTEMD_DEFAULT_TARGET
string "The default unit systemd starts at bootup"
default "multi-user.target"
depends on BR2_INIT_SYSTEMD
help
Specify the name of the unit configuration file to be started
at bootup by systemd. Should end in ".target".
ex: multi-user.target
https://www.freedesktop.org/software/systemd/man/systemd.special.html#default.target
choice
prompt "/dev management" if !BR2_INIT_SYSTEMD
default BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_DEVTMPFS