From 62f4252b09cb72f39c7ea1f2bee324585563a094 Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Tue, 21 Jun 2016 18:01:06 -0700 Subject: [PATCH] Updates for RPI instal --- Makefile | 6 +++++- scripts/bbctrl.init.d | 5 +++-- setup.py | 2 +- src/py/bbctrl/__init__.py | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) mode change 100644 => 100755 scripts/bbctrl.init.d diff --git a/Makefile b/Makefile index 87e7417..593a920 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,11 @@ WATCH := src/jade src/jade/templates src/stylus src/js src/resources Makefile all: html css js static copy: all - cp -r *.py inevent $(TARGET)/ $(DEST) + mkdir -p $(DEST)/bbctrl/src/py $(DEST)/bbctrl/build + rsync -rLv --no-g --exclude \*.pyc --exclude __pycache__ \ + --exclude \*.egg-info src/py $(DEST)/bbctrl/src/ + rsync -av --no-g build/http $(DEST)/bbctrl/build + rsync -av --no-g setup.py README.md $(DEST)/bbctrl mount: mkdir -p $(DEST) diff --git a/scripts/bbctrl.init.d b/scripts/bbctrl.init.d old mode 100644 new mode 100755 index b7a0fb6..01f356a --- a/scripts/bbctrl.init.d +++ b/scripts/bbctrl.init.d @@ -10,11 +10,11 @@ # Description: Buildbotics Controller Web service ### END INIT INFO -DAEMON=/home/bbmc/bbctrl.py +DAEMON=/usr/local/bin/bbctrl DAEMON_NAME=bbctrl DAEMON_OPTS="" DAEMON_USER=root -DAEMON_DIR=$(dirname $DAEMON) +DAEMON_DIR=/var/lib/$DAEMON_NAME PIDFILE=/var/run/$DAEMON_NAME.pid . /lib/lsb/init-functions @@ -22,6 +22,7 @@ PIDFILE=/var/run/$DAEMON_NAME.pid do_start () { log_daemon_msg "Starting system $DAEMON_NAME daemon" + mkdir -p $DAEMON_DIR && start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile \ --user $DAEMON_USER --chuid $DAEMON_USER --chdir $DAEMON_DIR \ --startas /bin/bash -- \ diff --git a/setup.py b/setup.py index f0a591e..0028528 100755 --- a/setup.py +++ b/setup.py @@ -22,5 +22,5 @@ setup( ] }, install_requires = 'tornado sockjs-tornado pyserial smbus2'.split(), - zip_save = False, + zip_safe = False, ) diff --git a/src/py/bbctrl/__init__.py b/src/py/bbctrl/__init__.py index 25c5caf..ba0e6be 100755 --- a/src/py/bbctrl/__init__.py +++ b/src/py/bbctrl/__init__.py @@ -129,7 +129,7 @@ class LoadHandler(APIHandler): self.send_file('config.json') except Exception as e: print(e) - self.send_file('http/default-config.json') + self.send_file(get_resource('http/default-config.json')) class SaveHandler(APIHandler): @@ -273,7 +273,7 @@ handlers = [ (r'/api/save', SaveHandler), (r'/api/file(/.*)?', FileHandler), (r'/(.*)', web.StaticFileHandler, - {'path': os.path.join(DIR, 'http/'), + {'path': os.path.join(DIR, get_resource('http/')), "default_filename": "index.html"}), ] -- 2.27.0