hilfe mein git ist komisch
This commit is contained in:
44
etc/needrestart/notify.d/200-write
Executable file
44
etc/needrestart/notify.d/200-write
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
# needrestart - Restart daemons after library updates.
|
||||
#
|
||||
# Authors:
|
||||
# Thomas Liske <thomas@fiasko-nw.net>
|
||||
#
|
||||
# Copyright Holder:
|
||||
# 2013 - 2022 (C) Thomas Liske [http://fiasko-nw.net/~thomas/]
|
||||
#
|
||||
# License:
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
# Use write to notify users on TTYs.
|
||||
|
||||
. /usr/lib/needrestart/notify.d.sh
|
||||
|
||||
if [ "$NR_NOTIFYD_DISABLE_WRITE" = '1' ]; then
|
||||
echo "[$0] disabled in global config" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$NR_SESSION" in
|
||||
/dev/tty*|/dev/pts*)
|
||||
echo "[$0] notify user $NR_USERNAME on $NR_SESSION" 1>&2
|
||||
{
|
||||
echo
|
||||
gettext 'Your session is running obsolete binaries or libraries as listed below.
|
||||
Please consider a relogin or restart of the affected processes!'
|
||||
echo
|
||||
echo
|
||||
cat -n
|
||||
echo
|
||||
} | write "$NR_USERNAME" "$NR_SESSION" 2> /dev/null
|
||||
;;
|
||||
*)
|
||||
echo "[$0] skip session w/o tty" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
57
etc/needrestart/notify.d/400-notify-send
Executable file
57
etc/needrestart/notify.d/400-notify-send
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
|
||||
# needrestart - Restart daemons after library updates.
|
||||
#
|
||||
# Authors:
|
||||
# Thomas Liske <thomas@fiasko-nw.net>
|
||||
#
|
||||
# Copyright Holder:
|
||||
# 2013 - 2022 (C) Thomas Liske [http://fiasko-nw.net/~thomas/]
|
||||
#
|
||||
# License:
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
# Use notify-send (from libnotify-bin) to notify a user session via dbus.
|
||||
|
||||
NSEND='/usr/bin/notify-send'
|
||||
test -x "$NSEND" || exit 1
|
||||
|
||||
. /usr/lib/needrestart/notify.d.sh
|
||||
|
||||
if [ "$NR_NOTIFYD_DISABLE_NOTIFY_SEND" = '1' ]; then
|
||||
echo "[$0] disabled in global config" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$NR_SESSION" in
|
||||
session*)
|
||||
DBUS_SESSION_BUS_ADDRESS=$(sed -z -n s/^DBUS_SESSION_BUS_ADDRESS=//p "/proc/$NR_SESSPPID/environ")
|
||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
||||
unset DBUS_SESSION_BUS_ADDRESS
|
||||
fi
|
||||
|
||||
export DISPLAY=$(sed -z -n s/^DISPLAY=//p "/proc/$NR_SESSPPID/environ")
|
||||
export XAUTHORITY=$(sed -z -n s/^XAUTHORITY=//p "/proc/$NR_SESSPPID/environ")
|
||||
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
echo "[$0] could not find DISPLAY for $NR_USERNAME on $NR_SESSION" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[$0] notify user $NR_USERNAME on $DISPLAY" 1>&2
|
||||
|
||||
MSGTITLE=$(gettext 'Relogin or restarts required!')
|
||||
MSGBODY=$(gettext 'Your session is running obsolete binaries or libraries as listed below.
|
||||
<i><b>Please consider a relogin or restart of the affected processes!</b></i>')'\n'$(cat)
|
||||
|
||||
su -p -s /bin/sh -c "$NSEND -a needrestart -u critical -i dialog-warning \"$MSGTITLE\" \"$MSGBODY\"" "$NR_USERNAME"
|
||||
;;
|
||||
*)
|
||||
echo "[$0] skip session '$NR_SESSION'" 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
48
etc/needrestart/notify.d/600-mail
Executable file
48
etc/needrestart/notify.d/600-mail
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
|
||||
# needrestart - Restart daemons after library updates.
|
||||
#
|
||||
# Authors:
|
||||
# Thomas Liske <thomas@fiasko-nw.net>
|
||||
#
|
||||
# Copyright Holder:
|
||||
# 2013 - 2022 (C) Thomas Liske [http://fiasko-nw.net/~thomas/]
|
||||
#
|
||||
# License:
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
# Use /usr/bin/mail to notify a user via e-mail.
|
||||
|
||||
MAILX='/usr/bin/mail'
|
||||
test -x "$MAILX" || exit 1
|
||||
|
||||
. /usr/lib/needrestart/notify.d.sh
|
||||
|
||||
if [ "$NR_NOTIFYD_DISABLE_MAIL" = '1' ]; then
|
||||
echo "[$0] disabled in global config" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Skip system users
|
||||
NR_USERID=$(id -u "$NR_USERNAME")
|
||||
if [ "0$NR_USERID" -gt 0 ] && [ "0$NR_USERID" -lt 1000 ]; then
|
||||
echo "[$0] do not notify system-user $NR_USERNAME via mail" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[$0] notify user $NR_USERNAME on $NR_SESSION via mail" 1>&2
|
||||
|
||||
{
|
||||
_NR_FQDN=$(hostname -f)
|
||||
eval_gettext 'Your session on host $_NR_FQDN ($NR_SESSION) is running obsolete binaries or libraries as listed below.'
|
||||
echo
|
||||
echo
|
||||
gettext "Please consider a relogin or restart of the affected processes!"
|
||||
echo
|
||||
echo
|
||||
cat
|
||||
} | fold -s -w 72 | "$MAILX" -s "Relogin or restarts on host $(hostname) required!" "$NR_USERNAME"
|
||||
28
etc/needrestart/notify.d/README.needrestart
Normal file
28
etc/needrestart/notify.d/README.needrestart
Normal file
@@ -0,0 +1,28 @@
|
||||
Files located in /etc/needrestart/notify.d are used to notify running
|
||||
user sessions about usage of outdated libraries.
|
||||
|
||||
needrestart runs any executable file (except *~, *.dpkg-*, *.ex) naturally
|
||||
sorted by the filename for each notification. If the result code is 0 than
|
||||
needrestart will stop to run the remaining notification binaries.
|
||||
|
||||
|
||||
The following environment variables are set:
|
||||
|
||||
- NR_SESSION
|
||||
Session identifier (tty device node or systemd's session name).
|
||||
- NR_SESSPPID
|
||||
The first pid in the session detected by needrestart.
|
||||
- NR_UID
|
||||
User ID of the session owner.
|
||||
- NR_USERNAME
|
||||
Username of the session owner.
|
||||
|
||||
|
||||
The following file descriptors are used:
|
||||
|
||||
- /dev/stdin
|
||||
The list of obsolete processes.
|
||||
- /dev/stdout
|
||||
Closed.
|
||||
- /dev/stderr
|
||||
Available in verbose mode (-v).
|
||||
Reference in New Issue
Block a user