Drop support for sysvinit scripts
As announced by a few releases now, finally drop support for sysvinit scripts. Keep rc-local generator for now, as it's really a distinct feature even though from the same era.
This commit is contained in:
@@ -449,118 +449,6 @@ systemctl unset-environment IMPORT_THIS IMPORT_THIS_TOO
|
||||
(! systemctl show-environment | grep "^IMPORT_THIS=")
|
||||
(! systemctl show-environment | grep "^IMPORT_THIS_TOO=")
|
||||
|
||||
# test for sysv-generator (issue #24990)
|
||||
if [[ -x /usr/lib/systemd/system-generators/systemd-sysv-generator ]]; then
|
||||
# This is configurable via -Dsysvinit-path=, but we can't get the value
|
||||
# at runtime, so let's just support the two most common paths for now.
|
||||
[[ -d /etc/rc.d/init.d ]] && SYSVINIT_PATH="/etc/rc.d/init.d" || SYSVINIT_PATH="/etc/init.d"
|
||||
|
||||
# OpenSUSE leaves sysvinit-path enabled, which means systemd-sysv-generator is built
|
||||
# but may not create the directory if there's no services that use it.
|
||||
mkdir -p "$SYSVINIT_PATH"
|
||||
|
||||
# invalid dependency
|
||||
cat >"${SYSVINIT_PATH:?}/issue-24990" <<\EOF
|
||||
#!/usr/bin/env bash
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides:test1 test2
|
||||
# Required-Start:test1 $remote_fs $network
|
||||
# Required-Stop:test1 $remote_fs $network
|
||||
# Description:Test
|
||||
# Short-Description: Test
|
||||
### END INIT INFO
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting issue-24990.service"
|
||||
sleep 1000 &
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping issue-24990.service"
|
||||
sleep 10 &
|
||||
;;
|
||||
*)
|
||||
echo "Usage: service test {start|stop|restart|status}"
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
|
||||
chmod +x "$SYSVINIT_PATH/issue-24990"
|
||||
systemctl daemon-reload
|
||||
[[ -L /run/systemd/generator.late/test1.service ]]
|
||||
[[ -L /run/systemd/generator.late/test2.service ]]
|
||||
assert_eq "$(readlink -f /run/systemd/generator.late/test1.service)" "/run/systemd/generator.late/issue-24990.service"
|
||||
assert_eq "$(readlink -f /run/systemd/generator.late/test2.service)" "/run/systemd/generator.late/issue-24990.service"
|
||||
output=$(systemctl cat issue-24990)
|
||||
assert_in "SourcePath=$SYSVINIT_PATH/issue-24990" "$output"
|
||||
assert_in "Description=LSB: Test" "$output"
|
||||
assert_in "After=test1.service" "$output"
|
||||
assert_in "After=remote-fs.target" "$output"
|
||||
assert_in "After=network-online.target" "$output"
|
||||
assert_in "Wants=network-online.target" "$output"
|
||||
assert_in "ExecStart=$SYSVINIT_PATH/issue-24990 start" "$output"
|
||||
assert_in "ExecStop=$SYSVINIT_PATH/issue-24990 stop" "$output"
|
||||
systemctl status issue-24990 || :
|
||||
systemctl show issue-24990
|
||||
assert_not_in "issue-24990.service" "$(systemctl show --property=After --value)"
|
||||
assert_not_in "issue-24990.service" "$(systemctl show --property=Before --value)"
|
||||
|
||||
if ! systemctl is-active network-online.target; then
|
||||
systemctl start network-online.target
|
||||
fi
|
||||
|
||||
systemctl restart issue-24990
|
||||
systemctl stop issue-24990
|
||||
|
||||
# valid dependency
|
||||
cat >"$SYSVINIT_PATH/issue-24990" <<\EOF
|
||||
#!/usr/bin/env bash
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides:test1 test2
|
||||
# Required-Start:$remote_fs
|
||||
# Required-Stop:$remote_fs
|
||||
# Description:Test
|
||||
# Short-Description: Test
|
||||
### END INIT INFO
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting issue-24990.service"
|
||||
sleep 1000 &
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping issue-24990.service"
|
||||
sleep 10 &
|
||||
;;
|
||||
*)
|
||||
echo "Usage: service test {start|stop|restart|status}"
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
|
||||
chmod +x "$SYSVINIT_PATH/issue-24990"
|
||||
systemctl daemon-reload
|
||||
[[ -L /run/systemd/generator.late/test1.service ]]
|
||||
[[ -L /run/systemd/generator.late/test2.service ]]
|
||||
assert_eq "$(readlink -f /run/systemd/generator.late/test1.service)" "/run/systemd/generator.late/issue-24990.service"
|
||||
assert_eq "$(readlink -f /run/systemd/generator.late/test2.service)" "/run/systemd/generator.late/issue-24990.service"
|
||||
output=$(systemctl cat issue-24990)
|
||||
assert_in "SourcePath=$SYSVINIT_PATH/issue-24990" "$output"
|
||||
assert_in "Description=LSB: Test" "$output"
|
||||
assert_in "After=remote-fs.target" "$output"
|
||||
assert_in "ExecStart=$SYSVINIT_PATH/issue-24990 start" "$output"
|
||||
assert_in "ExecStop=$SYSVINIT_PATH/issue-24990 stop" "$output"
|
||||
systemctl status issue-24990 || :
|
||||
systemctl show issue-24990
|
||||
assert_not_in "issue-24990.service" "$(systemctl show --property=After --value)"
|
||||
assert_not_in "issue-24990.service" "$(systemctl show --property=Before --value)"
|
||||
|
||||
systemctl restart issue-24990
|
||||
systemctl stop issue-24990
|
||||
fi
|
||||
|
||||
# %J in WantedBy= causes ABRT (#26467)
|
||||
cat >/run/systemd/system/test-WantedBy.service <<EOF
|
||||
[Service]
|
||||
|
||||
Reference in New Issue
Block a user