5cb9cc94566ba595882fe4aa6d0e695a10399d88
[debian/amanda] / packaging / sun-pkg / client / postinstall.src
1 #!/bin/sh
2
3 LOGFILE=`mktemp /tmp/deb-log-amanda_enterprise-client.XXXXXXXXXXX`
4 if [ $? -ne 0 ]; then
5     echo "Unable to mktemp!" 1>&2
6     exit 1
7 fi
8 amanda_user=amandabackup; export amanda_user
9 amanda_group=disk; export amanda_group
10 AMANDAHOMEDIR="${BASEDIR}/%%AMANDAHOMEDIR%%"; export AMANDAHOMEDIR
11 os=SunOS; export os
12 arch=%%ARCH%%; export arch
13 LOGDIR="${BASEDIR}/%%LOGDIR%%"; export LOGDIR
14 INSTALL_LOG="${LOGDIR}/install.log"; export INSTALL_LOG
15 SYSCONFDIR="${BASEDIR}/etc"; export SYSCONFDIR
16 SBINDIR="${BASEDIR}/usr/sbin"; export SBINDIR
17 AMTMP="/tmp/amanda"
18
19 AMANDATES=${SYSCONFDIR}/amandates; export AMANDATES
20
21 exit_msg="Amanda installation log can be found in '${INSTALL_LOG}'."
22
23 # ---------- Common functions ------------
24 %%COMMON_FUNCTIONS%%
25 %%POST_INST_FUNCTIONS%%
26
27 # -------- End Common functions ----------
28
29 add_service
30 rel=`uname -r`
31 if [ "$rel" = "5.8" ]; then
32     check_inetd "amandaclient"
33     case $? in
34       0) backup_inetd "amandaclient"
35            install_inetd "amandaclient"
36       ;;
37       1) install_inetd "amandaclient" ;;
38       2) logger "Error: Amanda service not installed because inetd config was not found: either inetd config is not present or inetd is a directory." ;;
39     esac
40     # Amanda clients should not have the server xinetd installed.
41     check_inetd "amandaserver"
42     case $? in
43       0) backup_inetd "amandaserver" ;;
44     esac
45     reload_inetd
46 else
47     # Solaris 10+ uses smf, but we can't differentiate server from client, all
48     # entries end up named "amanda"
49     case check_smf "amanda"
50       0) backup_smf || logger "Warning: Backup of existing service failed. continuing..."
51          install_smf "amandaclient" || \
52             logger "Warning: Amanda service not installed."
53       ;;
54       1) install_smf "amandaclient" ;;
55     esac
56 fi
57
58 create_amandates
59 check_amandates
60 create_gnupg
61 check_gnupg
62 create_amandahosts
63 check_amandahosts_entry ${amanda_user} amdump
64 check_amandahosts_perms
65 create_ssh_key client
66 create_profile
67 check_profile
68 install_client_conf
69 create_amtmp
70
71 logger "Amanda installation complete."
72 cat $LOGFILE >> $INSTALL_LOG
73 rm $LOGFILE
74
75 echo "${exit_msg}"