piler/debian/preinst

42 lines
557 B
Bash

#!/bin/sh
set -e
create_piler_user() {
id piler &>/dev/null
if [ $? -ne 0 ]; then
groupadd piler
useradd -g piler -s /bin/sh -d /var/piler piler
usermod -L piler
fi
}
save_current_config() {
BAKFILE=/usr/local/etc/piler.conf.`date +%s`
cp /usr/local/etc/piler.conf $BAKFILE
}
case "$1" in
install)
create_piler_user
;;
upgrade|abort-upgrade)
save_current_config
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
#DEBHELPER#
exit 0