forked from kiss-community/kiss
pkg_list: simplify
This commit is contained in:
parent
b8995c56b5
commit
2d68981ca3
15
kiss
15
kiss
@ -95,20 +95,15 @@ pkg_list() {
|
|||||||
# packages installed.
|
# packages installed.
|
||||||
[ "$1" = "$KISS_ROOT/$pkg_db/"\* ] && return 1
|
[ "$1" = "$KISS_ROOT/$pkg_db/"\* ] && return 1
|
||||||
|
|
||||||
# Loop over each version file and warn if one doesn't exist.
|
# Loop over each package and print its name and version.
|
||||||
# Also warn if a package is missing its version file.
|
|
||||||
for pkg; do
|
for pkg; do
|
||||||
if [ ! -d "$pkg" ]; then
|
[ -d "$pkg" ] || {
|
||||||
log "Package '$pkg' is not installed"
|
log "Package '$pkg' is not installed"
|
||||||
return 1
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
elif [ ! -f "$pkg/version" ]; then
|
read -r 2>/dev/null < "$pkg/version" || REPLY=null
|
||||||
log "[$pkg] Warning, package has no version file"
|
printf '%s\n' "$pkg $REPLY"
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
read -r version release < "$pkg/version" &&
|
|
||||||
printf '%s\n' "$pkg $version-$release"
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user