aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpt-lib.in15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index da9925b..d0de978 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -1375,6 +1375,9 @@ pkg_conflicts() {
# Check to see if a package conflicts with another.
log "$1" "Checking for package conflicts"
+ c_manifest=$(_tmp_create conflict-manifest)
+ c_conflicts=$(_tmp_create conflicts)
+
# Filter the tarball's manifest and select only files
# and any files they resolve to on the filesystem
# (/bin/ls -> /usr/bin/ls).
@@ -1396,7 +1399,7 @@ pkg_conflicts() {
# temporary manifest to be parsed.
printf '%s/%s\n' "${dirname#"$CPT_ROOT"}" "${file##*/}"
- done < "$tar_dir/$1/$pkg_db/$1/manifest" > "$CPT_TMPDIR/$pid/manifest"
+ done < "$tar_dir/$1/$pkg_db/$1/manifest" > "$c_manifest"
p_name=$1
@@ -1405,7 +1408,7 @@ pkg_conflicts() {
# shellcheck disable=2046,2086
set -- $(set +f; pop "$sys_db/$p_name/manifest" from "$sys_db"/*/manifest)
- [ -s "$CPT_TMPDIR/$pid/manifest" ] || return 0
+ [ -s "$c_manifest" ] || return 0
# In rare cases where the system only has one package installed
# and you are reinstalling that package, grep will try to read from
@@ -1421,12 +1424,12 @@ pkg_conflicts() {
# Store the list of found conflicts in a file as we will be using the
# information multiple times. Storing it in the cache dir allows us
# to be lazy as they'll be automatically removed on script end.
- sed '/\/$/d' "$@" | sort "$CPT_TMPDIR/$pid/manifest" - | uniq -d > "$CPT_TMPDIR/$pid/conflict" ||:
+ sed '/\/$/d' "$@" | sort "$c_manifest" - | uniq -d > "$c_conflicts" ||:
# Enable alternatives automatically if it is safe to do so.
# This checks to see that the package that is about to be installed
# doesn't overwrite anything it shouldn't in '/var/db/cpt/installed'.
- "$grep" -q "/var/db/cpt/installed/" "$CPT_TMPDIR/$pid/conflict" ||
+ "$grep" -q "/var/db/cpt/installed/" "$c_conflicts" ||
choice_auto=1
# Use 'grep' to list matching lines between the to
@@ -1477,13 +1480,13 @@ pkg_conflicts() {
log "this must be fixed in $p_name. Contact the maintainer"
die "by checking 'git log' or by running 'cpt-maintainer'"
}
- done < "$CPT_TMPDIR/$pid/conflict"
+ done < "$c_conflicts"
# Rewrite the package's manifest to update its location
# to its new spot (and name) in the choices directory.
pkg_manifest "$p_name" "$tar_dir" 2>/dev/null
- elif [ -s "$CPT_TMPDIR/$pid/conflict" ]; then
+ elif [ -s "$c_conflicts" ]; then
log "Package '$p_name' conflicts with another package" "" "!>"
log "Run 'CPT_CHOICE=1 cpt i $p_name' to add conflicts" "" "!>"
die "as alternatives."