diff options
author | merakor <cem@ckyln.com> | 2020-05-29 16:54:52 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-05-29 16:54:52 +0000 |
commit | c40cdfde32ad440cf7c989f597449806e3a89cda (patch) | |
tree | 55300dd938f6a21bbb37ab7b7e9587c6a17e2832 /kiss | |
parent | c94736abbacb52987947ddabcd247fa6a4d02cf9 (diff) | |
download | cpt-c40cdfde32ad440cf7c989f597449806e3a89cda.tar.gz |
kiss: simpler reverse dependency checking
FossilOrigin-Name: 80d2ed109e0b7f466e5800aa595caec8ef9266c561cf3e5ea2c17931b456416f
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 18 |
1 files changed, 5 insertions, 13 deletions
@@ -1036,21 +1036,13 @@ pkg_remove() { # overwritten. pkg_list "$1" >/dev/null || return - set +f - # Make sure that nothing depends on this package. - [ "$2" = check ] && for file in "$sys_db/"*; do - # Check each depends file for the package and if it's - # a run-time dependency, append to the $required_by string. - "$grep" -qFx "$1" "$file/depends" 2>/dev/null && - required_by="$required_by'${file##*/}', " - done - - [ "$required_by" ] && - die "$1" "Package is required by ${required_by%, }" - - set -f + [ "$KISS_FORCE" = 1 ] || { + log "$1" "Checking for reverse dependencies" + (cd "$sys_db"; set +f; grep -lFx "$1" -- */depends) && + die "$1" "Can't remove package, others depend on it" + } # Block being able to abort the script with 'Ctrl+C' during removal. # Removes all risk of the user aborting a package removal leaving # an incomplete package installed. |