Mercurial > pkg
view previous-work/more_control_helpers/bin/uninstall_package @ 1:d6bef198ae71
add work by Matthias S. Benkmann which is the inspiration for this project.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 08 Jan 2013 11:45:01 +0000 |
parents | |
children |
line wrap: on
line source
1 #!/bin/sh2 # Copyright (c) 2004 Matthias S. Benkmann <article AT winterdrache DOT de>3 # You may do everything with this code except misrepresent its origin.4 # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND!6 if [ $# != 1 -o "$1" = '--help' ]; then7 echo 1>&2 'USAGE: uninstall_package <package-name>'8 exit 19 fi10 echo11 echo '# If package '"$1"' has setuid root binaries, then you need to be'12 echo '# root for the following to work.'13 echo '# Otherwise, you can do it as user '"$1"'.'14 echo15 echo 'forall_direntries_from "'"$1"'" -depth \( -type d -exec echo rmdir {} \; \) -or \( -not -type d -exec echo rm -f {} \; \)'16 echo17 echo '# After successfully deleting all files, you may want to remove the'18 echo '# package user '"$1"'. But remember that if you do that you need to'19 echo '# remove or change ownership of '"$(eval echo ~"$1")"'. Unless you are'20 echo '# certain that you will never re-install '"$1"', it is probably better to'21 echo '# just keep the package user '"$1"' and its home directory around.'22 echo '# Anyway, if you want to delete the account, you can use the following'23 echo '# command:'24 echo25 echo 'userdel "'"$1"'"'26 echo27 echo '# If your /etc/login.defs has USERGROUPS_ENAB set to "yes" (the default),'28 echo '# then userdel will automatically delete the package user'"'"'s group if'29 echo '# its name is identical to the user name. Otherwise, if you want to delete'30 echo '# the package user'"'"'s group, you will need to use the `groupdel'"'"' command.'31 echo