diff options
author | mail_redacted_for_web | 2020-08-20 08:17:44 +0200 |
---|---|---|
committer | mail_redacted_for_web | 2020-08-20 08:17:44 +0200 |
commit | 3500a1c3aba0bec16dff4693e69d24a5e647af1f (patch) | |
tree | 4e82d5d0448afa5f63d38de94e7efee13ee16b25 /bin | |
parent | 62657cca461803604a18ea549c920a073fd10691 (diff) | |
download | rhel-scripts-master.tar.bz2 |
Diffstat (limited to 'bin')
-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" |