ste

Једноставни уређивач табела
git clone https://git.sr.ht/~strahinja/ste
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување a90bfce85bbf46a9b5ff81ef8ad75eb4e7cf574f
родитељ f32bd0bf3211727e91faa24741d95607a8531056
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Thu,  5 Feb 2026 20:20:28 +0100

lib: Synchronize build scripts with other projects; update copyright year

Diffstat:
Mlib/makedate | 20+++++++++++++++++++-
Mlib/makeversion | 20+++++++++++++++++++-
Mlib/runtests | 2+-
измењених датотека: 3, додавања: 39(+), брисања: 3(-)

diff --git a/lib/makedate b/lib/makedate @@ -4,6 +4,24 @@ FALLBACKDATE=${FALLBACKDATE:-unknown} LC_ALL=C export LC_ALL +getent() +{ + if command -v getent >/dev/null 2>&1; then + command getent "$@" + return + fi + case "$1" in + passwd|group) + if [ -z "$2" ]; then + cat /etc/"$1" + else + awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1" + fi + ;; + *) ;; + esac +} + if [ -d .got ] && command -v got >/dev/null 2>&1; then got log | awk ' @@ -27,7 +45,7 @@ if [ -d .got ] && command -v got >/dev/null 2>&1; then }' >date.new elif [ -d .git ] && command -v git >/dev/null 2>&1; then user=$(getent passwd "$(unalias ls >/dev/null 2>&1 || true; \ - command ls -lnd . | awk '{print $3}')" | awk -F: '{print $1}') + command ls -nd . | awk '{print $3}')" | awk -F: '{print $1}') if [ -z "$user" ]; then printf "$0: error: Cannot determine owner of %s" "$(pwd)" >&2 exit 1 diff --git a/lib/makeversion b/lib/makeversion @@ -2,6 +2,24 @@ # vim: set ft=bash: FALLBACKVER=${FALLBACKVER:-unknown} +getent() +{ + if command -v getent >/dev/null 2>&1; then + command getent "$@" + return + fi + case "$1" in + passwd|group) + if [ -z "$2" ]; then + cat /etc/"$1" + else + awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1" + fi + ;; + *) ;; + esac +} + if [ -d .got ] && command -v got >/dev/null 2>&1; then lastcommit=$(got log | awk '/^commit/ {print substr($2,1,7); exit}') @@ -34,7 +52,7 @@ elif [ -d .git ] && command -v git >/dev/null 2>&1; then LC_ALL=C export LC_ALL user=$(getent passwd "$(unalias ls >/dev/null 2>&1 || true; \ - command ls -lnd . | awk '{print $3}')" | awk -F: '{print $1}') + command ls -nd . | awk '{print $3}')" | awk -F: '{print $1}') if [ -z "$user" ]; then printf "$0: error: Cannot determine owner of %s" "$(pwd)" >&2 exit 1 diff --git a/lib/runtests b/lib/runtests @@ -1,6 +1,6 @@ #!/usr/bin/perl # This program is licensed under the terms of GNU GPL v3 or (at your option) -# any later version. Copyright (C) 2022-2025 Страхиња Радић. +# any later version. Copyright (C) 2022-2026 Страхиња Радић. # See the file LICENSE for exact copyright and license details.