summaryrefslogtreecommitdiff
path: root/libre/systemd/systemd-hook
blob: 793a429438ac61f2cd4b8f5fa6ad4b8c1f8e487e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh -e

systemd_live() {
  if [ ! -d /run/systemd/system ]; then
    echo >&2 "  Skipped: Current root is not booted."
    exit 0
  fi
}

case $1 in
  catalog)  /usr/bin/journalctl --update-catalog ;;
  update)   touch -c /usr ;;
  sysusers) /usr/bin/systemd-sysusers ;;
  tmpfiles) /usr/bin/systemd-tmpfiles --create ;;

  daemon-reload) systemd_live; /usr/bin/systemctl daemon-reload ;;
  binfmt)        systemd_live; /usr/lib/systemd/systemd-binfmt ;;
  sysctl)        systemd_live; /usr/lib/systemd/systemd-sysctl ;;

  *) echo >&2 "  Invalid operation '$1'"; exit 1 ;;
esac

exit 0