| 1 | #! /bin/bash |
| 2 | # |
| 3 | # This file is part of DisOrder |
| 4 | # Copyright (C) 2008 Richard Kettlewell |
| 5 | # |
| 6 | # This program is free software: you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation, either version 3 of the License, or |
| 9 | # (at your option) any later version. |
| 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 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | # |
| 19 | set -e |
| 20 | |
| 21 | s() { |
| 22 | echo ">" "$@" |
| 23 | "$@" |
| 24 | } |
| 25 | |
| 26 | case $(uname -s) in |
| 27 | FreeBSD ) |
| 28 | APACHE=apache22 |
| 29 | echo "* killing disorderd processes" |
| 30 | s killall disorderd || true |
| 31 | echo "* removing files" |
| 32 | s rm -f /etc/rc.d/disorder |
| 33 | s rm -rf pkgstatedir |
| 34 | s rm -rf pkgconfdir |
| 35 | echo "* removing user and group" |
| 36 | s pw userdel jukebox || true |
| 37 | s pw groupdel jukebox || true |
| 38 | ;; |
| 39 | Darwin ) |
| 40 | echo "* stopping server" |
| 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" |
| 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" |
| 48 | s dscl . -delete /Users/jukebox || true |
| 49 | s dscl . -delete /Groups/jukebox || true |
| 50 | ;; |
| 51 | Linux ) |
| 52 | echo "* stopping server" |
| 53 | s killall disorderd || true |
| 54 | echo "* removing files" |
| 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 |
| 59 | echo "* removing user and group" |
| 60 | s userdel jukebox || true |
| 61 | s groupdel jukebox || true |
| 62 | ;; |
| 63 | * ) |
| 64 | echo Unknown operating system >&2 |
| 65 | exit 1 |
| 66 | esac |