git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-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"