chiark / gitweb /
Most of intro section
[disorder] / scripts / teardown.in
CommitLineData
06638b8d
RK
1#! /bin/bash
2#
3# This file is part of DisOrder
4# Copyright (C) 2008 Richard Kettlewell
5#
e7eb3a27 6# This program is free software: you can redistribute it and/or modify
06638b8d 7# it under the terms of the GNU General Public License as published by
e7eb3a27 8# the Free Software Foundation, either version 3 of the License, or
06638b8d 9# (at your option) any later version.
e7eb3a27
RK
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
06638b8d 16# You should have received a copy of the GNU General Public License
e7eb3a27 17# along with this program. If not, see <http://www.gnu.org/licenses/>.
06638b8d
RK
18#
19set -e
20
ce195bb5
RK
21s() {
22 echo ">" "$@"
23 "$@"
24}
25
06638b8d
RK
26case $(uname -s) in
27FreeBSD )
28 APACHE=apache22
29 echo "* killing disorderd processes"
ce195bb5 30 s killall disorderd || true
06638b8d 31 echo "* removing files"
ce195bb5
RK
32 s rm -f /etc/rc.d/disorder
33 s rm -rf pkgstatedir
34 s rm -rf pkgconfdir
06638b8d 35 echo "* removing user and group"
ce195bb5
RK
36 s pw userdel jukebox || true
37 s pw groupdel jukebox || true
06638b8d 38 ;;
244348f8
RK
39Darwin )
40 echo "* stopping server"
ce195bb5
RK
41 s launchctl stop uk.org.greenend.rjk.disorder || true
42 s launchctl unload /Library/LaunchDaemons/uk.org.greenend.rjk.disorder.plist || true
43 echo "* removing files"
ce195bb5
RK
44 s rm -f /Library/LaunchDaemons/uk.org.greenend.rjk.disorder.plist
45 s rm -rf pkgstatedir
46 s rm -rf pkgconfdir
47 echo "* removing user and group"
d7b0c55c
RK
48 s dscl . -delete /Users/jukebox || true
49 s dscl . -delete /Groups/jukebox || true
ce195bb5
RK
50 ;;
51Linux )
52 echo "* stopping server"
53 s killall disorderd || true
244348f8 54 echo "* removing files"
ce195bb5
RK
55 s rm -f /etc/init.d/disorder /etc/rc.d/init.d/disorder
56 s rm -f /etc/rc*.d/*disorder /etc/rc.d/rc*.d/disorder
57 s rm -rf pkgstatedir
58 s rm -rf pkgconfdir
d255d211 59 echo "* removing user and group"
ce195bb5
RK
60 s userdel jukebox || true
61 s groupdel jukebox || true
62 ;;
06638b8d
RK
63* )
64 echo Unknown operating system >&2
65 exit 1
66esac