Imported Upstream version 3.3.2
[debian/amanda] / packaging / deb / preinst.src
1 #!/bin/sh
2 # This is appended to packaging/deb/amanda-backup-*.preinst
3 # vim: ft=sh
4
5 LOGFILE=`mktemp /tmp/amanda-preinst.log.XXXXXXXXXXX`
6 if [ $? -ne 0 ]; then
7     echo "Unable to mktemp!" 1>&2
8     exit 1
9 fi
10 amanda_user=amandabackup
11 amanda_group=disk
12 AMANDAHOMEDIR=%%AMANDAHOMEDIR%%
13 os=`uname`
14 wanted_shell=/bin/bash
15 dist=%%DISTRO%%
16 LOGDIR=%%LOGDIR%%
17 INSTALL_LOG=${LOGDIR}/install.log
18 SYSCONFDIR=/etc
19 # We require amandabackup to have a specific uid because buildtime uid is
20 # recorded in deb packages.  This number should avoid conflict
21 deb_uid=63998
22
23 # See packaging/common/ for shell function libraries.
24 # ---------- Common functions ------------
25 %%COMMON_FUNCTIONS%%
26 %%PRE_INST_FUNCTIONS%%
27
28 # -------- End Common functions ----------
29 logger "Preparing to install: Amanda Server %%VERSION%%"
30 create_user
31 check_user_group "${amanda_group}" || add_group "${amanda_group}"
32 check_user_supplemental_group "tape" || add_group "tape"
33 check_user_shell "${wanted_shell}"
34 check_user_homedir "${AMANDAHOMEDIR}"
35 check_homedir || create_homedir
36 create_logdir
37
38 logger "Preinstall done."
39 cat $LOGFILE >> $INSTALL_LOG && rm $LOGFILE || \
40     echo "Amanda preinstall logs can be found in '$LOGFILE'."