diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/dnfu | 11 | 
1 files changed, 10 insertions, 1 deletions
| @@ -172,7 +172,16 @@ 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 +UPDNUM="$(sudo "${UCMD}" needs-restarting -C 2>/dev/null|grep -Pc '^[0-9]+[ ]+:')" +if echo "$UPDNUM"|grep -P '^[0-9]+$' >/dev/null;then +	case "$UPDNUM" in +		0) printf "No service requires reboot.\n";; +		1) printf "1 service requires reboot.\n";sudo "${UCMD}" needs-restarting -C 2>/dev/null|tee -a "$DLOG";; +		*) printf "%b services require reboot.\n" "$UPDNUM";sudo "${UCMD}" needs-restarting -C 2>/dev/null|tee -a "$DLOG";; +	esac +else +	printf "Error while fetching number of services requiring reboot.\n" >&2 +fi  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."||: | 
