Skip to content
This repository has been archived by the owner on Sep 30, 2021. It is now read-only.

Commit

Permalink
restart create_ap after suspend-and-resume
Browse files Browse the repository at this point in the history
Uses the /lib/systemd/system-sleep mechanism.
See https://www.freedesktop.org/software/systemd/man/systemd-suspend.service.html for how this works.

For unclear reasons, this only works in /lib/systemd/system-sleep, not in /usr/lib/systemd/system-sleep.

(ping #153, #167)
  • Loading branch information
dlenski committed Apr 16, 2020
1 parent 048ca4e commit af2213d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ install:
install -Dm755 create_ap $(DESTDIR)$(BINDIR)/create_ap
install -Dm644 create_ap.conf $(DESTDIR)/etc/create_ap.conf
[ ! -d /lib/systemd/system ] || install -Dm644 create_ap.service $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
[ ! -d /lib/systemd/system-sleep ] || install -Dm755 create_ap.resume $(DESTDIR)/lib/systemd/system-sleep/create_ap.resume
[ ! -e /sbin/openrc-run ] || install -Dm755 create_ap.openrc $(DESTDIR)/etc/init.d/create_ap
install -Dm644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
install -Dm644 README.md $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
Expand All @@ -18,6 +19,7 @@ uninstall:
rm -f $(DESTDIR)$(BINDIR)/create_ap
rm -f $(DESTDIR)/etc/create_ap.conf
[ ! -f /lib/systemd/system/create_ap.service ] || rm -f $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
[ ! -f /lib/systemd/system-sleep/create_ap.resume ] || rm -f $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.resume
[ ! -e /sbin/openrc-run ] || rm -f $(DESTDIR)/etc/init.d/create_ap
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
rm -f $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
11 changes: 11 additions & 0 deletions create_ap.resume
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -e

# After resume, restart create_ap service (if it was already running)
# See:
# https://www.freedesktop.org/software/systemd/man/systemd-suspend.service.html

case "$1" in
pre) ;;
post) /bin/systemctl try-restart create_ap.service ;;
esac

0 comments on commit af2213d

Please sign in to comment.