lilith.initd 943 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/sbin/openrc-run
  2. # Copyright 1999-2023 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. depend() {
  5. use net
  6. }
  7. start() {
  8. PWHOME="$(getent passwd $USER | awk -F: '{ print $6 }')"
  9. ebegin "Starting lilith"
  10. env TERM="xterm" DARKFI_LOG="/tmp/lilith.log" LOG_TARGETS="!MessageSubsystem::notify" \
  11. start-stop-daemon \
  12. --start \
  13. --make-pidfile \
  14. --pidfile /var/run/lilith.pid \
  15. --background \
  16. --user $USER \
  17. --env HOME="${PWHOME:-/home/$USER}" \
  18. --name lilith \
  19. --exec /usr/bin/screen -- \
  20. -L -Logfile /home/lilith/screenlog.0 \
  21. -d -m -S lilith /usr/local/bin/lilith
  22. eend $?
  23. }
  24. stop() {
  25. ebegin "Stopping lilith"
  26. # Because we've daemonized with screen, we need to replace the PID file
  27. # with the real PID of the program
  28. pgrep -P $(cat /var/run/lilith.pid) > /var/run/lilith.pid
  29. start-stop-daemon --stop --signal 15 \
  30. --pidfile /var/run/lilith.pid
  31. eend $?
  32. }