chiark / gitweb /
Finish off Mac support in scripts/setup.
authorRichard Kettlewell <rjk@greenend.org.uk>
Wed, 16 Jan 2008 20:54:27 +0000 (20:54 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Wed, 16 Jan 2008 20:54:27 +0000 (20:54 +0000)
Update README for supported platforms.  I'm not happy with this quite
yet.

README
README.freebsd
README.mac
examples/uk.org.greenend.rjk.disorder.plist.in
scripts/setup.in
scripts/teardown.in

diff --git a/README b/README
index f0f67ea32f9ba1139d4c66684e7f841d06768a94..3c01bddcaede4aa78f8f5414b889b6723a76e53f 100644 (file)
--- a/README
+++ b/README
@@ -53,19 +53,31 @@ Mailing lists:
 
 Developers should read README.developers.
 
 
 Developers should read README.developers.
 
+Installation (supported platforms)
+==================================
 
 
-Installation
-============
+If you are upgrading from an earlier version, see README.upgrades.
+
+For Debian and Ubuntu, you are best of using .deb files, either download from
+www.greenend.org.uk or built locally with 'fakeroot debian/rules binary'.  They
+will do the majority of the setup for you, using a debconf interface to collect
+details about your system.
+
+For FreeBSD, see README.freebsd (in conjunction with the notes below) and use
+scripts/setup.
+
+For Mac OS X, see README.mac (in conjunction with the notes below) and use
+scripts/setup.
+
+
+Installation (generic)
+======================
 
    "This place'd be a paradise tomorrow, if every department had a supervisor
    with a machine-gun"
 
 IMPORTANT: If you are upgrading from an earlier version, see README.upgrades.
 
 
    "This place'd be a paradise tomorrow, if every department had a supervisor
    with a machine-gun"
 
 IMPORTANT: If you are upgrading from an earlier version, see README.upgrades.
 
-On a Debian or Ubuntu system, if you install from .deb files then you should be
-able to skip steps 1 to 6 and configure it via debconf.  This is strongly
-recommended!
-
 1. Build the software.  Do something like this:
 
      ./configure --sysconfdir=/etc --localstatedir=/var
 1. Build the software.  Do something like this:
 
      ./configure --sysconfdir=/etc --localstatedir=/var
index 3a7bc7b4885d015dd609f6b24a8e2ec41b9f1350..ac38e773325ad6ed9d9bde1e4a2ffea1cad1e027 100644 (file)
@@ -4,12 +4,17 @@ DisOrder on FreeBSD
 The server builds on FreeBSD, using the ports system to supply many of
 its dependencies.  It is not well tested in this environment.  In
 particular, since my FreeBSD VM lacks sound support, only network play
 The server builds on FreeBSD, using the ports system to supply many of
 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!
+has been tested.
+
+You must use gmake to build DisOrder.
+
+After installation you can use scripts/setup to install the server
+(creating a 'jukebox' user, etc).
 
 
-Use gmake to build DisOrder, not BSD make:
   ./configure
   gmake
   sudo gmake install
   ./configure
   gmake
   sudo gmake install
-
-Then to set up:
   sudo scripts/setup
   sudo scripts/setup
+  sudo disorder setup-guest [--no-online-registration]
+
+Please report successes and failures!
index f49c3c4cce50a6f1e0c17318329195c755144f58..478954d14c958159d7fdf9783da5b91918597b4d 100644 (file)
@@ -2,17 +2,15 @@ DisOrder on OS X
 ================
 
 The server builds on OS X, using Fink to supply many of its
 ================
 
 The server builds on OS X, using Fink to supply many of its
-dependencies.  It is not well tested in this environment.  Please
-report successes and failures!
+dependencies.  It is not well tested in this environment.
 
 
-There is an EXPERIMENTAL script in scripts/setup which asks a few
-questions, sets up a basic installation and starts the server.  To use
-it, after having done 'sudo make install', just do 'sudo
-scripts/setup' and follow the prompts.
+After installation you can use scripts/setup to install the server
+(creating a 'jukebox' user, etc).
 
 
-Its current main deficiences are:
-   - it uses the 'daemon' user/group instead of creating a 'jukebox'
-     identity.
-   - the launchd configuration does not have the server started at
-     boot time.  You must start it manually.  This may be changed in a
-     future version.
+  ./configure
+  make
+  sudo make install
+  sudo scripts/setup
+  sudo disorder setup-guest [--no-online-registration]
+
+Please report successes and failures!
index 3b753ef1c28c01183e2b6afa9ed4b43cee88950a..c41e591a2f3881469d344fccb9a0bcf7d284983f 100644 (file)
@@ -19,7 +19,7 @@
        </array>
        <key>WorkingDirectory</key>
        <string>pkgstatedir</string>
        </array>
        <key>WorkingDirectory</key>
        <string>pkgstatedir</string>
-<!--   <key>RunAtLoad</key> -->
-<!--   <true/> -->
+       <key>RunAtLoad</key>
+       <true/>
 </dict>
 </plist>
 </dict>
 </plist>
index d3d6a48038a9a9127aab69d2898aa6a63a8d3a51..370013eba9f30fe7d7b378a3a1a7256b04b85a27 100755 (executable)
@@ -29,9 +29,8 @@ case $(uname -s) in
 Darwin )
   echo "Mac OS X detected"
   os=Mac
 Darwin )
   echo "Mac OS X detected"
   os=Mac
-  # TODO we should use jukebox and create it if necessary; see below
-  user=daemon
-  group=daemon
+  user=jukebox
+  group=jukebox
   ;;
 FreeBSD )
   echo "FreeBSD detected"
   ;;
 FreeBSD )
   echo "FreeBSD detected"
@@ -191,11 +190,60 @@ if [ ! -f pkgconfdir/options.user ]; then
   touch pkgconfdir/options.user
 fi
 
   touch pkgconfdir/options.user
 fi
 
+# pick ID1 ID2 ... IDn
+# Echoes an ID matching none of ID1..IDn
+pick() {
+  local n
+  n=250                                # better not choose 0!
+  while :; do
+    ok=true
+    for k in "$@"; do
+      if [ $n = $k ]; then
+        ok=false
+        break
+      fi
+    done
+    if $ok; then
+      echo $n
+      return
+    fi
+    n=$((1+$n))
+  done
+}
+
 case $os in
 Mac )
 case $os in
 Mac )
-  # TODO niutil?
+  # Apple don't seem to believe in creating a user as a discrete operation
+  if dscl / -read /Groups/$group >/dev/null 2>&1; then
+    echo "$group group already exists"
+  else
+    echo "Creating $group group"
+    gids=$(dscl / -list /Groups PrimaryGroupID|awk '{print $2}')
+    gid=$(pick $gids)
+    echo "(picked gid $gid)"
+    dscl / -create /Groups/$group
+    dscl / -create /Groups/$group PrimaryGroupID $gid
+    dscl / -create /Groups/$group Password \*
+  fi
+  if dscl / -read /Users/$user >/dev/null 2>&1; then
+    echo "$user user already exists"
+  else
+    echo "Creating $user user"
+    uids=$(dscl / -list /Users UniqueID|awk '{print $2}')
+    uid=$(pick $uids)
+    echo "(picked uid $uid)"
+    gid=$(dscl / -read /Groups/$group PrimaryGroupID | awk '{print $2}')
+    dscl / -create /Users/$user
+    dscl / -create /Users/$user UniqueID $uid
+    dscl / -create /Users/$user UserShell /usr/bin/false
+    dscl / -create /Users/$user RealName 'DisOrder server'
+    dscl / -create /Users/$user NFSHomeDirectory pkgstatedir
+    dscl / -create /Users/$user PrimaryGroupID $gid
+    dscl / -create /Users/$user Password \*
+  fi
   ;;
 FreeBSD )
   ;;
 FreeBSD )
+  # FreeBSD has a simple well-documented interface
   if pw groupshow $group >/dev/null 2>&1; then
     echo "$group group already exists"
   else
   if pw groupshow $group >/dev/null 2>&1; then
     echo "$group group already exists"
   else
index dbf593cd6aa939b14590f830a04b8c891337d9b1..63df4eb166e60c8182c4a062a68791271d66e7ab 100755 (executable)
@@ -32,8 +32,8 @@ FreeBSD )
   rm -rf pkgstatedir
   rm -rf pkgconfdir
   echo "* removing user and group"
   rm -rf pkgstatedir
   rm -rf pkgconfdir
   echo "* removing user and group"
-  pw groupdel jukebox || true
   pw userdel jukebox || true
   pw userdel jukebox || true
+  pw groupdel jukebox || true
   ;;
 Darwin )
   echo "* stopping server"
   ;;
 Darwin )
   echo "* stopping server"
@@ -45,6 +45,9 @@ Darwin )
   rm -f /Library/LaunchDaemons/uk.org.greenend.rjk.disorder.plist
   rm -rf pkgstatedir
   rm -rf pkgconfdir
   rm -f /Library/LaunchDaemons/uk.org.greenend.rjk.disorder.plist
   rm -rf pkgstatedir
   rm -rf pkgconfdir
+  echo "* removing user and group"
+  dscl / -delete /Users/jukebox || true
+  dscl / -delete /Groups/jukebox || true
   ;;  
 * )
   echo Unknown operating system >&2
   ;;  
 * )
   echo Unknown operating system >&2