kiss: Fix pkg_conflicts

This commit is contained in:
Dylan Araps 2019-06-18 11:01:06 +03:00
parent e73a8b728d
commit 560ac9ada1
1 changed files with 9 additions and 8 deletions

17
kiss
View File

@ -125,8 +125,11 @@ pkg_strip() {
} }
pkg_manifest() { pkg_manifest() {
(cd "$pkg_dir" && find ./*) | sed -e ss.ss -e '1!G;h;$!d' | # Store the file and directory list of the package.
tee manifest > "$pkg_db/$name/manifest" # 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() { pkg_tar() {
@ -139,9 +142,9 @@ pkg_conflicts() {
# Extract manifest from tarball and strip directories. # Extract manifest from tarball and strip directories.
tar xf "$bin_dir/$pkg" "./var/db/$kiss/$name/manifest" -O | tar xf "$bin_dir/$pkg" "./var/db/$kiss/$name/manifest" -O |
while read -r line; do while read -r line; do
[ -f "$line" ] && printf '%s\n' "$line" >> "$cac_dir/manifest" [ "${line%%*/}" ] && printf '%s\n' "$line" >> "$cac_dir/manifest"
done done
# Compare extracted manifest to all installed manifests. # Compare extracted manifest to all installed manifests.
# If there are matching lines (files) there's a package # If there are matching lines (files) there's a package
@ -152,8 +155,6 @@ pkg_conflicts() {
grep -Fxf "$cac_dir/manifest" "$db/manifest" && grep -Fxf "$cac_dir/manifest" "$db/manifest" &&
die "Package '$name' conflicts with '${db##*/}'." die "Package '$name' conflicts with '${db##*/}'."
done done
rm "$cac_dir/manifest"
} }
pkg_install() { pkg_install() {
@ -261,7 +262,7 @@ args() {
} }
main() { main() {
trap 'rm -rf -- "$mak_dir" "$pkg_dir"' EXIT INT trap 'rm -rf -- "$mak_dir" "$pkg_dir" "$cac_dir/manifest"' EXIT INT
kiss=${0##*/} kiss=${0##*/}
[ -z "$KISS_PATH" ] && [ -z "$KISS_PATH" ] &&