X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=packaging%2Fdeb%2Fpreinst.src;fp=packaging%2Fdeb%2Fpreinst.src;h=2e6746190781d904b6f90cb31e9d4428a9bac541;hb=109540caa4e37a3663b3dcfb9a205b9609e3f561;hp=0000000000000000000000000000000000000000;hpb=4c9eba1feb11adf189bceb4001c425e641f0b56a;p=debian%2Famanda diff --git a/packaging/deb/preinst.src b/packaging/deb/preinst.src new file mode 100755 index 0000000..2e67461 --- /dev/null +++ b/packaging/deb/preinst.src @@ -0,0 +1,40 @@ +#!/bin/sh +# This is appended to packaging/deb/amanda-backup-*.preinst +# vim: ft=sh + +LOGFILE=`mktemp /tmp/amanda-preinst.log.XXXXXXXXXXX` +if [ $? -ne 0 ]; then + echo "Unable to mktemp!" 1>&2 + exit 1 +fi +amanda_user=amandabackup +amanda_group=disk +AMANDAHOMEDIR=%%AMANDAHOMEDIR%% +os=`uname` +wanted_shell=/bin/bash +dist=%%DISTRO%% +LOGDIR=%%LOGDIR%% +INSTALL_LOG=${LOGDIR}/install.log +SYSCONFDIR=/etc +# We require amandabackup to have a specific uid because buildtime uid is +# recorded in deb packages. This number should avoid conflict +deb_uid=63998 + +# See packaging/common/ for shell function libraries. +# ---------- Common functions ------------ +%%COMMON_FUNCTIONS%% +%%PRE_INST_FUNCTIONS%% + +# -------- End Common functions ---------- +logger "Preparing to install: Amanda Server %%VERSION%%" +create_user +check_user_group "${amanda_group}" || add_group "${amanda_group}" +check_user_supplemental_group "tape" || add_group "tape" +check_user_shell "${wanted_shell}" +check_user_homedir "${AMANDAHOMEDIR}" +check_homedir || create_homedir +create_logdir + +logger "Preinstall done." +cat $LOGFILE >> $INSTALL_LOG && rm $LOGFILE || \ + echo "Amanda preinstall logs can be found in '$LOGFILE'."