diff --git a/ctl b/ctl index bd789644..1b93c214 100755 --- a/ctl +++ b/ctl @@ -1,17 +1,13 @@ #!/bin/sh SERVICES="pandora pandora-tasks pandora-encoding pandora-cron pandora-websocketd" if [ -z "$1" ]; then - echo "Usage: $0 (start|stop|restart|reload|status)" + echo "Usage: $0 (start|stop|restart|reload)" exit 1 else action="$1" fi -self=`readlink "$0"` -if [ -z $self ]; then - self="$0" -fi if [ "$action" = "init" ]; then - cd "`dirname "$self"`" + cd "`dirname "$0"`" BASE=`pwd` SUDO="" PANDORA_USER=`ls -l update.py | cut -f3 -d" "` @@ -47,18 +43,6 @@ if [ "$action" = "init" ]; then fi exit 0 fi -if [ "$action" = "manage" ]; then - cd "`dirname "$self"`" - if [ `whoami` != 'root' ]; then - manage="./pandora/manage.py" - else - manage="sudo -u pandora ./pandora/manage.py" - fi - shift - $manage $@ - exit $? - -fi if [ `whoami` != 'root' ]; then echo you have to be root or run $0 with sudo exit 1 @@ -90,13 +74,6 @@ if [ "$action" = "install" ]; then fi exit 0 fi -if [ "status" = "$action" ]; then - export SYSTEMD_PAGER= -fi for service in $SERVICES; do - if [ -x /bin/systemctl ]; then - /bin/systemctl $action $service - else - service $service $action - fi + service $service $action done diff --git a/pandora/user/utils.py b/pandora/user/utils.py index 86a21ae1..808aaa69 100644 --- a/pandora/user/utils.py +++ b/pandora/user/utils.py @@ -1,4 +1,4 @@ -from django.contrib.gis.geoip2 import GeoIP, GeoIP2Exception2 +from django.contrib.gis.geoip2 import GeoIP2 import ox @@ -22,7 +22,7 @@ def get_location(ip): else: try: location = g.city(ip) - except GeoIP2Exception: + except django.contrib.gis.geoip2.GeoIP2Exception: try: location = g.country(s.ip) except: diff --git a/update.py b/update.py index bfa0a019..2c1de756 100755 --- a/update.py +++ b/update.py @@ -297,7 +297,7 @@ if __name__ == "__main__": ]: run_sql(sql) run(join(base, 'pandora/manage.py'), 'migrate', 'system') - run(join(base, 'pandora/manage.py'), 'update_geoip') + else: if len(sys.argv) == 1: branch = get_branch() @@ -316,13 +316,13 @@ if __name__ == "__main__": if exists(path): os.chdir(path) current_branch = get_branch(path) + if current_branch != branch: + run('git', 'remote', 'set-branches', 'origin', '*') + run('git', 'fetch', 'origin') + run('git', 'checkout', branch) + revno = get_version(path) if repo == 'pandora': pandora_old_revno = revno - if current_branch != branch: - run('git', 'remote', 'set-branches', 'origin', '*') - run('git', 'fetch', 'origin') - run('git', 'checkout', branch) - revno = get_version(path) current += revno url = repos[repo]['url'] print('Checking', repo) diff --git a/vm/pandora_install.sh b/vm/pandora_install.sh index ec77d3b0..65d776c2 100755 --- a/vm/pandora_install.sh +++ b/vm/pandora_install.sh @@ -12,7 +12,7 @@ NGINX=${NGINX-local} BRANCH=${BRANCH-stable} # add a pandora user -echo Installing pandora with user: $PANDORA branch: $BRANCH +echo Installing pandora with user: $PANDORA getent passwd $PANDORA > /dev/null 2>&1 || adduser --disabled-password --gecos "" $PANDORA # @@ -197,9 +197,8 @@ fi if [ "$NGINX" == "local" ]; then cp "/srv/pandora/etc/nginx/pandora" "/etc/nginx/sites-available/pandora" -rm -f /etc/nginx/sites-enabled/default /etc/nginx/sites-enabled/pandora +rm -f /etc/nginx/sites-enabled/default ln -s ../sites-available/pandora /etc/nginx/sites-enabled/pandora -ln -s /srv/pandora/ctl /usr/local/bin/pandoractl read -r -d '' GZIP <