rlm@1: #!/bin/sh rlm@1: # Copyright (c) 2004 Matthias S. Benkmann
rlm@1: # You may do everything with this code except misrepresent its origin. rlm@1: # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND! rlm@1: rlm@1: if [ $# != 1 -o "$1" = '--help' ]; then rlm@1: echo 1>&2 'USAGE: uninstall_package ' rlm@1: exit 1 rlm@1: fi rlm@1: echo rlm@1: echo '# If package '"$1"' has setuid root binaries, then you need to be' rlm@1: echo '# root for the following to work.' rlm@1: echo '# Otherwise, you can do it as user '"$1"'.' rlm@1: echo rlm@1: echo 'forall_direntries_from "'"$1"'" -depth \( -type d -exec echo rmdir {} \; \) -or \( -not -type d -exec echo rm -f {} \; \)' rlm@1: echo rlm@1: echo '# After successfully deleting all files, you may want to remove the' rlm@1: echo '# package user '"$1"'. But remember that if you do that you need to' rlm@1: echo '# remove or change ownership of '"$(eval echo ~"$1")"'. Unless you are' rlm@1: echo '# certain that you will never re-install '"$1"', it is probably better to' rlm@1: echo '# just keep the package user '"$1"' and its home directory around.' rlm@1: echo '# Anyway, if you want to delete the account, you can use the following' rlm@1: echo '# command:' rlm@1: echo rlm@1: echo 'userdel "'"$1"'"' rlm@1: echo rlm@1: echo '# If your /etc/login.defs has USERGROUPS_ENAB set to "yes" (the default),' rlm@1: echo '# then userdel will automatically delete the package user'"'"'s group if' rlm@1: echo '# its name is identical to the user name. Otherwise, if you want to delete' rlm@1: echo '# the package user'"'"'s group, you will need to use the `groupdel'"'"' command.' rlm@1: echo