aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss23
1 files changed, 14 insertions, 9 deletions
diff --git a/kiss b/kiss
index 7ab5e01..5f3e440 100755
--- a/kiss
+++ b/kiss
@@ -18,6 +18,10 @@ source_type() {
[ -z "${1##*://*}" ] && return 5 # Remote file.
}
+pkg_clean() {
+ rm -rf -- "$mak_dir" "$pkg_dir" "$cac_dir/manifest" "$cac_dir/tar"
+}
+
pkg_search() {
set -f
# shellcheck disable=2086,2046
@@ -125,8 +129,11 @@ pkg_strip() {
}
pkg_manifest() {
- (cd "$pkg_dir" && find ./*) | sed -e ss.ss -e '1!G;h;$!d' |
- tee manifest > "$pkg_db/$name/manifest"
+ # Store the file and directory list of the package.
+ # Directories have a trailing '/' and the list is sorted in reverse.
+ (cd "$pkg_dir" && {
+ find ./* -type d -print | sed 's!$!/!'; find . \! -type d
+ }) | sort -r | sed -e ss.ss | tee manifest > "$pkg_db/$name/manifest"
}
pkg_tar() {
@@ -139,9 +146,9 @@ pkg_conflicts() {
# Extract manifest from tarball and strip directories.
tar xf "$bin_dir/$pkg" "./var/db/$kiss/$name/manifest" -O |
- while read -r line; do
- [ -f "$line" ] && printf '%s\n' "$line" >> "$cac_dir/manifest"
- done
+ while read -r line; do
+ [ "${line%%*/}" ] && printf '%s\n' "$line" >> "$cac_dir/manifest"
+ done
# Compare extracted manifest to all installed manifests.
# If there are matching lines (files) there's a package
@@ -152,8 +159,6 @@ pkg_conflicts() {
grep -Fxf "$cac_dir/manifest" "$db/manifest" &&
die "Package '$name' conflicts with '${db##*/}'."
done
-
- rm "$cac_dir/manifest"
}
pkg_install() {
@@ -167,7 +172,7 @@ pkg_install() {
log "Removing previous version of package if it exists."
pkg_remove "$name"
-
+
"$cac_dir/tar" kpxf "$bin_dir/$pkg" -C "$sys_dir/"
"$sys_db/$name/post-install" 2>/dev/null
@@ -259,7 +264,7 @@ args() {
}
main() {
- trap 'rm -rf -- "$mak_dir" "$pkg_dir" "$cac_dir/tar"' EXIT INT
+ trap pkg_clean EXIT INT
kiss=${0##*/}
[ -z "$KISS_PATH" ] &&