make_normal                              &&
default_install                          &&

if  [[  "$SAMBA_CIFS"  ==  "y"  ]];  then
  install  -m  755  client/mount.cifs              \
                    $INSTALL_ROOT/sbin/mount.cifs
fi  &&

popd  &&

mkdir  -p  $INSTALL_ROOT/usr/share/samba/codepages    &&
mkdir  -p  $INSTALL_ROOT/var/{spool,cache,log}/samba  &&

mkdir  -m  700  -p  $INSTALL_ROOT/etc/samba/private  &&
if  [[  !  -f  $INSTALL_ROOT/etc/samba/private/smbpasswd  ]];  then
  touch       $INSTALL_ROOT/etc/samba/private/smbpasswd  &&
  chmod  600  $INSTALL_ROOT/etc/samba/private/smbpasswd
fi  &&

#
# Install libwinbind if it exists
#
if  [[  -f  source/nsswitch/libnss_winbind.so  ]]
then
  echo  "Installing nsswitch/libnss_winbind.so to $INSTALL_ROOT/lib"  &&
  install  -m  644  source/nsswitch/libnss_winbind.so                 \
                    $INSTALL_ROOT/lib                                 &&
  echo  "Symlinking libnss_winbind.so.2 to libnss_winbind.so"         &&
  pushd  $INSTALL_ROOT/lib                                            &&
  ln  -sf  libnss_winbind.so                                          \
           libnss_winbind.so.2                                        &&
  popd
fi  &&

if  [[  -f  source/nsswitch/libnss_wins.so  ]]
then
  echo  "Installing nsswitch/libnss_wins.so to $INSTALL_ROOT/lib"  &&
  install  -m  644  source/nsswitch/libnss_wins.so                 \
                    $INSTALL_ROOT/lib                              &&
  echo  "Symlinking libnss_wins.so.2 to libnss_wins.so"            &&
  pushd  $INSTALL_ROOT/lib                                         &&
  ln  -sf  libnss_wins.so                                          \
           libnss_wins.so.2                                        &&
  popd
fi  &&

install_config_file  examples/smb.conf.default  /etc/samba/smb.conf.default  &&
install_config_file  examples/smb.conf.default  /etc/samba/smb.conf          &&

if  [[  "$SAMBA_SUID"  =  "y"  ]];  then
  chmod  u+s  ${INSTALL_ROOT}/usr/bin/smbmnt     \
              ${INSTALL_ROOT}/usr/bin/smbumount && 

  if  [[  "$SAMBA_CIFS"  ==  "y"  ]];  then
    chmod  u+s  ${INSTALL_ROOT}/sbin/mount.cifs \
	    ${INSTALL_ROOT}/usr/sbin/umount.cifs
  fi
fi

# Setup the symlink for CUPS:
if  spell_ok  cups;  then
  if  !  [  -e  ${INSTALL_ROOT}/usr/lib/cups/backend/smb  ];  then
    ln  -s  ${INSTALL_ROOT}/usr/bin/smbspool  ${INSTALL_ROOT}/usr/lib/cups/backend/smb
  fi
fi

if [[ $SAMBA_VSCAN == 'y' ]] ; then
        cd $SOURCE_DIRECTORY/examples/VFS/$SPELL-vscan-$VSCAN_VERSION &&
        make install &&
        cd $SOURCE_DIRECTORY
fi

