cryptonas/debian/postrm

46 lines
929 B
Text
Raw Normal View History

#!/bin/sh
LOG_FILE=/var/log/cryptobox.log
WEBLOG_FILE=/var/log/cryptoboxwebserver.log
PID_DIR=/var/run/cryptobox
SUPER_FILE=/etc/super.tab
remove_super_lines()
{
## do nothing, if there is no CryptoBox line
grep -q "CRYPTOBOX_MARKER" "$SUPER_FILE" || return 0
sed -i /CRYPTOBOX_MARKER/d "$SUPER_FILE"
sed -i /CryptoBoxRootActions/d "$SUPER_FILE"
}
remove_log_files()
{
test -e "$LOG_FILE" && rm "$LOG_FILE"
test -e "$LOG_FILE" && rm "$WEBLOG_FILE"
}
remove_pid_dir()
{
test -e "$PID_DIR" && rm -r "$PID_DIR"
}
################## main ###################
if test "$1" = "purge" && getent passwd cryptobox 2>/dev/null >/dev/null \
2006-11-10 10:05:14 +01:00
&& test "$(cd ~cryptobox;pwd)" = /var/cache/cryptobox
then echo "Removing user 'cryptobox' ..."
userdel -r cryptobox
remove_log_files
remove_pid_dir
fi
## always remove the lines from the 'super' configuration file
remove_super_lines
2006-05-30 21:00:34 +02:00
#DEBHELPER#
2005-12-01 19:22:05 +01:00
# return without error
true