make_normal                              &&
make install                             &&
if is_depends_enabled $SPELL python; then
  make python_install
fi &&

cd ..  &&

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  &&

if [[ $INIT_INSTALLED ]]; then
  install_config_file "$SPELL_DIRECTORY/init.d/samba.conf" \
                      "$INSTALL_ROOT/etc/sysconfig/samba"
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     &&

# 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
