#!/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 \ && 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 #DEBHELPER# # return without error true