index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | lolilolicon <lolilolicon@gmail.com> | 2011-10-06 14:14:46 +0800 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-10-06 02:10:25 -0500 |
commit | 22abe27bfa4f4e6c3ce3dfc345bb45a1f0666ab8 (patch) | |
tree | f78a3b5281058bf9e3a49f2b2a0be928a02ecb62 /contrib/bacman.in | |
parent | 4928f9edc371a4e4f90f329c9908f00cdbfe5bfb (diff) |
-rwxr-xr-x | contrib/bacman.in | 14 |
diff --git a/contrib/bacman.in b/contrib/bacman.in index adc2cb36..96360911 100755 --- a/contrib/bacman.in +++ b/contrib/bacman.in @@ -93,8 +93,8 @@ pkg_dest="${PKGDEST:-$PWD}" pkg_pkger=${PACKAGER:-'Unknown Packager'} pkg_name="$1" -pkg_dir="$(echo $pac_db/$pkg_name-[0-9]*)" -pkg_namver="${pkg_dir##*/}" +pkg_dir=("$pac_db/$pkg_name"-+([^-])-+([0-9])) +pkg_namver=("${pkg_dir[@]##*/}") # # Checks everything is in place @@ -104,8 +104,16 @@ if [[ ! -d $pac_db ]]; then exit 1 fi +if (( ${#pkg_dir[@]} != 1 )); then + printf "ERROR: %d entries for package %s found in pacman database\n" \ + ${#pkg_dir[@]} "${pkg_name}" + printf "%s\n" "${pkg_dir[@]}" + exit 1 +fi + if [[ ! -d $pkg_dir ]]; then - echo "ERROR: package ${pkg_name} not found in pacman database" + printf "ERROR: package %s is found in pacman database,\n" "${pkg_name}" + printf " but \`%s' is not a directory\n" "${pkg_dir}" exit 1 fi |