#!/bin/bash set -e for pkg in "$@"; do export MAINTAINER="Florian Pritz " targets=(~/arch/pkgs) target_new=~/arch/pkgs found_pkg=0 genpkg "$pkg" for target in "${targets[@]}"; do if [[ -f "$target/$pkg/PKGBUILD" ]]; then found_pkg=1 vimdiff "$target/$pkg/PKGBUILD" "$HOME/pkg/dest/$pkg/PKGBUILD" fi done if ((!found_pkg)); then if [[ $PWD =~ ($HOME/arch/pkgs).* ]]; then target_new="${BASH_REMATCH[1]}" echo "Found target directory $target_new" fi echo "Package not found, creating new in '$target_new/$pkg/'" cp "$HOME/pkg/dest/$pkg/PKGBUILD" "$target_new/$pkg/" cd "$target_new" git add "$pkg" fi done