chiark / gitweb /
Thinko in menu option l-)
[disorder] / scripts / teardown.in
index 63df4eb166e60c8182c4a062a68791271d66e7ab..39b34f27903b1b33ad9e37e90953cd0249c2e3d7 100755 (executable)
@@ -3,52 +3,63 @@
 # This file is part of DisOrder
 # Copyright (C) 2008 Richard Kettlewell
 #
-# This program is free software; you can redistribute it and/or modify
+# 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
+# the Free Software Foundation, either version 3 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.
-#
+# 
+# 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
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 set -e
 
+s() {
+  echo ">" "$@"
+  "$@"
+}
+
 case $(uname -s) in
 FreeBSD )
   APACHE=apache22
   echo "* killing disorderd processes"
-  killall disorderd || true
+  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
+  s rm -f /etc/rc.d/disorder
+  s rm -rf pkgstatedir
+  s rm -rf pkgconfdir
   echo "* removing user and group"
-  pw userdel jukebox || true
-  pw groupdel jukebox || true
+  pw userdel jukebox || true
+  pw groupdel jukebox || true
   ;;
 Darwin )
   echo "* stopping server"
-  launchctl stop uk.org.greenend.rjk.disorder || true
-  launchctl unload /Library/LaunchDaemons/uk.org.greenend.rjk.disorder.plist || true
+  s launchctl stop uk.org.greenend.rjk.disorder || true
+  s launchctl unload /Library/LaunchDaemons/uk.org.greenend.rjk.disorder.plist || true
+  echo "* removing files"
+  s rm -f /Library/LaunchDaemons/uk.org.greenend.rjk.disorder.plist
+  s rm -rf pkgstatedir
+  s rm -rf pkgconfdir
+  echo "* removing user and group"
+  s dscl . -delete /Users/jukebox || true
+  s dscl . -delete /Groups/jukebox || true
+  ;;
+Linux )
+  echo "* stopping server"
+  s killall disorderd || true
   echo "* removing files"
-  rm -f /Library/WebServer/CGI-Executables/disorder
-  rm -f /Library/WebServer/Documents/disorder
-  rm -f /Library/LaunchDaemons/uk.org.greenend.rjk.disorder.plist
-  rm -rf pkgstatedir
-  rm -rf pkgconfdir
+  s rm -f /etc/init.d/disorder /etc/rc.d/init.d/disorder
+  s rm -f /etc/rc*.d/*disorder /etc/rc.d/rc*.d/disorder
+  s rm -rf pkgstatedir
+  s rm -rf pkgconfdir
   echo "* removing user and group"
-  dscl / -delete /Users/jukebox || true
-  dscl / -delete /Groups/jukebox || true
-  ;;  
+  s userdel jukebox || true
+  s groupdel jukebox || true
+  ;;
 * )
   echo Unknown operating system >&2
   exit 1