summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEsteban Carnevale <alfplayer@mailoo.org>2014-12-16 12:27:13 -0300
committerEsteban Carnevale <alfplayer@mailoo.org>2014-12-16 16:45:06 -0300
commitdd0d8a097d4cd300016684469a61c6e8f01034aa (patch)
treecfa52696267fc3134ca8ea3190ac6513b6837f65
parent5b7ceaf5e670d9eda757ba452d35e8249befd59b (diff)
libredbdiff-standalone: Improve options, change for expac 4-2.parabola1 with expac version test
-rwxr-xr-xlibredbdiff-standalone23
1 files changed, 21 insertions, 2 deletions
diff --git a/libredbdiff-standalone b/libredbdiff-standalone
index 4ca81c0..25f7ebe 100755
--- a/libredbdiff-standalone
+++ b/libredbdiff-standalone
@@ -27,7 +27,7 @@ error() { echo -e "Error. $@" > /dev/stderr ; exit 1; }
if [[ $# == 1 ]] ; then
[[ $1 == -n ]] && UPDATE=0
- [[ $1 == -h ]] && { echo -e "${name}. Show [libre] packages that need to be updated from Arch repositories.\n\nUsage:\nlibredbdiff\t\tInitialize (first run) or update pacman databases\nlibredbdiff -n\t\tPrint results" ; exit 0 ; }
+ [[ $1 =~ ^(-h|--help)$ ]] && { echo -e "${name}. Show [libre] packages that need to be updated from Arch repositories.\n\nUsage:\nlibredbdiff\t\tInitialize (first run) or update pacman databases\nlibredbdiff -n\t\tPrint results" ; exit 0 ; }
elif [[ $# != 0 ]] ; then
error "Bad arguments. Nothing done."
else
@@ -118,6 +118,23 @@ fi
unset provides ver verarch
declare -Ax provides ver verarch
+expac_version_test() {
+if ! pkgname="$(pacman -Qoq expac)" ; then
+ echo "The command expac could not be found installed. The package pcr/expac-relative 4-2.parabola1 (or later) must be installed." >&2
+ exit 1
+ elif [[ $pkgname == expac-git ]] ; then
+ true
+ elif [[ $pkgname == expac-relative ]] ; then
+ if [[ $(vercmp "$(expac %v expac-relative)" 4-2.parabola1) != -1 ]] ; then
+ echo "The version of expac-relative installed on the system is lower than needed." >&2
+ exit 1
+ fi
+ else
+ echo "expac command must be provided by pcr/expac-relative version 4-2.parabola1 (or later). This package must be installed." >&2
+ exit 1
+ fi
+}
+
comparepkgs() {
if [[ ${verarch["$pkgname"]} ]] ; then
cmp=$(vercmp ${ver["$pkgname"]} ${verarch["$pkgname"]})
@@ -134,11 +151,13 @@ comparepkgs() {
fi
}
+expac_version_test
+
while read -a line ; do
verarch["${line[0]}"]="${line[1]}"
done < <(pacman --dbpath "${dbpatharch}" --config "${conffilearch}" -Ss | grep -v '^ ' | awk -F/ '{print $2}')
-expac -b "${dbpath}" -c "${conffile}" -Ss '%r/%n %v %S' | awk -F/ '$1 == "libre" {print $2}' | while read -a line ; do
+expac --config "${conffile}" -S '%r/%n %v %S' | awk -F/ '$1 == "libre" {print $2}' | while read -a line ; do
ver["${line[0]}"]="${line[1]}"
provides[${line[0]}]="${line[@]:2}"
pkgname=${line[0]}