7 update-rc.d metaproxy remove >/dev/null
9 [ -f /etc/default/metaproxy ] && . /etc/default/metaproxy
11 [ -z "$SERVER_HOME" ] && SERVER_HOME=/var/metaproxy
12 [ -z "$SERVER_USER" ] && SERVER_USER=metaproxy
13 [ -z "$SERVER_NAME" ] && SERVER_NAME="Metaproxy user"
14 [ -z "$SERVER_GROUP" ] && SERVER_GROUP=metaproxy
16 # find first and last SYSTEM_UID numbers
17 for LINE in `grep SYSTEM_UID /etc/adduser.conf | grep -v "^#"`; do
20 FIRST_SYSTEM_UID=`echo $LINE | cut -f2 -d '='`
23 LAST_SYSTEM_UID=`echo $LINE | cut -f2 -d '='`
29 # Remove system account if necessary
30 CREATEDUSER=$SERVER_USER
31 if [ -n "$FIRST_SYSTEM_UID" ] && [ -n "$LAST_SYSTEM_UID" ]; then
32 if USERID=`getent passwd $CREATEDUSER | cut -f 3 -d ':'`; then
33 if [ -n "$USERID" ]; then
34 if [ "$FIRST_SYSTEM_UID" -le "$USERID" ] && \
35 [ "$USERID" -le "$LAST_SYSTEM_UID" ]; then
36 echo -n "Removing $CREATEDUSER system user.."
37 deluser --quiet $CREATEDUSER || true
43 # Remove system group if necessary
44 CREATEDGROUP=$SERVER_GROUP
45 FIRST_USER_GID=`grep ^USERS_GID /etc/adduser.conf | cut -f2 -d '='`
46 if [ -n "$FIRST_USER_GID" ]; then
47 if GROUPGID=`getent group $CREATEDGROUP | cut -f 3 -d ':'`; then
48 if [ -n "$GROUPGID" ]; then
49 if [ "$FIRST_USER_GID" -gt "$GROUPGID" ]; then
50 echo -n "Removing $CREATEDGROUP group.."
51 delgroup --only-if-empty $CREATEDGROUP || true