#!/bin/sh
#
# aryzhov@spasu.net
#
# Install and configure Samba in smbd zone
# Normally, must be started from add_zones for a specific machine
#
[ -z "$SID" ] && SID=/tmp/install_config
[ X$SubrIsRead = XYes ] || . $SID/Scripts/Misc/!Includes/Subroutines
[ X$VarsAreSet = XYes ] || SetJVars
SetRootOpts ; [ X$ROOT != X/ ] && exec Chroot_Script $0 $*

echo "\n\n=== Installing Samba ===\n"

[ x$ZONESDIR != x ] || StartShell "$0: ZONESDIR undefined"
SAMBA_ROOT=$ZONESDIR/smbd/root; [ -d $SAMBA_ROOT ] || StartShell "$SAMBA_ROOT/. - no such directory"
PKGDIR=`ls -d /cdrom/Solaris_*/Product`; cd $PKGDIR/. || StartShell "No package directory $PKGDIR"

PKGLIST="
  SUNWlibpopt
  SUNWlibgcrypt
  SUNWgnutls
  SUNWsmbar
  SUNWsmbau
  SUNWsmbac
"

MakeAdminFile

for i in $PKGLIST; do
  pkgadd -nM -a $PKGADMIN_FILE -R $SAMBA_ROOT -d $PKGDIR $i 2>&1 | grep "Installation of"
done


mv $SAMBA_ROOT/etc/sfw $SAMBA_ROOT/etc/sfw.std || StartShell === Samba config save failed ===
gzip -d <$JS_MEDIA_DIR/Packages/ARZ/Samba/RootPatch.tgz | (cd $SAMBA_ROOT && tar xvf - || StartShell === Tar failed ===)

# StartShell ================= Samba Debug ===================

