aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2019-09-09 08:17:58 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2019-09-09 08:17:58 +0000
commit18bcfe6dc7105bde286d1bce07747fc4e096aa97 (patch)
treea9da89cddd50ae4f580c926bc27787232b8f7757 /kiss
parent4c7227d548f5e447d41e7714547981f1477a4eea (diff)
downloadcpt-18bcfe6dc7105bde286d1bce07747fc4e096aa97.tar.gz
pkg_list: simplify
FossilOrigin-Name: 614d948d46dde98c0b06d4be39d6336d6d8dc0141cf666a624878ad7c8f1c849
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss15
1 files changed, 5 insertions, 10 deletions
diff --git a/kiss b/kiss
index 776d826..e3bed40 100755
--- a/kiss
+++ b/kiss
@@ -95,20 +95,15 @@ pkg_list() {
# packages installed.
[ "$1" = "$KISS_ROOT/$pkg_db/"\* ] && return 1
- # Loop over each version file and warn if one doesn't exist.
- # Also warn if a package is missing its version file.
+ # Loop over each package and print its name and version.
for pkg; do
- if [ ! -d "$pkg" ]; then
+ [ -d "$pkg" ] || {
log "Package '$pkg' is not installed"
return 1
+ }
- elif [ ! -f "$pkg/version" ]; then
- log "[$pkg] Warning, package has no version file"
- continue
- fi
-
- read -r version release < "$pkg/version" &&
- printf '%s\n' "$pkg $version-$release"
+ read -r 2>/dev/null < "$pkg/version" || REPLY=null
+ printf '%s\n' "$pkg $REPLY"
done
}