Merge tag 'upstream/3.3.2'
[debian/amanda] / packaging / sun-pkg / client / postinstall.src
index 5cb9cc94566ba595882fe4aa6d0e695a10399d88..e6ef6eb9eac91e3908cdf6dae4f792a8b6eb6459 100755 (executable)
@@ -1,19 +1,22 @@
 #!/bin/sh
 
-LOGFILE=`mktemp /tmp/deb-log-amanda_enterprise-client.XXXXXXXXXXX`
+LOGFILE=`mktemp /tmp/amanda-client-postinstall.log.XXXXXXXXXXX`
 if [ $? -ne 0 ]; then
     echo "Unable to mktemp!" 1>&2
     exit 1
 fi
 amanda_user=amandabackup; export amanda_user
 amanda_group=disk; export amanda_group
-AMANDAHOMEDIR="${BASEDIR}/%%AMANDAHOMEDIR%%"; export AMANDAHOMEDIR
+# BASEDIR is set by either in pkginfo, or if not set, by pkgadd at installtime.
+# Unfortunately, it messes things up to have basedir="/".
+[ "x${BASEDIR}" = "x/" ] && basedir="" || basedir=${BASEDIR}
+AMANDAHOMEDIR="${basedir}%%AMANDAHOMEDIR%%"; export AMANDAHOMEDIR
 os=SunOS; export os
 arch=%%ARCH%%; export arch
-LOGDIR="${BASEDIR}/%%LOGDIR%%"; export LOGDIR
+LOGDIR="${basedir}%%LOGDIR%%"; export LOGDIR
 INSTALL_LOG="${LOGDIR}/install.log"; export INSTALL_LOG
-SYSCONFDIR="${BASEDIR}/etc"; export SYSCONFDIR
-SBINDIR="${BASEDIR}/usr/sbin"; export SBINDIR
+SYSCONFDIR="${basedir}/etc"; export SYSCONFDIR
+SBINDIR="${basedir}/usr/sbin"; export SBINDIR
 AMTMP="/tmp/amanda"
 
 AMANDATES=${SYSCONFDIR}/amandates; export AMANDATES
@@ -46,7 +49,8 @@ if [ "$rel" = "5.8" ]; then
 else
     # Solaris 10+ uses smf, but we can't differentiate server from client, all
     # entries end up named "amanda"
-    case check_smf "amanda"
+    check_smf "amanda"
+    case $? in
       0) backup_smf || logger "Warning: Backup of existing service failed. continuing..."
          install_smf "amandaclient" || \
             logger "Warning: Amanda service not installed."