33 lines
885 B
Bash
33 lines
885 B
Bash
#!/hint/bash
|
|
|
|
require_module "$(dirname -- "${BASH_SOURCE[0]}")/testuser.sh"
|
|
|
|
post_install+=(10:systemd-osi-run:post_install)
|
|
systemd-osi-run:post_install() {
|
|
local arg_mountpoint=$1
|
|
|
|
cat <<-'EOT' > "${arg_mountpoint}/etc/systemd/system/osi-run.target"
|
|
[Unit]
|
|
Description=osi-run target
|
|
Requires=multi-user.target
|
|
After=multi-user.target
|
|
Conflicts=rescue.target
|
|
AllowIsolate=yes
|
|
EOT
|
|
ln -sT testsuite.target "${arg_mountpoint}/etc/systemd/system/default.target"
|
|
|
|
cat <<-'EOT' > "${arg_mountpoint}/etc/systemd/system/osi-run.service"
|
|
[Unit]
|
|
Description=osi-run service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=/bin/sh -c 'su testuser -c /etc/osi-run > /var/log/osi-run.out; echo $? > /var/log/osi-run.status'
|
|
ExecStopPost=/bin/systemctl poweroff --no-block
|
|
|
|
[Install]
|
|
WantedBy=osi-run.target
|
|
EOT
|
|
systemctl --root="$arg_mountpoint" enable osi-run.service
|
|
}
|