added Makefile for creating releases

This commit is contained in:
Simon Pirkelmann 2021-03-13 17:42:52 +01:00
parent d0084e0de7
commit 39bea22251
2 changed files with 25 additions and 1 deletions

24
Makefile Normal file
View File

@ -0,0 +1,24 @@
VERSION ?= $(shell git rev-parse --short HEAD)
release: door_admin_v$(VERSION).tar.gz
TEMPLATE_FILES = $(shell find -name '*.html')
STATIC_FILES = $(shell find -name '*.png' -o -name '*.js')
PYTHON_FILES = $(shell find -name '*.py')
ALL_FILES = $(TEMPLATE_FILES) $(STATIC_FILES) $(PYTHON_FILES)
door_admin_v$(VERSION).tar.gz: Makefile $(ALL_FILES)
tar czf $@ --transform='s,^,door_admin_$(VERSION)/,' $^
install: install_templates install_static install_python
install_static:
install -D -m 0755 -t $(PREFIX)/usr/share/door_admin/static $(STATIC_FILES)
install_templates:
install -D -m 0755 -t $(PREFIX)/usr/share/door_admin/templates $(TEMPLATE_FILES)
install_python:
install -D -m 0755 -t $(PREFIX)/bin $(PYTHON_FILES)
.PHONY: release install install_static install_templates install_python

2
app.py
View File

@ -16,7 +16,7 @@ MQTT_BROKER = '10.10.21.2'
door = DoorHandle(MQTT_BROKER) door = DoorHandle(MQTT_BROKER)
app = Flask(__name__) app = Flask(__name__, template_folder='/usr/share/door_admin/templates', static_url_path='/usr/share/door_admin/static')
# Generate a nice key using secrets.token_urlsafe() # Generate a nice key using secrets.token_urlsafe()
app.config['SECRET_KEY'] = os.environ.get("SECRET_KEY", 'Q7PJu2fg2jabYwP-Psop6c6f2G4') app.config['SECRET_KEY'] = os.environ.get("SECRET_KEY", 'Q7PJu2fg2jabYwP-Psop6c6f2G4')