From 70ae67877828bc17352dd8ae0f6fe02643ba990e Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 17 Sep 2020 12:02:22 +0200 Subject: Implement Installation with Make --- Makefile | 14 ++++++++++++++ README.md | 22 ++++++++++++++++++++++ picontrol.service | 13 +++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 Makefile create mode 100644 picontrol.service diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..16b3ccd --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ + +.PHONY: install uninstall + +install : + install -Dm 644 "main.py" "/usr/share/eu.xengineering.picontrol/main.py" + install -Dm 644 "picontrol.service" "/usr/lib/systemd/system/picontrol.service" + install -Dm 644 "static/css/style.css" "/usr/share/eu.xengineering.picontrol/static/css/style.css" + install -Dm 644 "static/img/favicon.ico" "/usr/share/eu.xengineering.picontrol/static/img/favicon.ico" + install -Dm 644 "static/js/api_client.js" "/usr/share/eu.xengineering.picontrol/static/js/api_client.js" + install -Dm 644 "templates/index.html" "/usr/share/eu.xengineering.picontrol/templates/index.html" + +uninstall : + rm -f /usr/lib/systemd/system/picontrol.service + rm -rf /usr/share/eu.xengineering.picontrol/ diff --git a/README.md b/README.md index b01c87b..ec414fb 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,25 @@ A small Web Application to shutdown or reboot your Raspberry Pi. ## Current State The code works but there is still documentation / automation missing. + + +## Usage + +**Please cd into the repository to install/uninstall!** + +### Installation +```bash + sudo useradd -rUs /usr/bin/nologin picontrol + sudo make install +``` + +### Activation +```bash + sudo systemctl enable --now picontrol +``` + +### How to uninstall +```bash + sudo systemctl disable --now picontrol + sudo make uninstall +``` diff --git a/picontrol.service b/picontrol.service new file mode 100644 index 0000000..37641cc --- /dev/null +++ b/picontrol.service @@ -0,0 +1,13 @@ + +[Unit] +Description=Web Server to shutdown and poweroff the Pi using python-waitress +After=network.target + +[Service] +User=picontrol +Group=picontrol +WorkingDirectory=/usr/share/eu.xengineering.picontrol/ +ExecStart=/usr/bin/python3 /usr/share/eu.xengineering.picontrol/main.py + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3-70-g09d2