Debian Codegraph @

ex/notify.d/200-write

raw
1 #!/bin/sh
2
3 # needrestart - Restart daemons after library updates.
4 #
5 # Authors:
6 # Thomas Liske <[email protected]>
7 #
8 # Copyright Holder:
9 # 2013 - 2025 (C) Thomas Liske <[email protected]>
10 #
11 # License:
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
16 #
17
18 # Use write to notify users on TTYs.
19
20 . /usr/lib/needrestart/notify.d.sh
21
22 if [ "$NR_NOTIFYD_DISABLE_WRITE" = '1' ]; then
23 echo "[$0] disabled in global config" 1>&2
24 exit 1
25 fi
26
27 case "$NR_SESSION" in
28 /dev/tty*|/dev/pts*)
29 echo "[$0] notify user $NR_USERNAME on $NR_SESSION" 1>&2
30 {
31 echo
32 gettext 'Your session is running obsolete binaries or libraries as listed below.
33 Please consider a relogin or restart of the affected processes!'
34 echo
35 echo
36 cat -n
37 echo
38 } | write "$NR_USERNAME" "$NR_SESSION" 2> /dev/null
39 ;;
40 *)
41 echo "[$0] skip session w/o tty" 1>&2
42 exit 1
43 ;;
44 esac