.gear/needrestart.spec | 116 +++++++++++++++++++++ .gear/rules | 3 + .../tags/4b5255b8bdd95d54650fa63aae13d18221cb5f36 | 6 ++ .gear/tags/list | 1 + ex/needrestart.conf | 1 + ex/notify.d/400-notify-send | 2 +- ex/notify.d/600-mail | 6 +- ex/restart.d/systemd-manager | 3 +- ex/restart.d/sysv-init | 3 +- lib/iucode-scan-versions | 9 +- man/needrestart.1 | 2 +- perl/lib/NeedRestart/Interp/Perl.pm | 10 +- perl/lib/NeedRestart/Interp/Python.pm | 10 +- perl/lib/NeedRestart/Interp/Ruby.pm | 10 +- 14 files changed, 168 insertions(+), 14 deletions(-) diff --git a/.gear/needrestart.spec b/.gear/needrestart.spec new file mode 100644 index 0000000..cd5e589 --- /dev/null +++ b/.gear/needrestart.spec @@ -0,0 +1,116 @@ +# Do not require optional packages needed by restart hooks: +%add_findreq_skiplist %_sysconfdir/%name/restart.d/* + +Name: needrestart +Version: 3.4 +Release: alt1 + +Summary: Restart daemons after library updates +License: GPLv2 +Group: System/Servers + +URL: https://github.com/liske/needrestart +Source: %name-%version.tar +Patch0: %name-%version-alt.patch + +Packager: %packager + +BuildRequires: perl-devel perl-Module-Find perl-Proc-ProcessTable perl-Sort-Naturally perl-Term-ReadKey perl-libintl perl-Module-ScanDeps + +%description +needrestart checks which daemons need to be restarted after library +upgrades. It is inspired by checkrestart from the debian-goodies +package. + +%package list +Summary: Automaticaly list daemons needs restart after apt run +Group: System/Servers +Requires: %name = %version-%release +BuildArch: noarch + +%description list +List daemons needs to be restarted after apt run + +%prep +%setup -n %name-%version +%patch0 -p1 + +%build + +%install +%makeinstall_std +rm -f %buildroot%perl_vendor_privlib/NeedRestart/UI/Debconf.pm +install -pDm 644 man/%name.1 %buildroot%_man1dir/%name.1 + +%find_lang --all-name %name + +# %name-list subpackage: +mkdir -p %buildroot%_sysconfdir/apt/apt.conf.d +cat > %buildroot%_sysconfdir/apt/apt.conf.d/%name.conf << EOF +RPM::Post-Invoke { "if [ -x /usr/sbin/needrestart ]; then /usr/sbin/needrestart -q -l -r l; fi"; }; +EOF + +%files -f %name.lang +%_sysconfdir/%name +%config(noreplace) %_sysconfdir/%name/%name.conf +%config(noreplace) %_sysconfdir/%name/notify.conf + +%_sbindir/%name +%_libexecdir/%name +%perl_vendor_privlib/NeedRestart* +%_datadir/polkit-1/actions/net.fiasko-nw.needrestart.policy +%_man1dir/%name.1.* +%doc AUTHORS README* NEWS INSTALL* ChangeLog + +%files list +%config(noreplace) %_sysconfdir/apt/apt.conf.d/%name.conf + +%changelog +* Wed May 29 2019 Terechkov Evgenii 3.4-alt1 +- 3.4-3 + +* Tue Jul 31 2018 Terechkov Evgenii 3.3-alt2 +- Make main package arch-dependent due to different Requires (iucode_tool) + +* Tue Jul 31 2018 Terechkov Evgenii 3.3-alt1 +- 3.3 + +* Fri Mar 30 2018 Terechkov Evgenii 3.1-alt1 +- 3.1 + +* Sat Mar 3 2018 Terechkov Evgenii 3.0-alt1 +- v3.0 +- N.B.: package firmware-intel-ucode needed for intel microcode check + +* Sat Mar 4 2017 Terechkov Evgenii 2.11-alt1 +- v2.11-3-g9423e6e + +* Sun Nov 20 2016 Terechkov Evgenii 2.10-alt4 +- v2.10-4-g3a5c39c + +* Fri Nov 11 2016 Terechkov Evgenii 2.10-alt3 +- Fix kernel version detection/reporting + +* Fri Nov 11 2016 Terechkov Evgenii 2.10-alt2 +- Add subpackage with apt hook: %name-list + +* Fri Nov 11 2016 Terechkov Evgenii 2.10-alt1 +- v2.10-1-gf28e5d4 + +* Fri Oct 14 2016 Terechkov Evgenii 2.9-alt1 +- 2.9 + +* Sat Jun 11 2016 Terechkov Evgenii 2.8-alt2 +- v2.8-4-ge9c29f4 + +* Fri May 20 2016 Terechkov Evgenii 2.8-alt1 +- 2.8 + +* Tue Apr 26 2016 Terechkov Evgenii 2.7-alt3 +- v2.7-7-g65c981d + +* Tue Mar 8 2016 Terechkov Evgenii 2.7-alt2 +- Fix mail/dbus notifications + +* Mon Mar 7 2016 Terechkov Evgenii 2.7-alt1 +- Initial build for ALT Linux Sisyphus diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..00865db --- /dev/null +++ b/.gear/rules @@ -0,0 +1,3 @@ +tar: v@version@:. +diff: v@version@:. . name=@name@-@version@-alt.patch +spec: .gear/needrestart.spec diff --git a/.gear/tags/4b5255b8bdd95d54650fa63aae13d18221cb5f36 b/.gear/tags/4b5255b8bdd95d54650fa63aae13d18221cb5f36 new file mode 100644 index 0000000..b18ef97 --- /dev/null +++ b/.gear/tags/4b5255b8bdd95d54650fa63aae13d18221cb5f36 @@ -0,0 +1,6 @@ +object 2c2e23a5d01df4cbcde6ab92d1ee39b5d4bca8e3 +type commit +tag v3.4 +tagger Thomas Liske 1549403007 +0100 + +Tag release 3.4. diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..0c25a3e --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1 @@ +4b5255b8bdd95d54650fa63aae13d18221cb5f36 v3.4 diff --git a/ex/needrestart.conf b/ex/needrestart.conf index 7d9dc4f..7503a8b 100644 --- a/ex/needrestart.conf +++ b/ex/needrestart.conf @@ -98,6 +98,7 @@ $nrconf{override_rc} = { # networking stuff qr(^bird) => 0, + qr(^networking) => 0, qr(^network-manager) => 0, qr(^NetworkManager) => 0, qr(^ModemManager) => 0, diff --git a/ex/notify.d/400-notify-send b/ex/notify.d/400-notify-send index d022126..4c79d3b 100755 --- a/ex/notify.d/400-notify-send +++ b/ex/notify.d/400-notify-send @@ -45,7 +45,7 @@ case "$NR_SESSION" in MSGBODY=$(gettext 'Your session is running obsolete binaries or libraries as listed below. Please consider a relogin or restart of the affected processes!')'\n'$(cat) - su -p -s /bin/sh -c "$NSEND -u critical -i dialog-warning \"$MSGTITLE\" \"$MSGBODY\"" "$NR_USERNAME" + su -s /bin/sh -c "$NSEND -u critical -i dialog-warning \"$MSGTITLE\" \"$MSGBODY\"" "$NR_USERNAME" ;; *) echo "[$0] skip session '$NR_SESSION'" 1>&2 diff --git a/ex/notify.d/600-mail b/ex/notify.d/600-mail index 17f1aac..7ab673e 100755 --- a/ex/notify.d/600-mail +++ b/ex/notify.d/600-mail @@ -15,9 +15,9 @@ # (at your option) any later version. # -# Use /usr/bin/mail to notify a user via e-mail. +# Use /bin/mail to notify a user via e-mail. -MAILX='/usr/bin/mail' +MAILX='/bin/mail' test -x "$MAILX" || exit 1 . /usr/lib/needrestart/notify.d.sh @@ -29,7 +29,7 @@ fi # Skip system users NR_USERID=`id -u "$NR_USERNAME"` -if [ "0$NR_USERID" -gt 0 -a "0$NR_USERID" -lt 1000 ]; then +if [ "0$NR_USERID" -gt 0 -a "0$NR_USERID" -lt 500 ]; then echo "[$0] do not notify system-user $NR_USERNAME via mail" 1>&2 exit 1 fi diff --git a/ex/restart.d/systemd-manager b/ex/restart.d/systemd-manager index 8f4a8a9..55cdfcc 100755 --- a/ex/restart.d/systemd-manager +++ b/ex/restart.d/systemd-manager @@ -20,4 +20,5 @@ if [ "$NR_VERBOSE" = '1' ]; then set -x fi -exec systemctl daemon-reexec +SYSTEMCTL= systemctl +exec $SYSTEMCTL daemon-reexec diff --git a/ex/restart.d/sysv-init b/ex/restart.d/sysv-init index 325f122..9d77af0 100755 --- a/ex/restart.d/sysv-init +++ b/ex/restart.d/sysv-init @@ -20,4 +20,5 @@ if [ "$NR_VERBOSE" = '1' ]; then set -x fi -exec telinit u +TELINIT=telinit +exec $TELINIT u diff --git a/lib/iucode-scan-versions b/lib/iucode-scan-versions index b76af86..6c1555f 100755 --- a/lib/iucode-scan-versions +++ b/lib/iucode-scan-versions @@ -37,7 +37,8 @@ else fi # early boot initrd (required at least on Arch Linux) -if type bsdtar > /dev/null 2>&1 ; then +BSDTAR=bsdtar +if type "$BSDTAR" > /dev/null 2>&1 ; then imgfiles="" for img in /boot/intel-ucode.img /boot/early_ucode.cpio ; do if [ -r "$img" ]; then @@ -46,15 +47,15 @@ if type bsdtar > /dev/null 2>&1 ; then done if [ -n "$imgfiles" ]; then - cat $imgfiles | bsdtar -Oxf /dev/stdin | iucode_tool -l $filter -tb - 2>&1 + cat $imgfiles | "$BSDTAR" -Oxf /dev/stdin | iucode_tool -l $filter -tb - 2>&1 exit $? fi fi # look for microcode updates in the filesystem IUCODE_TOOL_EXTRA_OPTIONS="" - -test -r /etc/default/intel-microcode && . /etc/default/intel-microcode +DEB_UCODE_CONF=/etc/default/intel-microcode +test -r "$DEB_UCODE_CONF" && . "$DEB_UCODE_CONF" # do not scan if adding Intel microcode to initrd is disabled test "$IUCODE_TOOL_INITRAMFS" = "no" && exit 0 diff --git a/man/needrestart.1 b/man/needrestart.1 index f755765..ae1addf 100644 --- a/man/needrestart.1 +++ b/man/needrestart.1 @@ -50,7 +50,7 @@ enable batch mode nagios plugin mode: makes output and exit codes nagios compatible .TP \fB\-f\fR -overwrite debconf(7) frontend, sets the DEBIAN_FRONT environment variable to +overwrite debconf(7) frontend, sets the DEBIAN_FRONTEND environment variable to .TP \fB\-u\fR use preferred UI package (-u ? shows available packages) diff --git a/perl/lib/NeedRestart/Interp/Perl.pm b/perl/lib/NeedRestart/Interp/Perl.pm index ed43c1a..aebf8e5 100644 --- a/perl/lib/NeedRestart/Interp/Perl.pm +++ b/perl/lib/NeedRestart/Interp/Perl.pm @@ -54,11 +54,18 @@ sub source { my $ptable = nr_ptable_pid($pid); unless($ptable->{cwd}) { print STDERR "$LOGPREF #$pid: could not get current working directory, skipping\n" if($self->{debug}); - return (); + return undef; } my $cwd = getcwd(); chdir("/proc/$pid/root/$ptable->{cwd}"); + # skip the process if the cwd is unreachable (i.e. due to mnt ns) + unless(getcwd()) { + chdir($cwd); + print STDERR "$LOGPREF #$pid: process cwd is unreachable\n" if($self->{debug}); + return undef; + } + # get original ARGV (my $bin, local @ARGV) = nr_parse_cmd($pid); @@ -108,6 +115,7 @@ sub files { # skip the process if the cwd is unreachable (i.e. due to mnt ns) unless(getcwd()) { + chdir($cwd); print STDERR "$LOGPREF #$pid: process cwd is unreachable\n" if($self->{debug}); return (); } diff --git a/perl/lib/NeedRestart/Interp/Python.pm b/perl/lib/NeedRestart/Interp/Python.pm index 4b8719c..c2b94da 100644 --- a/perl/lib/NeedRestart/Interp/Python.pm +++ b/perl/lib/NeedRestart/Interp/Python.pm @@ -85,11 +85,18 @@ sub source { my $ptable = nr_ptable_pid($pid); unless($ptable->{cwd}) { print STDERR "$LOGPREF #$pid: could not get current working directory, skipping\n" if($self->{debug}); - return (); + return undef; } my $cwd = getcwd(); chdir("/proc/$pid/root/$ptable->{cwd}"); + # skip the process if the cwd is unreachable (i.e. due to mnt ns) + unless(getcwd()) { + chdir($cwd); + print STDERR "$LOGPREF #$pid: process cwd is unreachable\n" if($self->{debug}); + return undef; + } + # get original ARGV (my $bin, local @ARGV) = nr_parse_cmd($pid); @@ -139,6 +146,7 @@ sub files { # skip the process if the cwd is unreachable (i.e. due to mnt ns) unless(getcwd()) { + chdir($cwd); print STDERR "$LOGPREF #$pid: process cwd is unreachable\n" if($self->{debug}); return (); } diff --git a/perl/lib/NeedRestart/Interp/Ruby.pm b/perl/lib/NeedRestart/Interp/Ruby.pm index 31cddee..ba48552 100644 --- a/perl/lib/NeedRestart/Interp/Ruby.pm +++ b/perl/lib/NeedRestart/Interp/Ruby.pm @@ -82,11 +82,18 @@ sub source { my $ptable = nr_ptable_pid($pid); unless($ptable->{cwd}) { print STDERR "$LOGPREF #$pid: could not get current working directory, skipping\n" if($self->{debug}); - return (); + return undef; } my $cwd = getcwd(); chdir("/proc/$pid/root/$ptable->{cwd}"); + # skip the process if the cwd is unreachable (i.e. due to mnt ns) + unless(getcwd()) { + chdir($cwd); + print STDERR "$LOGPREF #$pid: process cwd is unreachable\n" if($self->{debug}); + return undef; + } + # get original ARGV (my $bin, local @ARGV) = nr_parse_cmd($pid); @@ -136,6 +143,7 @@ sub files { # skip the process if the cwd is unreachable (i.e. due to mnt ns) unless(getcwd()) { + chdir($cwd); print STDERR "$LOGPREF #$pid: process cwd is unreachable\n" if($self->{debug}); return (); }