diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-02-11 10:22:25 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-02-11 10:22:25 +0100 |
commit | b2582c4cebb4d310349f92793345e5f2e9ff5edd (patch) | |
tree | 8c05aa6d03ce52cca1bd05bcb95fbb79fbd2a93b | |
parent | 53b07ce184591049190884e7ffc5d26aa069f7e3 (diff) | |
download | bin-b2582c4cebb4d310349f92793345e5f2e9ff5edd.tar.gz bin-b2582c4cebb4d310349f92793345e5f2e9ff5edd.tar.xz |
gen-perl-pkg: Detect target directory based on PWD
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | gen-perl-pkg | 12 |
1 files 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 <bluewind@xinu.at>" 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 |