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