Skip to content

Commit

Permalink
[build] Cleanup postrm
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz committed May 27, 2016
1 parent f9033a1 commit bab73b8
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions tasks/build/package_scripts/post_remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,34 @@ user_remove() {
userdel "$1"
}

REMOVE_USER=false

case $1 in
purge|0)
if user_check "<%= user %>" ; then
user_remove "<%= user %>"
fi
;;

# Debian
purge)
REMOVE_USER=true
;;

remove|failed-upgrade|abort-install|abort-upgrade|disappear|upgrade|disappear)
;;

# Red Hat
0)
REMOVE_USER=true
;;

1)
;;

*)
echo "post remove script called with unknown argument \`$1'" >&2
exit 1
;;
esac

if [ "$REMOVE_USER" = "true" ]; then
if user_check "<%= user %>" ; then
user_remove "<%= user %>"
fi
fi

0 comments on commit bab73b8

Please sign in to comment.