git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormail_redacted_for_web 2020-08-20 08:17:44 +0200
committermail_redacted_for_web 2020-08-20 08:17:44 +0200
commit3500a1c3aba0bec16dff4693e69d24a5e647af1f (patch)
tree4e82d5d0448afa5f63d38de94e7efee13ee16b25
parent62657cca461803604a18ea549c920a073fd10691 (diff)
downloadrhel-scripts-master.tar.bz2
Changing time stamp to a more reliable value via bin/tsHEADmaster
-rwxr-xr-xbin/dnfu11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/dnfu b/bin/dnfu
index 0c15bd2..02921cd 100755
--- a/bin/dnfu
+++ b/bin/dnfu
@@ -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"