From e0263e3c1875391f8a86a31fee78c96d0e5505eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D1=80=D0=B0=D1=85=D0=B8=D1=9A=D0=B0=20=D0=A0?= =?UTF-8?q?=D0=B0=D0=B4=D0=B8=D1=9B?= Date: Fri, 20 Oct 2023 17:32:35 +0200 Subject: [PATCH] Simplify build scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Страхиња Радић --- date.do | 16 ++++++++-------- version.do | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/date.do b/date.do index d4db4ac..fdbf049 100644 --- a/date.do +++ b/date.do @@ -1,20 +1,20 @@ FALLBACKDATE=${FALLBACKDATE:-unknown} +LC_ALL=C +export LC_ALL user=$(unalias ls >/dev/null 2>&1 || true; \ - LC_ALL=C command ls -nd . | LC_ALL=C awk '{print $3}') -e_user=$(id -u) -user_s=$(LC_ALL=C awk 'BEGIN{FS=":"}{if ($3=="'$user'") { print $1}}' \ - /dev/null 2>&1; then if [ "$e_user" = "$user" ]; then - env LC_ALL=C git log --format=format:%cd \ + git log --format=format:%cd \ --date=format:"%B %d, %Y" -1 @ >$3 else - su "${user_s}" -c 'env LC_ALL=C git log --format=format:%cd '\ -'--date=format:"%B %d, %Y" -1 @' >$3 + su "${user}" -c 'env LC_ALL=C git log --format=format:%cd \ + --date=format:"%B %d, %Y" -1 @' >$3 fi echo >>$3 else - echo $FALLBACKDATE >$3 + printf "%s\n" "$FALLBACKDATE" >$3 fi redo-always redo-stamp <$3 diff --git a/version.do b/version.do index 7d2698d..fcf950f 100644 --- a/version.do +++ b/version.do @@ -1,17 +1,17 @@ FALLBACKVER=${FALLBACKVER:-unknown} +LC_ALL=C +export LC_ALL user=$(unalias ls >/dev/null 2>&1 || true; \ - LC_ALL=C command ls -nd . | LC_ALL=C awk '{print $3}') -e_user=$(id -u) -user_s=$(LC_ALL=C awk 'BEGIN{FS=":"}{if ($3=="'$user'") { print $1}}' \ - /dev/null 2>&1; then if [ "$e_user" = "$user" ]; then git describe 2>/dev/null | sed 's/^v//' >$3 else - su "${user_s}" -c 'git describe' 2>/dev/null | sed 's/^v//' >$3 + su "${user}" -c 'git describe' 2>/dev/null | sed 's/^v//' >$3 fi else - echo $FALLBACKVER >$3 + printf "%s\n" "$FALLBACKVER" >$3 fi redo-always redo-stamp <$3 -- 2.45.2