mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-12-23 07:30:16 -07:00
pkg_swap: use pkg_owner
This commit is contained in:
parent
501c4d315e
commit
b6c9179247
27
kiss
27
kiss
@ -129,13 +129,13 @@ file_owner() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pkg_owner() {
|
pkg_owner() {
|
||||||
[ "$3" ] || { set +f; set -f -- "$1" "$2" "$sys_db"/*/manifest; }
|
[ "$2" ] || { set +f; set -f -- "$1" "$sys_db"/*/manifest; }
|
||||||
|
|
||||||
pkg_owner=$(grep "$@")
|
_owns=$(grep -l "$@")
|
||||||
pkg_owner=${pkg_owner%/*}
|
_owns=${_owns%/*}
|
||||||
pkg_owner=${pkg_owner##*/}
|
_owns=${_owns##*/}
|
||||||
|
|
||||||
[ "$pkg_owner" ]
|
[ "$_owns" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
run_hook() {
|
run_hook() {
|
||||||
@ -641,11 +641,11 @@ pkg_fix_deps() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Skip file if owned by current package
|
# Skip file if owned by current package
|
||||||
! pkg_owner -l "/${lib#/}\$" manifest ||
|
! pkg_owner "/${lib#/}\$" manifest ||
|
||||||
continue
|
continue
|
||||||
|
|
||||||
! pkg_owner -l "/${lib#/}\$" "$@" ||
|
! pkg_owner "/${lib#/}\$" "$@" ||
|
||||||
printf '%s\n' "$pkg_owner"
|
printf '%s\n' "$_owns"
|
||||||
|
|
||||||
esac done <<EOF || :
|
esac done <<EOF || :
|
||||||
$elf_buf
|
$elf_buf
|
||||||
@ -1110,15 +1110,8 @@ pkg_swap() {
|
|||||||
die "Alternative '$1 ${2:-null}' doesn't exist"
|
die "Alternative '$1 ${2:-null}' doesn't exist"
|
||||||
|
|
||||||
if [ -f "$KISS_ROOT$2" ]; then
|
if [ -f "$KISS_ROOT$2" ]; then
|
||||||
# Figure out which package owns the file we are going to swap in the
|
pkg_owner "/${2#/}\$" ||
|
||||||
# system then extract the name from the path spat out by grep.
|
die "File '$2' exists on filesystem but isn't owned"
|
||||||
_owns=$(set +f; grep -lFx "$2" "$sys_db/"*/manifest) || :
|
|
||||||
_owns=${_owns%/*}
|
|
||||||
_owns=${_owns##*/}
|
|
||||||
|
|
||||||
# Ensure that the file we're going to swap is actually owned by a
|
|
||||||
# package. If it is not, we have to die here.
|
|
||||||
[ "$_owns" ] || die "File '$2' exists on filesystem but isn't owned"
|
|
||||||
|
|
||||||
log "Swapping '$2' from '$_owns' to '$1'"
|
log "Swapping '$2' from '$_owns' to '$1'"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user