Index: apkg-native
===================================================================
RCS file: /pack/anoncvs/autopackage/main/share/apkg-native,v
retrieving revision 1.4
diff -u -r1.4 apkg-native
--- apkg-native 2006/06/12 01:04:39 1.4
+++ apkg-native 2006/09/03 15:52:16
@@ -97,6 +97,9 @@
# If a frontend is connected, this function will show the uninstalling
# part of the user interface.
#
+# If <FILE> is a symlink that is not owned by a package, then the symlink
+# will be followed. This is so that libraries can be uninstalled (e.g., libfoo.so.0)
+#
# Example:
# removeOwningPackage "$PREFIX/bin/foobar"
# removeOwningPackage "$PREFIX/lib/libwidgets.so.0"
@@ -110,14 +113,27 @@
fi
trace "called with $1"
+
+ f="$1" # use $f instead of $1 incase we need to follow a symlink
- if ! _fileToNativeName "$1"; then
- warn _fileToNativeName failed
+ if ! _fileToNativeName "$f"; then
# if the file is not claimed by any pkg manager, then
# _fileToNativeName will return 1. This is a problem
# on systems where support for the package manager is
# not yet implemented (e.g., pkgtool on slackware).
- return 0
+
+ if [ -h "$1" ]; then
+ # if this is a symlink (e.g., libwidgets.so.0 created by ldconfig),
+ # follow it so people can use removeOwningPackage on libraries
+ f="`readlink -f $f`"
+ if ! _fileToNativeName "$f"; then
+ warn _fileToNativeName failed on followed symlink
+ return 0
+ fi
+ else
+ warn _fileToNativeName failed
+ return 0
+ fi
fi
if [[ "$result_package_manager" == "rpm" ]]; then
@@ -126,8 +142,8 @@
# this is unlikely: if we're installing to a prefix that conflicts
# with an RPM it's probably because the user entered the root password
# so we should have access rights here.
- warn "file $1 is owned by RPM but we are not root, bailing out"
- local msg=$( out "$intl_OWNED_BY_PM_BUT_NOT_ROOT" "$1" )
+ warn "file $f is owned by RPM but we are not root, bailing out"
+ local msg=$( out "$intl_OWNED_BY_PM_BUT_NOT_ROOT" "$f" )
outputFail "$msg"
clearResults
@@ -139,7 +155,7 @@
local whatrequires
if whatrequires=$( rpm -q --whatrequires $result_package_name --queryformat %{NAME} 2>&1 ); then
warn "we cannot remove $result_package_name, something else requires it"
- local msg=$( out "$intl_CANNOT_REMOVE_SYSTEM_PACKAGE" "$1" "$whatrequires" )
+ local msg=$( out "$intl_CANNOT_REMOVE_SYSTEM_PACKAGE" "$f" "$whatrequires" )
outputFail "$msg"
clearResults