diff options
author | xengineering <mail2xengineering@protonmail.com> | 2020-10-15 14:06:56 +0200 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2020-10-15 14:06:56 +0200 |
commit | 139bcb8821ba39e94d38d32f61210e4a2c1c75f0 (patch) | |
tree | 846208cfa481bfa7d269eb0a551be30bd22d4f7e | |
parent | 3f739baab456c2cc977f11090381d1f61eb023c4 (diff) | |
download | iot-barcode-scanner-139bcb8821ba39e94d38d32f61210e4a2c1c75f0.tar iot-barcode-scanner-139bcb8821ba39e94d38d32f61210e4a2c1c75f0.tar.zst iot-barcode-scanner-139bcb8821ba39e94d38d32f61210e4a2c1c75f0.zip |
Implement Makefile for Installation
-rw-r--r-- | Makefile | 49 | ||||
-rw-r--r-- | README.md | 17 | ||||
-rw-r--r-- | iot_barcode_scanner/static.py | 2 |
3 files changed, 62 insertions, 6 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3fb6faf --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ + + +PKGNAME=iot_barcode_scanner +PREFIX=/usr +INSTALL=install +INSTALL_PROGRAM=$(INSTALL) -m 744 +INSTALL_DATA=$(INSTALL) -m 644 + +bindir=$(DESTDIR)$(PREFIX)/bin +sharedir=$(DESTDIR)$(PREFIX)/share +confdir=$(DESTDIR)/etc/xengineering.eu/$(PKGNAME) +libdir=$(DESTDIR)$(PREFIX)/lib/python3.8/site-packages/$(PKGNAME) + + +.PHONY: install uninstall + + +install: + + # install executables + mkdir -p $(bindir) + $(INSTALL_PROGRAM) barcode_scanner_daemon.py $(bindir)/eu.xengineering.$(PKGNAME).scanner + $(INSTALL_PROGRAM) barcode_transmit_daemon.py $(bindir)/eu.xengineering.$(PKGNAME).transmitter + + # install library / package + mkdir -p $(libdir)/ + $(INSTALL_DATA) iot_barcode_scanner/__init__.py $(libdir)/__init__.py + $(INSTALL_DATA) iot_barcode_scanner/config.py $(libdir)/config.py + $(INSTALL_DATA) iot_barcode_scanner/mqtt.py $(libdir)/mqtt.py + $(INSTALL_DATA) iot_barcode_scanner/static.py $(libdir)/static.py + + # install config file + mkdir -p $(confdir)/ + $(INSTALL_DATA) config.json $(confdir)/config.json + + # install license + mkdir -p $(sharedir)/licenses/ + $(INSTALL_DATA) LICENSE $(sharedir)/licenses/$(PKGNAME) + + +uninstall: + + rm -f $(bindir)/eu.xengineering.$(PKGNAME).scanner + rm -f $(bindir)/eu.xengineering.$(PKGNAME).transmitter + rm -f $(libdir)/__init__.py + rm -f $(libdir)/config.py + rm -f $(libdir)/mqtt.py + rm -f $(libdir)/static.py + rm -f $(sharedir)/licenses/$(PKGNAME) @@ -7,10 +7,17 @@ A service that makes barcode scanners available on the network for IoT use. ## Usage -1. Adapt config.json file if needed. -2. Run ```sudo python barcode_scanner_daemon.py``` -3. Run ```python barcode_transmit_daemon.py``` -4. Listen to MQTT output (e.g. with ```mosquitto_sub -h localhost -t "xengineering.eu/iot-barcode-scanner"```) +1. Installation + ``` + sudo pip3 install paho-mqtt evdev + git clone https://github.com/xengineering/iot-barcode-scanner.git + cd iot-barcode-scanner + sudo make install + ``` +2. Configure /etc/xengineering.eu/iot_barcode_scanner/config.json +3. Run ```sudo eu.xengineering.iot_barcode_scanner.scanner``` +4. Run ```eu.xengineering.iot_barcode_scanner.transmitter``` +5. Listen to MQTT output (e.g. with ```mosquitto_sub -h localhost -t "xengineering.eu/iot-barcode-scanner"```) ## Milestones @@ -19,8 +26,8 @@ A service that makes barcode scanners available on the network for IoT use. - [x] Use config file - [x] Disable scanner as regular input source and bind it only to the service - [x] Split into two executables to reduce root-priviledged code +- [x] Write Makefile for easy installation - [ ] Implement systemd services -- [ ] Write Makefile for easy installation - [ ] Implement auto discovery of barcode scanners - [ ] Package it for Arch Linux diff --git a/iot_barcode_scanner/static.py b/iot_barcode_scanner/static.py index 22b3842..d81b00b 100644 --- a/iot_barcode_scanner/static.py +++ b/iot_barcode_scanner/static.py @@ -3,4 +3,4 @@ """Module to store static Data for the whole Package""" -CONFIG_PATH = "config.json" +CONFIG_PATH = "/etc/xengineering.eu/iot_barcode_scanner/config.json" |