/usr/sbin/mumble-django-configure is in mumble-django 2.13-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | #!/bin/sh
#
# Copyright (C) 2009, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
#
# Mumble-Django 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 package 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.
#
set -e
set -u
MUMBLE_DJANGO_INSTDIR="/usr/share/mumble-django"
MUMBLE_DJANGO_MUNIN="/etc/munin/plugins/mumble-django"
MURMUR_CONNSTR="Meta:tcp -h 127.0.0.1 -p 6502"
# Query dpkg-statoverride to find out the user MD is running as
if dpkg-statoverride --list /var/lib/mumble-django/mumble-django.db3
then
MUMBLE_DJANGO_USER=$(dpkg-statoverride --list /var/lib/mumble-django/mumble-django.db3 | cut -f1 '-d ')
else
MUMBLE_DJANGO_USER="www-data"
fi
echo "Welcome to mumble-django-configure!"
echo "-------------------------------------------"
if [ ! -z "$@" ]; then
echo " This script allows you to configure various aspects of Mumble-Django."
echo " It lets you detect new Mumble-Server instances, create new superuser"
echo " accounts and install or remove the Munin plugin."
echo " This script should at least be run once after installing the Mumble-"
echo " Django package, because it will create the initial database needed"
echo " in order to run."
echo
echo " Options: none - this script is meant to be run interactively. you will"
echo " be asked a series of questions after starting the script, and it will"
echo " act accordingly."
exit 1
fi
if [ ! -z "${MUMBLE_DJANGO_USER}" -a "${USER}" != "root" -a "${USER}" != "${MUMBLE_DJANGO_USER}" ]; then
echo " ERROR: If manage.py should be run as a different user, then"
echo " $0 must be run as that user or as root."
echo " Configuring Apache2 and Munin is only possible when running as root."
exit 1
fi
invoke_manage() {
if [ -z "${MUMBLE_DJANGO_USER}" -o "${USER}" = "${MUMBLE_DJANGO_USER}" ]; then
echo "Running as $USER: manage.py $@"
./pyweb/manage.py $@
else
echo "Running as ${MUMBLE_DJANGO_USER}: manage.py $@"
su "${MUMBLE_DJANGO_USER}" -s /bin/bash -c "./pyweb/manage.py $@"
fi
}
cd "${MUMBLE_DJANGO_INSTDIR}"
echo " What do you want to do?"
echo " > 1) Detect a new Mumble-Server instance and make it known to Mumble-Django"
echo " 2) Create a new SuperUser for Mumble-Django's web admin interface"
echo " Note: This will be done automatically when you run 1) for the first time."
echo " 3) Drop to a Python shell."
echo " 4) Drop to a Database shell."
read ACTION
if [ -z "$ACTION" -o "$ACTION" = "1" ]; then
echo " Mumble-Server detection"
echo " -----------------------"
echo " If this is the first time you run this script, you might want to probe for the"
echo " Debian default configuration instead of entering the service string yourself."
echo " Please choose what service string to use."
echo " > 1) Debian default ($MURMUR_CONNSTR)"
echo " 2) user defined"
read CHOICE
if [ -z "$CHOICE" -o "$CHOICE" = "1" ]; then
if [ "$USER" = "root" -a -x "/etc/init.d/mumble-server" ]; then
/usr/sbin/invoke-rc.d --quiet mumble-server start
fi
export MURMUR_CONNSTR
fi
invoke_manage syncdb
elif [ "$ACTION" = "2" ]; then
invoke_manage createsuperuser
elif [ "$ACTION" = "3" ]; then
# Not using invoke_manage here, because www-data can't start iPython and
# running the shell as root usually isn't a problem anyway.
./pyweb/manage.py shell
exit 0
elif [ "$ACTION" = "4" ]; then
invoke_manage dbshell
exit 0
fi
echo
if [ "$USER" = "root" ]; then
echo " Apache2"
echo " -----------------------"
echo " If you have changed any settings in settings.py, you should reload the Web server"
echo " in order for the changes to take effect. Do you want to reload Apache2 now?"
echo " 1) Yes, reload Apache2."
echo " > 2) No, don't do anything."
read ACTION
if [ "$ACTION" = "1" ]; then
/usr/sbin/invoke-rc.d apache2 reload
fi
echo
echo " Munin"
echo " -----------------------"
if [ -x "/etc/init.d/munin-node" ]; then
if [ -x "${MUMBLE_DJANGO_MUNIN}" ]; then
echo " The Munin plugin is currently installed. Do you wish to uninstall it?"
echo " 1) Yes, uninstall it."
echo " > 2) No, don't do anything."
read ACTION
if [ "$ACTION" = "1" ]; then
rm "${MUMBLE_DJANGO_MUNIN}"
invoke-rc.d munin-node restart
fi
else
echo " Mumble-Django ships with a Munin plugin, and you appear to have Munin-Node installed."
echo " Probing now if installing the plugin is advised..."
echo -n " "
./munin.py autoconf
echo
echo " Do you want to install the Munin plugin?"
echo " 1) Yes, install it."
echo " > 2) No, don't do anything."
read ACTION
if [ "$ACTION" = "1" ]; then
ln -s "${MUMBLE_DJANGO_INSTDIR}/munin.py" "${MUMBLE_DJANGO_MUNIN}"
invoke-rc.d munin-node restart
fi
fi
else
echo " You do not appear to have Munin-Node installed, skipping."
fi
else
echo " Configuring Apache2 and Munin is only possible when running as root."
fi
echo
echo "Running a few checks..."
invoke_manage checkenv
echo "Goodbye."
|