Skip to content

Commit

Permalink
Use systemd unit key ConditionHost=
Browse files Browse the repository at this point in the history
`ConditionHost=` was added in systemd 189, so let’s use it, now that we
are not running systemd 27 anymore.

    $ more /usr/sbin/startup-hostname
    […]
    # This is a workaround for our systemd version not having ConditionHost=
    # This little helper is called by startup-hostname.service and creates
    #   /node/startup-hostname/HOSTNAME
    # So other services can use
    #   Wants=startup-hostname.service
    #   After=startup-hostname.service
    #   ConditionPathExists=/node/startup-hostname/HOSTNAME
    # to start a unit only on a specific host
    #
    […]
  • Loading branch information
pmenzel committed Feb 25, 2020
1 parent e731f1b commit e497beb
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 23 deletions.
1 change: 0 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ install_data misc_systemd_units/dhcrelay.service "$DESTDIR$systemdunitdi
install_data misc_systemd_units/enable_overcommit_memory.service "$DESTDIR$systemdunitdir/enable_overcommit_memory.service"
install_data misc_systemd_units/gdm.service "$DESTDIR$systemdunitdir/gdm.service"
install_data misc_systemd_units/startup-tags.service "$DESTDIR$systemdunitdir/startup-tags.service"
install_data misc_systemd_units/startup-hostname.service "$DESTDIR$systemdunitdir/startup-hostname.service"
install_data misc_systemd_units/unbound.service "$DESTDIR$systemdunitdir/unbound.service"
install_data misc_systemd_units/xaruba.service "$DESTDIR$systemdunitdir/xaruba.service"
install_data misc_systemd_units/yppasswd.service "$DESTDIR$systemdunitdir/yppasswd.service"
Expand Down
4 changes: 1 addition & 3 deletions misc_systemd_units/dhcrelay.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ Description=DHCP relay
Requires=network.target
After=network.target

Wants=startup-hostname.service
After=startup-hostname.service
ConditionPathExists=/node/startup-hostname/bka
ConditionHost=bka.molgen.mpg.de

[Service]

Expand Down
4 changes: 1 addition & 3 deletions misc_systemd_units/named.service
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[Unit]
After=network.service gateway.service mxmount.service automount.service

Wants=startup-hostname.service
After=startup-hostname.service
Before=mxstartup-mxvip.service
ConditionPathExists=/node/startup-hostname/wtf
ConditionHost=wtf.molgen.mpg.de

[Service]
Type=forking
Expand Down
7 changes: 0 additions & 7 deletions misc_systemd_units/startup-hostname.service

This file was deleted.

4 changes: 1 addition & 3 deletions misc_systemd_units/xaruba.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
After=network.service gateway.service mxmount.service
Before=network.target

Wants=startup-hostname.service
After=startup-hostname.service
ConditionPathExists=/node/startup-hostname/macheteinfach
ConditionHost=macheteinfach.molgen.mpg.de

[Service]
Type=oneshot
Expand Down
4 changes: 1 addition & 3 deletions misc_systemd_units/yppasswd.service
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[Unit]
After=network.service gateway.service mxmount.service automount.service

Wants=startup-hostname.service
After=startup-hostname.service
ConditionPathExists=/node/startup-hostname/wtf
ConditionHost=wtf.molgen.mpg.de

[Service]
Type=forking
Expand Down
4 changes: 1 addition & 3 deletions misc_systemd_units/ypserv.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
After=network.service gateway.service mxmount.service automount.service
Before=network.target

Wants=startup-hostname.service
After=startup-hostname.service
ConditionPathExists=/node/startup-hostname/wtf
ConditionHost=wtf.molgen.mpg.de

[Service]
Type=forking
Expand Down

0 comments on commit e497beb

Please sign in to comment.