add post-install script to launch piplotter as systemd service

This commit is contained in:
sinseman44
2020-11-15 08:52:46 +00:00
parent b8b1d033af
commit 537827bf37
3 changed files with 32 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
#!/bin/bash
cp -a "install_scripts/piplotter.service" /etc/systemd/system
chown root:root /etc/systemd/system/piplotter.service
systemctl daemon-reload
systemctl enable piplotter.service

View File

@@ -0,0 +1,12 @@
[Unit]
Description=piplot2D Display Menu and Control
[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/bin/piplotter
Restart=always
[Install]
WantedBy=multi-user.target

View File

@@ -1,4 +1,15 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
from setuptools.command.install import install
import subprocess
import os
class CustomInstallCommand(install):
def run(self):
install.run(self)
current_dir_path = os.path.dirname(os.path.realpath(__file__))
create_service_script_path = os.path.join(current_dir_path, 'install_scripts', 'create_service.sh')
subprocess.check_output([create_service_script_path])
with open("README.md", "r") as fh: with open("README.md", "r") as fh:
long_description = fh.read() long_description = fh.read()
@@ -28,5 +39,6 @@ setup(
"https://github.com/sinseman44/PyCNC/archive/v2.0.0.zip#egg=pycnc-2.0.0", "https://github.com/sinseman44/PyCNC/archive/v2.0.0.zip#egg=pycnc-2.0.0",
], ],
python_requires='>=3.6', python_requires='>=3.6',
scripts=['piplotter'] scripts=['piplotter'],
cmdclass={'install': CustomInstallCommand}
) )