Mercurial > pkg
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/previous-work/more_control_helpers/bin/uninstall_package Tue Jan 08 11:45:01 2013 +0000 1.3 @@ -0,0 +1,31 @@ 1.4 +#!/bin/sh 1.5 +# Copyright (c) 2004 Matthias S. Benkmann <article AT winterdrache DOT de> 1.6 +# You may do everything with this code except misrepresent its origin. 1.7 +# PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND! 1.8 + 1.9 +if [ $# != 1 -o "$1" = '--help' ]; then 1.10 + echo 1>&2 'USAGE: uninstall_package <package-name>' 1.11 + exit 1 1.12 +fi 1.13 +echo 1.14 +echo '# If package '"$1"' has setuid root binaries, then you need to be' 1.15 +echo '# root for the following to work.' 1.16 +echo '# Otherwise, you can do it as user '"$1"'.' 1.17 +echo 1.18 +echo 'forall_direntries_from "'"$1"'" -depth \( -type d -exec echo rmdir {} \; \) -or \( -not -type d -exec echo rm -f {} \; \)' 1.19 +echo 1.20 +echo '# After successfully deleting all files, you may want to remove the' 1.21 +echo '# package user '"$1"'. But remember that if you do that you need to' 1.22 +echo '# remove or change ownership of '"$(eval echo ~"$1")"'. Unless you are' 1.23 +echo '# certain that you will never re-install '"$1"', it is probably better to' 1.24 +echo '# just keep the package user '"$1"' and its home directory around.' 1.25 +echo '# Anyway, if you want to delete the account, you can use the following' 1.26 +echo '# command:' 1.27 +echo 1.28 +echo 'userdel "'"$1"'"' 1.29 +echo 1.30 +echo '# If your /etc/login.defs has USERGROUPS_ENAB set to "yes" (the default),' 1.31 +echo '# then userdel will automatically delete the package user'"'"'s group if' 1.32 +echo '# its name is identical to the user name. Otherwise, if you want to delete' 1.33 +echo '# the package user'"'"'s group, you will need to use the `groupdel'"'"' command.' 1.34 +echo