aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-06 05:49:51 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-06 05:49:51 +0000
commite7b5e42cf936eb02e2dfa3945cb1fb5434cb88fa (patch)
tree1ee1d51e98106435d59d3f5db289147b3737818c /kiss
parentc656d360f89712d01839b286f0c72d2aea977f58 (diff)
downloadcpt-e7b5e42cf936eb02e2dfa3945cb1fb5434cb88fa.tar.gz
kiss: fix pkg conflicts
FossilOrigin-Name: 920cdccc7d5467132d15f5400ad4e9f1d5f04420a2d728fae752ca2286656bb7
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss38
1 files changed, 26 insertions, 12 deletions
diff --git a/kiss b/kiss
index ec14684..0624c0b 100755
--- a/kiss
+++ b/kiss
@@ -574,8 +574,6 @@ pkg_conflicts() {
# Check to see if a package conflicts with another.
log "$2" "Checking for package conflicts"
- set +ef
-
# Filter the tarball's manifest and select only files
# and any files they resolve to on the filesystem \
# (/bin/ls -> /usr/bin/ls).
@@ -584,20 +582,36 @@ pkg_conflicts() {
printf '%s\n' "$file"
- (cd "$KISS_ROOT/" && readlink -f "./$file") ||:
- done |
+ readlink -f "$KISS_ROOT/$file" ||:
+ done > "$cac_dir/$pid-m"
+
+ p_name=$2
+
+ # Generate a list of all installed package manifests.
+ set +ef
+ set -f -- "$sys_db"/*/manifest
+
+ # Filter the manifest list and remove the previously
+ # installed version of the package if it exists.
+ for pkg; do
+ i_name=${pkg%/*}
+ i_name=${i_name##*/}
+
+ shift
- # Filter the existing file list through the manifest of the
- # presently installed version of the package (if it exists).
- grep -svFxf "$sys_db/$2/manifest" - 2>/dev/null > "$cac_dir/$pid-m"
+ [ "$p_name" = "$i_name" ] && continue
+
+ set -- "$@" "$pkg"
+ done
- # If the generated manifest contains matches, check the
- # contents for conflicts.
+ # Use 'grep' to list matching lines between the to
+ # be installed package's manifest and the above filtered
+ # list.
[ -s "$cac_dir/$pid-m" ] &&
- grep -Fxf "$cac_dir/$pid-m" -- "$sys_db"/*/manifest &&
- die "Package '$2' conflicts with another package"
+ grep -Fxf "$cac_dir/$pid-m" -- "$@" &&
+ die "Package '$p_name' conflicts with another package"
- set -ef
+ set -e
}
pkg_remove() {