mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-12-24 16:10:05 -07:00
kiss: more cleanup
This commit is contained in:
parent
3f76c1ee0a
commit
8443fc4ab9
131
kiss
131
kiss
@ -692,6 +692,36 @@ pkg_checksums() {
|
|||||||
done < "$repo_dir/sources" || die "$1" "Failed to generate checksums"
|
done < "$repo_dir/sources" || die "$1" "Failed to generate checksums"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkg_checksums_save() {
|
||||||
|
# Generate and save checksums to file.
|
||||||
|
pkg_find "$pkg"
|
||||||
|
|
||||||
|
[ -f "$repo_dir/sources" ] ||
|
||||||
|
continue
|
||||||
|
|
||||||
|
sums=$(pkg_checksums "$pkg")
|
||||||
|
|
||||||
|
[ "$sums" ] || {
|
||||||
|
log "$pkg" "Nothing to do"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
# False positive ('>> file' with no command).
|
||||||
|
# shellcheck disable=2188
|
||||||
|
printf '%s\n' "$sums" |
|
||||||
|
|
||||||
|
if 2>/dev/null >> "$repo_dir/checksums"; then
|
||||||
|
tee "$repo_dir/checksums"
|
||||||
|
|
||||||
|
else
|
||||||
|
log "$pkg" "Need permissions to generate checksums"
|
||||||
|
file_owner "$repo_dir"
|
||||||
|
as_root tee "$repo_dir/checksums"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "$pkg" "Generated checksums"
|
||||||
|
}
|
||||||
|
|
||||||
pkg_verify() {
|
pkg_verify() {
|
||||||
# Verify all package checksums. This is achieved by generating a new set
|
# Verify all package checksums. This is achieved by generating a new set
|
||||||
# of checksums and then comparing those with the old set.
|
# of checksums and then comparing those with the old set.
|
||||||
@ -1297,56 +1327,52 @@ args() {
|
|||||||
# once you memorize the commands.
|
# once you memorize the commands.
|
||||||
case $action in
|
case $action in
|
||||||
a|alternatives)
|
a|alternatives)
|
||||||
if [ "$1" = - ]; then
|
case $1 in
|
||||||
while read -r pkg path; do
|
-)
|
||||||
pkg_swap "$pkg" "$path"
|
while read -r pkg path; do
|
||||||
done
|
pkg_swap "$pkg" "$path"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
|
||||||
elif [ "$1" ]; then
|
'')
|
||||||
pkg_swap "$@"
|
set +f
|
||||||
|
|
||||||
else
|
# Go over each alternative and format the file
|
||||||
# Go over each alternative and format the file
|
# name for listing. (pkg_name>usr>bin>ls)
|
||||||
# name for listing. (pkg_name>usr>bin>ls)
|
for pkg in "$sys_db/../choices"/*; do
|
||||||
set +f; for pkg in "$sys_db/../choices"/*; do
|
printf '%s\n' "${pkg##*/}"
|
||||||
printf '%s\n' "${pkg##*/}"
|
done |
|
||||||
done | sed 's|>| /|; s|>|/|g; /\*/d'
|
|
||||||
fi
|
sed 's|>| /|; s|>|/|g; /\*/d'
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
pkg_swap "$@"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
|
b|build)
|
||||||
|
pkg_build "${@:?No packages installed}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
c|checksum)
|
c|checksum)
|
||||||
for pkg do pkg_lint "$pkg"; done
|
|
||||||
for pkg do pkg_sources "$pkg" c; done
|
|
||||||
for pkg do
|
for pkg do
|
||||||
pkg_find "$pkg"
|
pkg_lint "$pkg"
|
||||||
|
done
|
||||||
|
|
||||||
[ -f "$repo_dir/sources" ] || {
|
for pkg do
|
||||||
log "$pkg" "No sources file, skipping checksums"
|
pkg_sources "$pkg"
|
||||||
continue
|
done
|
||||||
}
|
|
||||||
|
|
||||||
sums=$(pkg_checksums "$pkg")
|
for pkg do
|
||||||
|
pkg_checksums_save "$pkg"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
|
||||||
[ "$sums" ] || {
|
d|download)
|
||||||
log "$pkg" "No sources needing checksums"
|
for pkg do
|
||||||
continue
|
pkg_sources "$pkg"
|
||||||
}
|
|
||||||
|
|
||||||
# False positive ('>> file' with no command).
|
|
||||||
# shellcheck disable=2188
|
|
||||||
printf '%s\n' "$sums" |
|
|
||||||
|
|
||||||
if 2>/dev/null >> "$repo_dir/checksums"; then
|
|
||||||
tee "$repo_dir/checksums"
|
|
||||||
|
|
||||||
else
|
|
||||||
log "$pkg" "Need permissions to generate checksums"
|
|
||||||
file_owner "$repo_dir"
|
|
||||||
|
|
||||||
user=$user as_root tee "$repo_dir/checksums"
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "$pkg" "Generated checksums"
|
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -1356,18 +1382,29 @@ args() {
|
|||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
l|list)
|
||||||
|
pkg_list "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
r|remove)
|
r|remove)
|
||||||
for pkg do
|
for pkg do
|
||||||
pkg_remove "$pkg"
|
pkg_remove "$pkg"
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
b|build) pkg_build "${@:?No packages installed}" ;;
|
s|search)
|
||||||
d|download) for pkg do pkg_sources "$pkg"; done ;;
|
for pkg do
|
||||||
l|list) pkg_list "$@" ;;
|
pkg_find "$pkg" all
|
||||||
u|update) pkg_updates ;;
|
done
|
||||||
s|search) for pkg do pkg_find "$pkg" all; done ;;
|
;;
|
||||||
v|version) printf '5.1.0\n' ;;
|
|
||||||
|
u|update)
|
||||||
|
pkg_updates
|
||||||
|
;;
|
||||||
|
|
||||||
|
v|version)
|
||||||
|
printf '5.1.0\n'
|
||||||
|
;;
|
||||||
|
|
||||||
'')
|
'')
|
||||||
log 'kiss [a|b|c|d|i|l|r|s|u|v] [pkg]...'
|
log 'kiss [a|b|c|d|i|l|r|s|u|v] [pkg]...'
|
||||||
|
Loading…
Reference in New Issue
Block a user