source3/script: fix installman.sh after the last build-manpages-nogit change
[metze/samba/wip.git] / source3 / script / installman.sh
index 5564ac02318e276d4d52ae0450c4f18537673028..b029089ab2d0fc35e3f26bc81af8908e632ad2f2 100755 (executable)
@@ -13,11 +13,16 @@ if [ $# -ge 4 ] ; then
   GROFF=$4                    # sh cmd line, including options 
 fi
 
-if test ! -d docs/manpages; then
-       echo "No manpages present.  SVN development version maybe?"
+if test ! -d $SRCDIR../bin/docs/manpages; then
+       echo "No manpages present.  Development version maybe?"
        exit 0
 fi
 
+# Get the configured feature set
+test -f "${SRCDIR}/config.log" && \
+       eval `grep "^[[:alnum:]]*=.*" "${SRCDIR}/config.log" |
+             grep -v ^MANDIR | grep -v ^SRCDIR`
+
 for lang in $langs; do
     if [ "X$lang" = XC ]; then
        echo Installing default man pages in $MANDIR/
@@ -39,14 +44,21 @@ for lang in $langs; do
 
     for sect in 1 5 7 8 ; do
        for m in $langdir/man$sect ; do
-           for s in $SRCDIR../docs/manpages/$lang/*$sect; do
-           FNAME=$m/`basename $s`
+           for s in $SRCDIR../bin/docs/manpages/$lang/*$sect; do
+           MP_BASENAME=`basename $s`
+
+           # Check if this man page if required by the configured feature set
+           case "${MP_BASENAME}" in
+               smbsh.1) test -z "${SMBWRAPPER}" && continue ;;
+               *) ;;
+           esac
+
+           FNAME="$m/${MP_BASENAME}"
+
            # Test for writability.  Involves 
            # blowing away existing files.
  
            if (rm -f $FNAME && touch $FNAME); then
-               rm $FNAME
                if [ "x$GROFF" = x ] ; then
                    cp $s $m            # Copy raw nroff 
                else