summaryrefslogtreecommitdiff
path: root/src/is_built
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-06-08 13:08:29 -0600
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-06-08 13:08:29 -0600
commit18b74bdc32406fbe4b79c5efc0f1814683ba2b9a (patch)
treece88cf8add0c9e5648016ee7a10fb2ee65980d5a /src/is_built
parent0d4d85ac0b1a2a1e2d5ed03d43f8b3b5d728ca3a (diff)
is_built: make the version optional
Diffstat (limited to 'src/is_built')
-rwxr-xr-xsrc/is_built6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/is_built b/src/is_built
index e6797fd..a1da507 100755
--- a/src/is_built
+++ b/src/is_built
@@ -2,7 +2,7 @@
cmd=${0##*/}
usage() {
- echo "Usage: $cmd [-h] pkgname pkgver"
+ echo "Usage: $cmd [-h] pkgname [pkgver]"
echo
echo "Detect if a given package version is already in repos"
echo "Assuming you want greater or equal."
@@ -21,13 +21,13 @@ while getopts 'h' arg; do
*) usage >&2; exit 2 ;;
esac
done
-if [[ $# != 2 ]]; then
+if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then
usage >&2
exit 2
fi
pkg=${1}
-ver=${2}
+ver=${2:-0}
pver=$(LC_ALL=C pacman -Sddp --print-format '%v' "${pkg}" 2>/dev/null)
# if pacman fails or returns nothing