commit ea8067a3c923436e63e4a36ba7fdb530d0c681de parent 3f7281e7bb5019fc84a7a671cbe13d5d86d2f611 Author: Jan Pobrislo <ccx@te2000.cz> Date: Fri, 10 Jan 2025 01:29:48 +0000 Remove dependency on GNU cp Diffstat:
| A | command/pthbs-copy-to-logdir | | | 16 | ++++++++++++++++ |
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/command/pthbs-copy-to-logdir b/command/pthbs-copy-to-logdir @@ -0,0 +1,16 @@ +#!/bin/sh -e +if test -n "$pthbs_xtrace"; then + set -x + if test -n "$BB_ASH_VERSION"; then PS4="+${0##*/}"':${FUNCNAME}:${LINENO} '; fi +fi +dstdir=${1%/} + +if ! test -d "$dstdir"; then + printf '%s\n' "$0: Error: invalid destination directory" + exit 1 +fi + +for srcfile in "$@"; do + dstfile=$(s6-uniquename "$dstdir/$(basename "$srcfile")") + cp -v - "$srcfile" "$dstfile" || exit $? +done