From bce94c9f77eebe4fc9bb0b58afe04f5c276532de Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Mon, 1 Jun 2020 09:31:51 +0200 Subject: condensed reboot summary, reboot summary in any case, updated sudoers --- bin/dnfu | 9 +++++---- etc/sudoers.d/maint | 8 ++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/dnfu b/bin/dnfu index 966285e..175be76 100755 --- a/bin/dnfu +++ b/bin/dnfu @@ -129,9 +129,6 @@ function supgrade { ;; esac unset UFIN USTART - printf "Checking for outdated running services or necessity to reboot...:\n" - sudo "${UCMD}" needs-restarting -C --color true 2>&1|tee -a "$DLOG" - sudo "$UCMD" needs-restarting -r >/dev/null 2>&1 ||$LWCMD "Reboot required."||: } function snrefresh { rbeg "Refreshing snapd snaps" @@ -174,8 +171,12 @@ esac if [ "$UPDAVAIL" -eq 0 ];then supgrade fi +#printf "Checking for outdated running services or necessity to reboot...:\n" +sudo "${UCMD}" needs-restarting -C 2>/dev/null|grep -P '^[0-9]+[ ]+:'|wc -l +sudo "${UCMD}" needs-restarting -C -r --color true 2>&1|tee -a "$DLOG" +sudo "${UCMD}" needs-restarting -r >/dev/null 2>&1 ||$LWCMD "Reboot required."||: -if [ ! -z "$SCMD" ];then +if [ -e "$SCMD" ];then snrefresh fi $LCMD "Detailed logfile is located at $DLOG." diff --git a/etc/sudoers.d/maint b/etc/sudoers.d/maint index d02225f..647cc64 100644 --- a/etc/sudoers.d/maint +++ b/etc/sudoers.d/maint @@ -1,5 +1,9 @@ -%maint ALL=(ALL) NOPASSWD:/usr/bin/snap refresh, /usr/bin/needs-restarting, /usr/bin/dnf needs-restarting +%maint ALL=(ALL) NOPASSWD:/usr/bin/dnf --refresh -y upgrade --color true, /usr/bin/dnf makecache, /usr/bin/dnf check-update +%maint ALL=(ALL) NOPASSWD:/usr/bin/dnf check-upgrade, /usr/bin/snap refresh, /usr/bin/needs-restarting, /usr/bin/dnf needs-restarting -C --color true,/usr/bin/dnf needs-restarting -r # Using -C -q instead of -Cq because yum sucks at this. dnf can cope with it, but in case of # moving forth to a yum-only system... %maint ALL=(ALL) NOPASSWD:/usr/bin/dnf -q makecache,/usr/bin/dnf -C -q check-upgrade -%maint ALL=(ALL) NOPASSWD:/usr/bin/dnf -q -y upgrade +%maint ALL=(ALL) NOPASSWD:/usr/bin/dnf makecache,/usr/bin/dnf -C check-upgrade +%maint ALL=(ALL) NOPASSWD:/usr/bin/dnf -q -y upgrade,/usr/bin/dnf -y upgrade +%maint ALL=(ALL) NOPASSWD:/usr/sbin/shutdown -P +1,/usr/sbin/poweroff,/usr/sbin/reboot +%maint ALL=(ALL) NOPASSWD:/usr/bin/dnf needs-restarting -C -r --color true, /usr/bin/dnf needs-restarting -C -- cgit v1.2.3