From: Richard Kettlewell Date: Fri, 6 Jun 2008 12:49:15 +0000 (+0100) Subject: More automation of web interface installation X-Git-Tag: 4.0~12 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/64ac73bb108b7858746281161f0450d2269fce7d More automation of web interface installation --- diff --git a/CHANGES.html b/CHANGES.html index 9cbcd90..8a39719 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -130,9 +130,10 @@ span.command { possible to use TCP to connect to an SMTP server. See sendmail and smtp_server in disorder_config(5).

-

The makefiles will now install the CGI automatically. If they cannot - figure out the location of the cgi-bin directory on your system, set - cgidir on the configure command line.

+

The web interface is now installed automatically. If you don't want it, + use ./configure --without-cgi. If you want it in a non-default + location, or no location for it is detected, set cgidir + and httpdir on the ./configure command line.

diff --git a/README b/README index 333b558..acd06ee 100644 --- a/README +++ b/README @@ -88,10 +88,10 @@ platform, please get in touch. --without-gtk Don't build GTK+ client (Disobedience) --without-python Don't build Python support - If configure cannot figure out where your CGI programs live, you must set - cgidir on the command line, e.g.: + If configure cannot guess where your web server keeps its HTML documents and + CGI programs, you may have to tell it, for instance: - ./configure cgidir=/whatever/cgi-bin + ./configure cgidir=/whatever/cgi-bin httpdir=/whatever/htdocs See README.client for setting up a standalone client (or read the disobedience man page). @@ -229,26 +229,15 @@ You need to configure a number of things to make this work: disorder setup-guest --no-online-registration -3. Make sure that DisOrder can find its icons and stylesheet. For example in - your web server configuration: - - Alias /disorder/ /usr/local/share/disorder/static/ - - Alternatively you could use a symlink from the right location in your - document root, provided your web server is configured to follow them. - - cd /var/www - ln -s /usr/local/share/disorder/static disorder - -4. Try it out. You should be able to perform read-only operations straight +3. Try it out. You should be able to perform read-only operations straight away, and after visiting the 'Login' page to authenticate, perform other operations like adding a track to the queue. -5. If you run into problems, always look at the appropriate error log; the +4. If you run into problems, always look at the appropriate error log; the message you see in your web browser will usually not be sufficient to diagnose the problem all by itself. -6. If you have a huge number of top level directories, then you might find +5. If you have a huge number of top level directories, then you might find that the 'Choose' page is unreasonably large. If so add the following line to /etc/disorder/options.user: label sidebar.choosewhich choosealpha diff --git a/configure.ac b/configure.ac index 3f4c0b0..f7956fd 100644 --- a/configure.ac +++ b/configure.ac @@ -178,12 +178,61 @@ if test $want_server = no; then want_cgi=no fi +# +# OS Document Root CGI directory +# == ============= ============= +# Debian /var/www /usr/lib/cgi-bin +# Ubuntu /var/www /usr/lib/cgi-bin +# Red Hat /var/www/html /var/www/cgi-bin +# or: /home/httpd/html/ /home/httpd/cgi-bin +# Slackware /var/www/htdocs (unknown) +# SuSE /srv/www/html /srv/www/cgi-bin +# Gentoo /var/www/localhost/htdocs /var/www/localhost/cgi-bin/ +# FreeBSD /usr/local/www/data /usr/local/www/cgi-bin +# or: /usr/local/www/???/data /usr/local/www/???/cgi-bin +# OS X /Library/WebServer/Documents /Library/WebServer/CGI-Executables +# Apache /usr/local/apache/htdocs (none) +# +# Sources: +# http://wiki.linuxquestions.org/wiki/Apache +# http://mapserver.gis.umn.edu/docs/howto/suse-linux +# http://www.yolinux.com/TUTORIALS/LinuxTutorialWebSiteConfig.html +# http://sources.gentoo.org/viewcvs.py/apache/trunk/dist/2.2/conf/vhosts.d/default_vhost.include?rev=198&view=log +# http://httpd.apache.org/docs/ +# if test $want_cgi = yes; then + if test -z "$httpdir"; then + AC_CACHE_CHECK([for httpd document root],[rjk_cv_httpdir],[ + rjk_cv_httpdir="not found" + for dir in /var/www/html \ + /var/www/htdocs \ + /var/www/localhost/htdocs \ + /var/www \ + /home/httpd/html \ + /srv/www/html \ + /usr/local/www/data \ + /usr/local/www/*/data \ + /Library/WebServer/Documents \ + /usr/local/apache/htdocs; do + if test -d "$dir"; then + rjk_cv_httpdir="$dir" + fi + done + ]) + if test "$rjk_cv_cgidir" = "not found"; then + AC_MSG_ERROR([cannot identify httpd documentroot. Set httpdir on configure command line]) + fi + httpdir="$rjk_cv_httpdir" + fi if test -z "$cgidir"; then AC_CACHE_CHECK([for CGI directory],[rjk_cv_cgidir],[ rjk_cv_cgidir="not found" for dir in /usr/lib/cgi-bin \ /Library/WebServer/CGI-Executables \ + /srv/www/cgi-bin \ + /var/www/cgi-bin \ + /home/httpd/cgi-bin \ + /var/www/localhost/cgi-bin \ /usr/local/lib/cgi-bin \ /usr/local/www/cgi-bin \ /usr/local/www/*/cgi-bin; do @@ -200,6 +249,11 @@ if test $want_cgi = yes; then fi fi AC_ARG_VAR([cgidir], [location of cgi-bin directory, e.g. /usr/lib/cgi-bin]) +AC_ARG_VAR([httpdir], [location of http document root, e.g. /var/www/htdocs]) +if test -z "$pkghttpdir"; then + pkghttpdir='$(httpdir)/disorder' +fi +AC_SUBST([pkghttpdir]) subdirs="scripts lib" if test $want_tests = yes; then diff --git a/debian/rules b/debian/rules index 865fb6e..000be81 100755 --- a/debian/rules +++ b/debian/rules @@ -18,8 +18,12 @@ # USA # +cgidir=/usr/lib/cgi-bin +httpdir=/var/www +browser=x-www-browser + # Options to configure. This can be overridden by the caller if necessary. -CONFIGURE=--prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --mandir=/usr/share/man --with-browser=x-www-browser cgidir=/usr/lib/cgi-bin +CONFIGURE=--prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --mandir=/usr/share/man --with-browser=$browser cgidir="${cgidir}" httpdir="${httpdir}" # Set DEB_BUILD_OPTIONS=noopt to produce a non-optimized build. ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) @@ -132,13 +136,13 @@ pkg-disorder-server: build $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \ fi;\ done - $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C images - $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C server - $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C templates - $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C driver - $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C plugins - $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C sounds - $(MAKE) DESTDIR=`pwd`/debian/disorder-server staticdir=/var/www/disorder installdirs install -C doc + $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C images + $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C server + $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C templates + $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C driver + $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C plugins + $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C sounds + $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C doc rm -rf debian/disorder-server/usr/share/man/man1 rm -rf debian/disorder-server/usr/share/man/man3 rm -f debian/disorder-server/usr/share/man/man5/disorder_config.5 diff --git a/images/Makefile.am b/images/Makefile.am index 7c77c85..88145b1 100644 --- a/images/Makefile.am +++ b/images/Makefile.am @@ -18,14 +18,12 @@ # USA # -static_DATA=cross.png down.png downdown.png edit.png nocross.png \ +pkghttp_DATA=cross.png down.png downdown.png edit.png nocross.png \ nodown.png nodowndown.png noup.png noupup.png tick.png up.png upup.png \ notes.png play.png pause.png random.png randomcross.png notescross.png \ propagate.png speaker.png speakercross.png directory.png logo.png \ logosmall.png -staticdir=${pkgdatadir}/static - -EXTRA_DIST=$(static_DATA) duck.png disobedience16x16.xpm disobedience32x32.xpm +EXTRA_DIST=$(pkghttp_DATA) duck.png disobedience16x16.xpm disobedience32x32.xpm CLEANFILES=$(SEDFILES) diff --git a/scripts/setup.in b/scripts/setup.in index 8c8b3b0..48f87c2 100755 --- a/scripts/setup.in +++ b/scripts/setup.in @@ -437,34 +437,13 @@ Mac ) launchctl load /Library/LaunchDaemons echo "Starting DisOrder server" launchctl start uk.org.greenend.rjk.disorder - DOCROOT=/Library/WebServer/Documents - sever_running=true + server_running=true ;; FreeBSD ) echo "Installing startup script into /etc/rc.d" install -m 555 examples/disorder.rc /etc/rc.d/disorder echo "Starting DisOrder server" /etc/rc.d/disorder start - echo "Identifying web server" - set /usr/local/www/* - case $# in - 0 ) - echo - echo "Could not find a web server" - exit 1 - ;; - 1 ) - ;; - * ) - echo - echo "Yikes! There seems to be more than one web server here." - echo "Guessing that you want $1." - echo - ;; - esac - web=$1 - echo "Found $web" - DOCROOT=$web/data server_running=true ;; Linux ) @@ -494,13 +473,6 @@ Linux ) echo "Starting DisOrder server" $RC_D/init.d/disorder start fi - echo "Looking for web server document root" - for d in /var/www/html /var/www; do - if [ -d $d ]; then - DOCROOT=$d - break - fi - done server_running=true ;; * ) @@ -511,15 +483,6 @@ Linux ) ;; esac -echo -if [ -z "$DOCROOT" ]; then - echo "Cannot find your web server's document root" -else - echo "Setting up link to CGI's dependencies in $DOCROOT" - rm -f $DOCROOT/disorder - ln -s pkgdatadir/static $DOCROOT/disorder -fi - if $server_running; then first=true sleep 5 diff --git a/templates/Makefile.am b/templates/Makefile.am index bf55c08..700b695 100644 --- a/templates/Makefile.am +++ b/templates/Makefile.am @@ -23,7 +23,6 @@ pkgdata_DATA=about.tmpl choose.tmpl playing.tmpl recent.tmpl \ new.tmpl login.tmpl macros.tmpl \ options options.labels \ options.columns -static_DATA=disorder.css -staticdir=${pkgdatadir}/static +pkghttp_DATA=disorder.css -EXTRA_DIST=${pkgdata_DATA} $(static_DATA) +EXTRA_DIST=${pkgdata_DATA} $(pkghttp_DATA)