r6982: install the swat pages with 'make installswat'
authorAndrew Tridgell <tridge@samba.org>
Thu, 26 May 2005 02:06:33 +0000 (02:06 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:02 +0000 (13:17 -0500)
(This used to be commit 31543e1eae03d22343ea8c970494af36eb07b41f)

source4/build/smb_build/check_path.m4
source4/build/smb_build/makefile.pm
source4/dynconfig.c
source4/include/dynconfig.h
source4/param/loadparm.c
source4/script/installswat.sh
source4/web_server/http.c
source4/web_server/web_server.c

index bfd15d3d8cc4f4730f3dfb9bd31018082edb1eeb..5d3c70049dd9a279142e619d383171ecdf0d7725 100644 (file)
@@ -107,6 +107,20 @@ AC_ARG_WITH(logfilebase,
     ;;
   esac])
 
+
+#################################################
+# set swat directory location
+AC_ARG_WITH(swatdir,
+[  --with-swatdir=DIR    Where to put configuration files (\$swatdir)],
+[ case "$withval" in
+  yes|no)
+    AC_MSG_WARN([--with-swatdir called without argument - will use default])
+  ;;
+  * )
+    swatdir="$withval"
+    ;;
+  esac])
+
 AC_SUBST(configdir)
 AC_SUBST(lockdir)
 AC_SUBST(piddir)
@@ -114,6 +128,7 @@ AC_SUBST(logfilebase)
 AC_SUBST(privatedir)
 AC_SUBST(bindir)
 AC_SUBST(sbindir)
+AC_SUBST(swatdir)
 
 debug=no
 AC_ARG_ENABLE(debug, 
index 19ed201d816d20011eabd4d1bf873a9acdc2d370..ab64eff99cd9bff544c5889ea692e0c36119c4a7 100644 (file)
@@ -41,6 +41,7 @@ SBINDIR = @sbindir@
 LIBDIR = @libdir@
 CONFIGDIR = @configdir@
 VARDIR = @localstatedir@
+SWATDIR = @swatdir@
 
 # The permissions to give the executables
 INSTALLPERMS = 0755
@@ -71,7 +72,8 @@ PATH_FLAGS4 = $(PATH_FLAGS3) -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
 PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \
              -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"
 PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\"
-PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS)
+PATH_FLAGS7 = $(PATH_FLAGS6) -DSWATDIR=\"$(SWATDIR)\"
+PATH_FLAGS = $(PATH_FLAGS7) $(PASSWD_FLAGS)
 
 __EOD__
 
@@ -622,6 +624,7 @@ showlayout:
        @echo "  privatedir:  $(PRIVATEDIR)"
        @echo "  piddir:  $(PIDDIR)"
        @echo "  lockdir:  $(LOCKDIR)"
+       @echo "  swatdir:  $(SWATDIR)"
 
 showflags:
        @echo "Samba will be compiled with flags:"
@@ -655,7 +658,7 @@ REG_PROGS =         bin/regpatch \
                bin/regpatch \
                bin/regdiff
 
-install: showlayout installbin installtorture installldb installreg installdat 
+install: showlayout installbin installtorture installldb installreg installdat installswat
 
 # DESTDIR is used here to prevent packagers wasting their time
 # duplicating the Makefile. Remove it and you will have the privelege
@@ -684,6 +687,9 @@ installreg: all installdirs
 installdat: installdirs
        @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
 
+installswat: installdirs
+       @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
+
 uninstall: uninstallbin uninstalltorture uninstallldb uninstallreg
 
 uninstallbin:
index c76d448b8cdd006c7147b5cec59a970462b34de4..50dadee91e5a94aa822b9e84acc5e60309f9c2a0 100644 (file)
@@ -72,3 +72,4 @@ const pstring dyn_PIDDIR  = PIDDIR;
 
 const pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
 const pstring dyn_PRIVATE_DIR = PRIVATE_DIR;
+const pstring dyn_SWATDIR = SWATDIR;
index a95e67a90dbdab2a7860bf3105526c92103c5b6c..0692f5b932ff2368be1c60300fa5ad549faca8c5 100644 (file)
@@ -40,3 +40,4 @@ extern const pstring dyn_LOCKDIR;
 extern const pstring dyn_PIDDIR;
 extern const pstring dyn_SMB_PASSWD_FILE;
 extern const pstring dyn_PRIVATE_DIR;
+extern const pstring dyn_SWATDIR;
index 956c42881bc90982114f0e2a2ee042dbf121a0c1..4b55db8aabafd632c6abebcb72842b51c607a93b 100644 (file)
@@ -239,7 +239,7 @@ typedef struct
        int nbt_port;
        int dgram_port;
        int cldap_port;
-       int swat_port;
+       int web_port;
        char *socket_options;
        BOOL bDNSproxy;
        BOOL bWINSsupport;
@@ -623,7 +623,7 @@ static struct parm_struct parm_table[] = {
        {"nbt port", P_INTEGER, P_GLOBAL, &Globals.nbt_port, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
        {"dgram port", P_INTEGER, P_GLOBAL, &Globals.dgram_port, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
        {"cldap port", P_INTEGER, P_GLOBAL, &Globals.cldap_port, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
-       {"swat port", P_INTEGER, P_GLOBAL, &Globals.swat_port, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+       {"web port", P_INTEGER, P_GLOBAL, &Globals.web_port, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
        {"swat directory", P_STRING, P_GLOBAL, &Globals.swat_directory, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
        {"large readwrite", P_BOOL, P_GLOBAL, &Globals.bLargeReadwrite, NULL, NULL, FLAG_DEVELOPER},
        {"max protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, FLAG_DEVELOPER},
@@ -1061,8 +1061,8 @@ static void init_globals(void)
        do_parameter("nbt port", "137");
        do_parameter("dgram port", "138");
        do_parameter("cldap port", "389");
-       do_parameter("swat port", "901");
-       do_parameter_var("swat directory", "%s%s", dyn_LIBDIR, "/swat");
+       do_parameter("web port", "901");
+       do_parameter("swat directory", dyn_SWATDIR);
 
        do_parameter("nt status support", "True");
 
@@ -1166,7 +1166,7 @@ FN_GLOBAL_LIST(lp_smb_ports, &Globals.smb_ports)
 FN_GLOBAL_INTEGER(lp_nbt_port, &Globals.nbt_port)
 FN_GLOBAL_INTEGER(lp_dgram_port, &Globals.dgram_port)
 FN_GLOBAL_INTEGER(lp_cldap_port, &Globals.cldap_port)
-FN_GLOBAL_INTEGER(lp_swat_port, &Globals.swat_port)
+FN_GLOBAL_INTEGER(lp_web_port, &Globals.web_port)
 FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
 FN_GLOBAL_STRING(lp_swat_directory, &Globals.swat_directory)
 FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
index c66604cdb84e40d8e0d8b1d612caa94ebf50f961..dbf0e7351f887dc6250c0cea8c9e69aeeee3f62c 100644 (file)
 #!/bin/sh
-#fist version March 1998, Andrew Tridgell
 
 SWATDIR=$1
 SRCDIR=$2/
-BOOKDIR=$SWATDIR/using_samba
 
-echo Installing SWAT in $SWATDIR
-echo Installing the Samba Web Administration Tool
+echo Installing swat files in $SWATDIR
 
-LANGS=". `cd $SRCDIR../swat/; /bin/echo lang/??`"
-echo Installing langs are `cd $SRCDIR../swat/lang/; /bin/echo ??`
+cd $SRCDIR/../swat || exit 1
 
-for ln in $LANGS; do 
- SWATLANGDIR=$SWATDIR/$ln
- for d in $SWATLANGDIR $SWATLANGDIR/help $SWATLANGDIR/images \
-       $SWATLANGDIR/include; do
-    if [ ! -d $d ]; then
-       mkdir -p $d
-       if [ ! -d $d ]; then
-           echo Failed to make directory $d, does $USER have privileges?
-           exit 1
-       fi
-    fi
- done
-done
-
-# Install images
-for ln in $LANGS; do
-
-for f in $SRCDIR../swat/$ln/images/*.gif; do
-      FNAME=$SWATDIR/$ln/images/`basename $f`
-      echo $FNAME
-      cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-      chmod 0644 $FNAME
-done
-
-# Install html help
-
-for f in $SRCDIR../swat/$ln/help/*.html; do
-      FNAME=$SWATDIR/$ln/help/`basename $f`
-      echo $FNAME
-      if [ "x$BOOKDIR" = "x" ]; then
-        cat $f | sed 's/@BOOKDIR@.*$//' > $f.tmp
-      else
-        cat $f | sed 's/@BOOKDIR@//' > $f.tmp
-      fi
-      f=$f.tmp
-      cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-      rm -f $f
-      chmod 0644 $FNAME
-done
-
-# Install html documentation
-
-for f in $SRCDIR../docs/htmldocs/*.html; do
-      FNAME=$SWATDIR/help/`basename $f`
-      echo $FNAME
-      cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-      chmod 0644 $FNAME
-done
-
-# Install "server-side" includes
-
-for f in $SRCDIR../swat/$ln/include/*.html; do
-      FNAME=$SWATDIR/$ln/include/`basename $f`
-      echo $FNAME
-      cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-      chmod 0644 $FNAME
-done
-
-done
-
-# Install Using Samba book
-
-if [ "x$BOOKDIR" != "x" ]; then
-
-    # Create directories
-
-    for d in $BOOKDIR $BOOKDIR/figs $BOOKDIR/gifs; do
-        if [ ! -d $d ]; then
-            mkdir $d
-            if [ ! -d $d ]; then
-                echo Failed to make directory $d, does $USER have privileges?
-                exit 1
-            fi
-        fi
-    done
-
-    # HTML files
-
-    for f in $SRCDIR../docs/htmldocs/using_samba/*.html; do
-        FNAME=$BOOKDIR/`basename $f`
-        echo $FNAME
-        cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-        chmod 0644 $FNAME
-    done
-
-    # Figures
-
-    for f in $SRCDIR../docs/htmldocs/using_samba/figs/*.gif; do
-        FNAME=$BOOKDIR/figs/`basename $f`
-        echo $FNAME
-        cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-        chmod 0644 $FNAME
-    done
-
-    # Gifs
-
-    for f in $SRCDIR../docs/htmldocs/using_samba/gifs/*.gif; do
-        FNAME=$BOOKDIR/gifs/`basename $f`
-        echo $FNAME
-        cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-        chmod 0644 $FNAME
+installdir() {
+    dir=$1
+    ext=$2
+    mkdir -p $SWATDIR/$dir || exit 1
+    for f in $dir/*.$ext; do
+       echo Installing $f
+       cp $f $SWATDIR/$dir/ || exit 1
+       chmod 0644 $SWATDIR/$f || exit 1
     done
+}
 
-fi
+installdir html html
+installdir html/esptest html
+installdir html/images png
+installdir scripting ejs
 
 cat << EOF
 ======================================================================
-The SWAT files have been installed. Remember to read the swat/README
-for information on enabling and using SWAT
+The swat files have been installed. 
 ======================================================================
 EOF
 
index ad7eaa8ead706422a16896cbb363bfec69c68609..61ed6853617600d4f33a730d03bf31fe6d955265 100644 (file)
@@ -250,7 +250,7 @@ static const char *http_local_path(struct websrv_context *web, const char *url)
                }
        }
 
-       path = talloc_asprintf(web, "%s/%s", lp_swat_directory(), url+1);
+       path = talloc_asprintf(web, "%s/html/%s", lp_swat_directory(), url+1);
        if (path == NULL) return NULL;
 
        if (directory_exist(path)) {
@@ -275,7 +275,7 @@ static void http_simple_request(struct websrv_context *web)
        /* looks ok */
        web->output.fd = open(path, O_RDONLY);
        if (web->output.fd == -1) {
-               http_error_unix(web, url);
+               http_error_unix(web, path);
                return;
        }
 
@@ -354,7 +354,7 @@ static void esp_request(struct esp_state *esp)
        /* looks ok */
        fd = open(path, O_RDONLY);
        if (fd == -1) {
-               http_error_unix(web, url);
+               http_error_unix(web, path);
                return;
        }
 
index 9d161bdd8add8d3ad90a257ff018428eddccf69c..656e101c11c38dc12d5902a74e46d946eed71e46 100644 (file)
@@ -202,7 +202,7 @@ static const struct stream_server_ops web_stream_ops = {
 static void websrv_task_init(struct task_server *task)
 {
        NTSTATUS status;
-       uint16_t port = lp_swat_port();
+       uint16_t port = lp_web_port();
        const struct model_ops *model_ops;
 
        /* run the web server as a single process */