index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | rebuildpkgs.in | 23 |
diff --git a/rebuildpkgs.in b/rebuildpkgs.in index 215439f..4f4f98b 100644 --- a/rebuildpkgs.in +++ b/rebuildpkgs.in @@ -14,18 +14,28 @@ m4_include(lib/common.sh) if (( $# < 1 )); then - echo "Usage: $(basename $0) <chrootdir> <packages to rebuild>" - echo " example: $(basename $0) ~/chroot readline bash foo bar baz" + printf 'Usage: %s <chrootdir> <packages to rebuild>\n' "$(basename "$0")" + printf ' example: %s ~/chroot readline bash foo bar baz\n' "$(basename "$0")" exit 1 fi # Source makepkg.conf; fail if it is not found if [[ -r '/etc/makepkg.conf' ]]; then + # shellcheck source=makepkg-x86_64.conf source '/etc/makepkg.conf' else die '/etc/makepkg.conf not found!' fi +# Source user-specific makepkg.conf overrides +if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then + # shellcheck source=/dev/null + source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" +elif [[ -r "$HOME/.makepkg.conf" ]]; then + # shellcheck source=/dev/null + source "$HOME/.makepkg.conf" +fi + bump_pkgrel() { # Get the current pkgrel from SVN and update the working copy with it # This prevents us from incrementing out of control :) @@ -33,9 +43,9 @@ bump_pkgrel() { oldrel=$(grep 'pkgrel=' $pbuild | cut -d= -f2) #remove decimals - rel=$(echo $oldrel | cut -d. -f1) + rel=${oldrel%%.*} - newrel=$(($rel + 1)) + newrel=$((rel + 1)) sed -i "s/pkgrel=$oldrel/pkgrel=$newrel/" PKGBUILD } @@ -43,11 +53,12 @@ bump_pkgrel() { pkg_from_pkgbuild() { # we want the sourcing to be done in a subshell so we don't pollute our current namespace export CARCH PKGEXT + # shellcheck source=PKGBUILD.proto (source PKGBUILD; echo "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT") } chrootdir="$1"; shift -pkgs="$@" +pkgs=("$@") SVNPATH='svn+ssh://repos.archlinux.org/srv/repos/svn-packages/svn' @@ -60,7 +71,7 @@ cd "$REBUILD_ROOT" /usr/bin/svn co -N $SVNPATH FAILED="" -for pkg in $pkgs; do +for pkg in "${pkgs[@]}"; do cd "$REBUILD_ROOT/svn-packages" msg2 "Building '%s'" "$pkg" |