commit 8235852bbbe0ddb92818245bec64f1a6bba92df6 parent 64cf08cc0155f7451d2bbca71976b47288fbf4f9 Author: Jan Pobříslo <ccx@te2000.cz> Date: Sun, 18 Feb 2024 16:04:52 +0100 Check that paths get resolved correctly Diffstat:
M | command/pthbs-build | | | 13 | +++++++++++++ |
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/command/pthbs-build b/command/pthbs-build @@ -2,8 +2,21 @@ bsh=$(sha256sum $1) || exit $? bsh=${bsh%% *} basedir=$(dirname "$(dirname "$(realpath "$0")")") +if ! test -d "$basedir"; then + printf '%s\n' "Error: could not determine basedir" + exit 1 +fi +mkdir -p "$basedir/work/builddir.$$" || exit $? workdir=$(realpath "$basedir/work/builddir.$$") +if ! test -d "$workdir"; then + printf '%s\n' "Error: could not determine workdir" + exit 1 +fi script=$(realpath "$1") +if ! test -f "$script"; then + printf '%s\n' "Error: could not determine script path" + exit 1 +fi pthbs_package=${1##*/} pthbs_package=${pthbs_package%%:*}.$bsh