reuse sudo code, install pandoractl

This commit is contained in:
j 2020-05-30 17:44:49 +02:00
parent 4e952c3746
commit 5f9a2b9879

13
ctl
View file

@ -49,15 +49,15 @@ if [ "$action" = "init" ]; then
fi fi
if [ "$action" = "manage" ]; then if [ "$action" = "manage" ]; then
cd "`dirname "$self"`" cd "`dirname "$self"`"
if [ `whoami` != 'root' ]; then BASE=`pwd`
manage="./pandora/manage.py" SUDO=""
else PANDORA_USER=`ls -l update.py | cut -f3 -d" "`
manage="sudo -u pandora ./pandora/manage.py" if [ `whoami` != $PANDORA_USER ]; then
SUDO="sudo -H -u $PANDORA_USER"
fi fi
shift shift
$manage $@ $SUDO $BASE/pandora/manage.py $@
exit $? exit $?
fi fi
if [ `whoami` != 'root' ]; then if [ `whoami` != 'root' ]; then
echo you have to be root or run $0 with sudo echo you have to be root or run $0 with sudo
@ -83,6 +83,7 @@ if [ "$action" = "install" ]; then
systemctl enable ${service}.service systemctl enable ${service}.service
done done
fi fi
test -e /usr/local/bin/pandoractl || ln -s /srv/pandora/ctl /usr/local/bin/pandoractl
else else
if [ -d /etc/init ]; then if [ -d /etc/init ]; then
cp $BASE/etc/init/* /etc/init/ cp $BASE/etc/init/* /etc/init/