diff --git a/README b/README index 8ab9846b4..5a270bddf 100644 --- a/README +++ b/README @@ -100,7 +100,8 @@ Important: "use_your_own" is a password and you have to use the same value here ./manage.py init_db 4) install init scripts and start daemons - cp /srv/pandora/etc/init/*.conf /etc/init/ + + /srv/pandora/ctl install /srv/pandora/ctl start 5) Setup Webserver diff --git a/ctl b/ctl index 6b38ccf97..6e51f615c 100755 --- a/ctl +++ b/ctl @@ -9,6 +9,25 @@ if [ `whoami` != 'root' ]; then echo you have to be root or run $0 with sudo exit 1 fi +if [ "$action" = "install" ]; then + cd "`dirname "$0"`" + BASE=`pwd` + if [ -x /bin/systemctl ]; then + if [ -d /lib/systemd/system/ ]; then + cp $BASE/etc/systemd/*.service /lib/systemd/system/ + cp $BASE/etc/tmpfiles.d/pandora.conf /usr/lib/tmpfiles.d/ + systemd-tmpfiles --create /usr/lib/tmpfiles.d/pandora.conf >/dev/null || true + for service in pandora pandora-tasks pandora-encoding pandora-cron; do + systemctl enable ${service}.service + done + fi + else + if [ -d /etc/init ]; then + cp $BASE/etc/init/* /etc/init/ + fi + fi + exit 0 +fi for service in pandora pandora-tasks pandora-encoding pandora-cron; do service $service $action done diff --git a/vm/firstboot.sh b/vm/firstboot.sh index 94f0aa101..2f60e30a1 100755 --- a/vm/firstboot.sh +++ b/vm/firstboot.sh @@ -122,19 +122,12 @@ echo "UPDATE django_site SET domain = '$HOST.local', name = '$HOST.local' WHERE mkdir /srv/pandora/data chown -R pandora:pandora /srv/pandora -if [ "$SYSTEMD" == "yes" ]; then - cp /srv/pandora/etc/systemd/*.service /lib/systemd/system/ - cp /srv/pandora/etc/tmpfiles.d/pandora.conf /usr/lib/tmpfiles.d/ - if [ "$LXC" == "yes" ]; then +/srv/pandora/ctl install + +if [ "$LXC" == "yes" ]; then + if [ "$SYSTEMD" == "yes" ]; then sed -i s/127.0.0.1/0.0.0.0/g /lib/systemd/system/pandora.service - fi - systemd-tmpfiles --create /usr/lib/tmpfiles.d/pandora.conf >/dev/null || true - for service in pandora pandora-tasks pandora-encoding pandora-cron; do - systemctl enable ${service}.service - done -else - cp /srv/pandora/etc/init/* /etc/init/ - if [ "$LXC" == "yes" ]; then + else sed -i s/127.0.0.1/0.0.0.0/g /etc/init/pandora.conf fi fi