From b2582c4cebb4d310349f92793345e5f2e9ff5edd Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 11 Feb 2018 10:22:25 +0100 Subject: gen-perl-pkg: Detect target directory based on PWD Signed-off-by: Florian Pritz --- gen-perl-pkg | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gen-perl-pkg b/gen-perl-pkg index 59d76d3..1e34216 100755 --- a/gen-perl-pkg +++ b/gen-perl-pkg @@ -4,7 +4,7 @@ set -e for pkg in "$@"; do export MAINTAINER="Florian Pritz " targets=(~/arch/{community,extra}) - target_community=~/arch/community + target_new=~/arch/community found_pkg=0 genpkg "$pkg" @@ -17,7 +17,15 @@ for pkg in "$@"; do done if ((!found_pkg)); then + if [[ $PWD =~ ($HOME/arch/(community|extra)).* ]]; then + target_new="${BASH_REMATCH[1]}" + echo "Found target directory $target_new" + fi + + echo "Package not found, creating new in '$target_new/$pkg/trunk'" mkdir -p "$target/$pkg/"{trunk,repos} - cp "$HOME/pkg/dest/$pkg/PKGBUILD" "$target_community/$pkg/trunk/" + cp "$HOME/pkg/dest/$pkg/PKGBUILD" "$target_new/$pkg/trunk/" + cd "$target_new" + svn add "$pkg" fi done -- cgit v1.2.3-24-g4f1b