summaryrefslogtreecommitdiff
path: root/is_built
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernández <josht@stravy.(none)>2011-04-14 23:14:37 -0500
committerJoshua Ismael Haase Hernández <josht@stravy.(none)>2011-04-14 23:14:37 -0500
commit01f55a1a7e979ab38e6d6d5b169507ab34f73ddb (patch)
treefa9cf5da2e5ed0df72dfbe603e90b885b050d07d /is_built
parent4a585ee091e98d980c7f2ae8cc3e507dd4ee1a18 (diff)
parent47970ad081939c1024a2a9358e647ed2358f6de6 (diff)
Merge branch 'master' of vparabola:~/projects/libretoolsv20110416
Diffstat (limited to 'is_built')
-rwxr-xr-xis_built9
1 files changed, 7 insertions, 2 deletions
diff --git a/is_built b/is_built
index 9dc5d1c..f789e4f 100755
--- a/is_built
+++ b/is_built
@@ -1,7 +1,12 @@
#!/bin/bash
# Detect is a package is installed or in a database
-pacman -Qqi $1 >/dev/null 2>&1 || \
-pacman -Sqi $1 >/dev/null 2>&1
+# Checks for package, if -T returns non-zero output, egrep will return 0
+# because it finds it, so we negate the value to say it's not built.
+# -Sp works backwards, it will print output only when the package already
+# exists
+# Example usage: is_built "pcre>=20"
+!(sudo pacman -T "$1" | egrep "*" >/dev/null) || \
+sudo pacman -Sp "$1" --print-format "%n-%v" 2>/dev/null | egrep "*" >/dev/null
exit $?