diff options
Diffstat (limited to 'bin/dnfu')
-rwxr-xr-x | bin/dnfu | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -39,6 +39,9 @@ SCMD="$(command -v snap 2>/dev/null)" UCMD="$(command -v dnf 2>/dev/null)" [ "$?" -ne 0 ]&&UCMD="$(command -v yum 2>/dev/null)" [ -z "$UCMD" ]&&printf "Neither yum nor dnf found!\n" >&2&&exit 1 +TSCMD="$(command -v ts||echo '/usr/bin/ts')" +[ ! -x "$TSCMD" ]&&printf "%b not executable, please install moreutils." "$TSCMD" >&2&&exit 1 +TSPARMS=( '[%Y-%m-%d %H:%M:%S]' ) RETVAL=0 function radd { @@ -99,7 +102,7 @@ function supgrade { #esac USTART="$(date +%s)" rbeg "Upgrading system packages" - sudo "${UCMD}" -y upgrade 2>&1|sed "s/^/$(date --rfc-3339=seconds) /">>"$DLOG" + sudo "${UCMD}" -y upgrade 2>&1|"${TSCMD}" "${TSPARMS[@]}">>"$DLOG" case "${PIPESTATUS[0]}" in 0) @@ -132,7 +135,7 @@ function supgrade { } function snrefresh { rbeg "Refreshing snapd snaps" - sudo "${SCMD}" refresh 2>&1|sed "s/^/$(date --rfc-3339=seconds) /">>$DLOG + sudo "${SCMD}" refresh 2>&1|"${TSCMD}" "${TSPARMS[@]}">>$DLOG case "${PIPESTATUS[0]}" in 0) $LCMD "Snaps refreshed.";rok;; *) $LECMD "Error on refreshing snaps.";rerr;RETVAL=1;return 1;; @@ -141,7 +144,7 @@ function snrefresh { CSTART="$(date +%s)" rbeg "Updating dnf cache" -sudo "${UCMD}" makecache 2>&1|sed "s/^/$(date --rfc-3339=seconds) /" >> "$DLOG" +sudo "${UCMD}" makecache 2>&1|"${TSCMD}" "${TSPARMS[@]}">> "$DLOG" case "${PIPESTATUS[0]}" in 0) CFIN="$(date +%s)" @@ -155,7 +158,7 @@ case "${PIPESTATUS[0]}" in esac unset CFIN CSTART rbeg "Checking for upgrades" -sudo "${UCMD}" -C check-upgrade 2>&1|sed "s/^/$(date --rfc-3339=seconds) /">>"$DLOG" +sudo "${UCMD}" -C check-upgrade 2>&1|"${TSCMD}" "${TSPARMS[@]}">>"$DLOG" case "${PIPESTATUS[0]}" in 0) $LCMD "No updates found.";rinf "No updates" |