From 06638b8da63effe8cc24af0a6a13745583262dcf Mon Sep 17 00:00:00 2001 Message-Id: <06638b8da63effe8cc24af0a6a13745583262dcf.1715508500.git.mdw@distorted.org.uk> From: Mark Wooding Date: Tue, 15 Jan 2008 19:17:48 +0000 Subject: [PATCH] New examples/disorder.rc is an /etc/rc.d script for FreeBSD. Finish FreeBSD parts of scripts/setup. Organization: Straylight/Edgeware From: Richard Kettlewell There is also scripts/teardown to undo scripts/setup, but that is intended for debugging scripts/setup, not for production use, so we don't advertize it anywhere. --- .bzrignore | 2 ++ README.freebsd | 19 ++++++------------- examples/Makefile.am | 8 ++++---- examples/disorder.rc.in | 34 ++++++++++++++++++++++++++++++++++ scripts/Makefile.am | 6 +++--- scripts/setup.in | 34 +++++++++++++++++++++++++++++++++- scripts/teardown.in | 41 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 123 insertions(+), 21 deletions(-) create mode 100755 examples/disorder.rc.in create mode 100755 scripts/teardown.in diff --git a/.bzrignore b/.bzrignore index cccfd75..9fda4fa 100644 --- a/.bzrignore +++ b/.bzrignore @@ -143,3 +143,5 @@ tests/disorder-udplog lib/version-string lib/version.h scripts/setup +examples/disorder.rc +scripts/teardown diff --git a/README.freebsd b/README.freebsd index a9a28de..3a7bc7b 100644 --- a/README.freebsd +++ b/README.freebsd @@ -6,17 +6,10 @@ its dependencies. It is not well tested in this environment. In particular, since my FreeBSD VM lacks sound support, only network play has been tested. Please report successes and failures! -Use gmake to build DisOrder, not BSD make. +Use gmake to build DisOrder, not BSD make: + ./configure + gmake + sudo gmake install - -Things you will need to do: - -* Create the jukebox user and group - - sudo pw groupadd -n jukebox - sudo pw useradd -n jukebox - sudo pw groupmod jukebox -m jukebox - -* Arrange for the server to start at boot time - -* Start the server +Then to set up: + sudo scripts/setup diff --git a/examples/Makefile.am b/examples/Makefile.am index 529fde0..6265895 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,6 +1,6 @@ # # This file is part of DisOrder. -# Copyright (C) 2004, 2005 Richard Kettlewell +# Copyright (C) 2004, 2005, 2008 Richard Kettlewell # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,13 +18,13 @@ # USA # -noinst_SCRIPTS=disorder.init +noinst_SCRIPTS=disorder.init disorder.rc noinst_DATA=config.sample -SEDFILES=disorder.init config.sample +SEDFILES=disorder.init config.sample disorder.rc include ${top_srcdir}/scripts/sedfiles.make -EXTRA_DIST=disorder.init.in config.sample.in disorder-log +EXTRA_DIST=disorder.init.in config.sample.in disorder-log disorder.rc.in CLEANFILES=$(SEDFILES) diff --git a/examples/disorder.rc.in b/examples/disorder.rc.in new file mode 100755 index 0000000..e3bb90f --- /dev/null +++ b/examples/disorder.rc.in @@ -0,0 +1,34 @@ +#! /bin/sh +# +# This file is part of DisOrder. +# Copyright (C) 2008 Richard Kettlewell +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA + +# PROVIDE: disorder +# REQUIRE: DAEMON + +. /etc/rc.subr + +name=disorder +pidfile=/var/run/disorderd.pid +procname=disorderd +command=sbindir/disorderd +command_args="--pidfile $pidfile" + +load_rc_config $name +run_rc_command "$1" + diff --git a/scripts/Makefile.am b/scripts/Makefile.am index d79d8d2..620c8f4 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -19,13 +19,13 @@ # dist_pkgdata_DATA=completion.bash -noinst_SCRIPTS=setup +noinst_SCRIPTS=setup teardown -SEDFILES=setup +SEDFILES=setup teardown include ${top_srcdir}/scripts/sedfiles.make EXTRA_DIST=htmlman sedfiles.make text2c oggrename make-unidata \ - format-gcov-report make-version-string setup.in + format-gcov-report make-version-string setup.in teardown.in CLEANFILES=$(SEDFILES) diff --git a/scripts/setup.in b/scripts/setup.in index 8348724..991b060 100755 --- a/scripts/setup.in +++ b/scripts/setup.in @@ -240,12 +240,44 @@ Mac ) launchctl start uk.org.greenend.rjk.disorder echo "Installing CGI" install -m 555 server/disorder.cgi /Library/WebServer/CGI-Executables/disorder - echo "Setting up link to CGI;'s dependencies" + echo "Setting up link to CGI's dependencies" rm -f /Library/WebServer/Documents/disorder ln -s pkgdatadir/static /Library/WebServer/Documents/disorder echo echo "You must sudo disorder setup-guest [--no-online-registration] next." ;; +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" + echo "Installing CGI" + install -m 555 server/disorder.cgi $web/cgi-bin/disorder + echo "Setting up link to CGI's dependencies" + rm -f $web/data/disorder + ln -s pkgdatadir/static $web/data/disorder + echo + echo "You must sudo disorder setup-guest [--no-online-registration] next." + ;; * ) echo "Sorry, I don't know how to install the server on this platform." echo "You will have to do that by hand." diff --git a/scripts/teardown.in b/scripts/teardown.in new file mode 100755 index 0000000..b9361b9 --- /dev/null +++ b/scripts/teardown.in @@ -0,0 +1,41 @@ +#! /bin/bash +# +# This file is part of DisOrder +# Copyright (C) 2008 Richard Kettlewell +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA +# +set -e + +case $(uname -s) in +FreeBSD ) + APACHE=apache22 + echo "* killing disorderd processes" + killall disorderd || true + echo "* removing files" + rm -f /usr/local/www/$APACHE/cgi-bin/disorder + rm -f /usr/local/www/$APACHE/data/disorder + rm -f /etc/rc.d/disorder + rm -rf pkgstatedir + rm -rf pkgconfdir + echo "* removing user and group" + pw groupdel jukebox || true + pw userdel jukebox || true + ;; +* ) + echo Unknown operating system >&2 + exit 1 +esac -- [mdw]