diff -Nur e-smith-nutUPS-2.6.0.old/createlinks e-smith-nutUPS-2.6.0/createlinks --- e-smith-nutUPS-2.6.0.old/createlinks 2008-10-07 13:36:30.000000000 -0400 +++ e-smith-nutUPS-2.6.0/createlinks 2020-11-18 17:03:35.873000000 -0500 @@ -2,16 +2,23 @@ use esmith::Build::CreateLinks qw(:all); -my @events = qw(bootstrap-console-save console-save post-install post-upgrade); +my @events = qw(bootstrap-console-save console-save post-install post-upgrade e-smith-nutUPS-update); templates2events("/etc/sysconfig/ups", @events); +templates2events("/usr/lib/systemd/system/nut-server.service.d/50koozali.conf", @events); +templates2events("/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf", @events); foreach (qw(ups.conf upsd.users upsmon.conf upssched.conf)) { templates2events("/etc/ups/$_", @events); } -foreach (qw(bootstrap-console-save console-save)) +foreach (qw(bootstrap-console-save console-save e-smith-nutUPS-update)) { templates2events("/etc/ups/upsd.conf", $_); } + +my $event="e-smith-nutUPS-update"; +safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut"); +templates2events("/etc/systemd/system-preset/49-koozali.preset", $event); +event_link("systemd-default", $event, "06"); diff -Nur e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/70nutUPS e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/70nutUPS --- e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/70nutUPS 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/70nutUPS 2020-11-18 16:55:27.146000000 -0500 @@ -0,0 +1,16 @@ +# nut UPS specific subservices +{ +$nutstatus = $nut{status} || 'disabled'; +$master = $nut{Master} || 'yes'; + +if ($nutstatus eq 'enabled') { + $OUT .= "enable nut-server.service\n" if ($master eq 'yes'); + $OUT .= "disable nut-server.service\n" unless ($master eq 'yes'); + $OUT .= "enable nut-monitor.service\n"; + } +else + { + $OUT .= "disable nut-server.service\n"; + $OUT .= "disable nut-monitor.service\n"; + } +} diff -Nur e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/20unit e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/20unit --- e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/20unit 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/20unit 2020-11-18 16:59:54.550000000 -0500 @@ -0,0 +1,3 @@ +[Unit] +PartOf=nut.service +After=nut.service diff -Nur e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/40service e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/40service --- e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/40service 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/40service 2020-11-18 16:59:11.957000000 -0500 @@ -0,0 +1,2 @@ +[Service] +ExecStartPre=/sbin/e-smith/service-status nut diff -Nur e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/80install e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/80install --- e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/80install 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf/80install 2020-11-18 16:59:11.957000000 -0500 @@ -0,0 +1,2 @@ +[Install] +WantedBy=sme-server.target diff -Nur e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/50koozali.conf/20unit e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/50koozali.conf/20unit --- e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/50koozali.conf/20unit 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/50koozali.conf/20unit 2020-11-18 16:40:01.717000000 -0500 @@ -0,0 +1,4 @@ +[Unit] +PartOf=nut.service +After=nut.service + diff -Nur e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/40service e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/40service --- e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/40service 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/40service 2020-11-18 16:58:26.162000000 -0500 @@ -0,0 +1,2 @@ +[Service] +ExecStartPre=/sbin/e-smith/service-status nut diff -Nur e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/80install e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/80install --- e-smith-nutUPS-2.6.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/80install 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-nutUPS-2.6.0/root/etc/e-smith/templates/usr/lib/systemd/system/nut-server.service.d/50koozali.conf/80install 2020-11-18 16:56:58.493000000 -0500 @@ -0,0 +1,2 @@ +[Install] +WantedBy=sme-server.target diff -Nur e-smith-nutUPS-2.6.0.old/root/usr/lib/systemd/system/nut.service e-smith-nutUPS-2.6.0/root/usr/lib/systemd/system/nut.service --- e-smith-nutUPS-2.6.0.old/root/usr/lib/systemd/system/nut.service 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-nutUPS-2.6.0/root/usr/lib/systemd/system/nut.service 2020-11-18 16:29:41.392000000 -0500 @@ -0,0 +1,22 @@ +[Unit] +Description=Network UPS Tools - Master service for Koozali SME Srrver +After=local-fs.target network.target nut-server.service + +[Service] +ExecStartPre=/sbin/e-smith/service-status nut +ExecStartPre=-/sbin/e-smith/expand-template /etc/sysconfig/ups +ExecStartPre=-/sbin/e-smith/expand-template /etc/ups/ups.conf +ExecStartPre=-/etc/ups/upsd.conf +ExecStartPre=-/etc/ups/upsd.users +ExecStartPre=-/etc/ups/upsmon.conf +ExecStartPre=-/etc/ups/upssched.conf + +# The dummy program will exit +Type=oneshot +# Execute a dummy program +ExecStart=/bin/true +# This service shall be considered active after start +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target sme-server.target