]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Rename novaboot-power-off.service to novaboot-delayed-power-off.service
authorMichal Sojka <michal.sojka@cvut.cz>
Thu, 17 Dec 2020 08:58:17 +0000 (09:58 +0100)
committerMichal Sojka <michal.sojka@cvut.cz>
Thu, 17 Dec 2020 09:12:15 +0000 (10:12 +0100)
Also rework the logic to not relay on systemd's Conflicts but switch
off the timer explicitly in novaboot-power script.

debian/novaboot-server.install
server/Makefile
server/adduser-novaboot
server/novaboot-shell
server/systemd/novaboot-delayed-power-off.service [moved from server/systemd/novaboot-power-off.service with 100% similarity]
server/systemd/novaboot-power
server/systemd/novaboot-power@.service

index 1659f1d66babdce6a88f47a61d987ede20648a00..6f35d49f2e1f79e00e399636a15fce9c5cc7604a 100644 (file)
@@ -4,7 +4,7 @@
 /lib/systemd/system/novaboot-power@.service
 /usr/sbin/novaboot-power
 /usr/bin/novaboot-shell
-/usr/lib/systemd/user/novaboot-power-off.service
+/usr/lib/systemd/user/novaboot-delayed-power-off.service
 /usr/lib/sysusers.d/novaboot-server.conf
 /usr/sbin/adduser-novaboot
 /usr/share/man/man1/novaboot-shell.1
index 812071ac37f34611531303f75c8b04befbe2ea00..190c5a1485727dff322384f5d910474e185aad4c 100644 (file)
@@ -17,6 +17,6 @@ install: all
        install -D -m 644 -t $(DESTDIR)/lib/systemd/system systemd/novaboot-power-off@.service
        install -D -m 644 -t $(DESTDIR)/lib/systemd/system systemd/novaboot-power-off@.timer
        install -D -m 644 -t $(DESTDIR)/lib/systemd/system systemd/novaboot-power@.service
-       install -D -m 644 -t $(DESTDIR)/usr/lib/systemd/user systemd/novaboot-power-off.service
+       install -D -m 644 -t $(DESTDIR)/usr/lib/systemd/user systemd/novaboot-delayed-power-off.service
        install -D -m 440 systemd/sudoers.novaboot-server $(DESTDIR)/etc/sudoers.d/novaboot-server
        install -D -m 755 -t $(DESTDIR)$(PREFIX)/sbin systemd/novaboot-power
index b4417d42e10303fef30561ca5b86dc2445efe668..dec3804cc2bf18ea953d624443a5ae6ee59d11f7 100755 (executable)
@@ -96,12 +96,12 @@ chown $user: $home/.novaboot-shell
 
 if [ -d /run/systemd/system ]; then
     cat <<EOF
-To enable automatic delayed power-off run 'systemctl --user enable novaboot-power-off'
+To enable automatic delayed power-off run 'systemctl --user enable novaboot-delayed-power-off'
 as the created user (e.g. via shell subcommand)
 EOF
     # TODO: Add a way to run in automatically from here (allow shell
     #subcommand to accept command lines)
-    #systemctl --user enable novaboot-power-off
+    #systemctl --user enable novaboot-delayed-power-off
 fi
 
 
index e9c60f793a5a91d606aaf079495a8dc2baaff1f3..10ed17356bef2a247caa9174c1e4a8d67b44112e 100755 (executable)
@@ -97,7 +97,7 @@ power() {
        *) die "Unexpected power parameter";;
     esac
 
-    if [ "$PPID" -ne 1 ] && systemctl --user is-enabled novaboot-power-off.service; then
+    if [ "$PPID" -ne 1 ] && systemctl --user is-enabled novaboot-delayed-power-off.service; then
        sudo novaboot-power "$1"
     else
        eval "$cmd"
index 8b1663e1c232ba33bec022b86decfc00d781e701..ede6e7bc2fda28c9b2640627bbac9c73b882d28c 100755 (executable)
@@ -7,9 +7,12 @@ fi
 
 case "$1" in
     on)
-       exec systemctl start "novaboot-power@${SUDO_USER}.service";;
+       systemctl stop  "novaboot-power-off@${SUDO_USER}.timer"
+       systemctl start "novaboot-power@${SUDO_USER}.service"
+       ;;
     off)
-       exec systemctl stop "novaboot-power@${SUDO_USER}.service";;
+       systemctl stop "novaboot-power@${SUDO_USER}.service"
+       ;;
     delayed-off)
        systemctl start "novaboot-power-off@${SUDO_USER}.timer"
        # || systemd-run --on-active="$2" --unit="novaboot-power-off@${SUDO_USER}.target"
index b5702b425321cb96a0b7d8e9d5a351e5db3f4e22..19ab41b2245f3765bdd45112286a4f5513cade0e 100644 (file)
@@ -4,7 +4,6 @@ Description=Power on/off novaboot target %i
 [Service]
 Type=oneshot
 RemainAfterExit=true
-ExecStartPre=systemctl stop novaboot-power-off@%i.timer
 ExecStart=/usr/bin/novaboot-shell on
 ExecStop=/usr/bin/novaboot-shell off
 User=%i