1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-25 00:20:05 -07:00

kiss: Added package conflicts.

This commit is contained in:
Dylan Araps 2019-06-17 10:18:36 +03:00
parent fa3a8bc65e
commit e73a8b728d

28
kiss
View File

@ -134,15 +134,41 @@ pkg_tar() {
log "Use '$kiss install $name' to install the package." log "Use '$kiss install $name' to install the package."
} }
pkg_conflicts() {
log "Checking for package 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
# Compare extracted manifest to all installed manifests.
# If there are matching lines (files) there's a package
# conflict.
for db in "$sys_db"/*; do
[ "$name" = "${db##*/}" ] && continue
grep -Fxf "$cac_dir/manifest" "$db/manifest" &&
die "Package '$name' conflicts with '${db##*/}'."
done
rm "$cac_dir/manifest"
}
pkg_install() { pkg_install() {
[ -f "$bin_dir/$pkg" ] || args b "$name" [ -f "$bin_dir/$pkg" ] || args b "$name"
pkg_conflicts
# Create a backup of 'tar' so it isn't removed during # Create a backup of 'tar' so it isn't removed during
# package installation. # package installation.
cp "$(command -v tar)" "$cac_dir" cp "$(command -v tar)" "$cac_dir"
log "Removing previous version of package if it exists."
pkg_remove "$name" pkg_remove "$name"
"$cac_dir/tar" kpxvf "$bin_dir/$pkg" -C "$sys_dir/"
"$cac_dir/tar" kpxf "$bin_dir/$pkg" -C "$sys_dir/"
rm "$cac_dir/tar" rm "$cac_dir/tar"
"$sys_db/$name/post-install" 2>/dev/null "$sys_db/$name/post-install" 2>/dev/null