added void/runit support

This commit is contained in:
moinmoi
2019-03-05 22:50:43 +01:00
parent 33f0412bea
commit 644c0982e4
3 changed files with 43 additions and 7 deletions

View File

@@ -2,7 +2,11 @@
INSTALL_DIR="/opt/lenovo_fix"
systemctl stop lenovo_fix.service &>/dev/null
if pidof systemd 2>&1 1>/dev/null; then
systemctl stop lenovo_fix.service &>/dev/null
elif pidof runit 2>&1 1>/dev/null; then
sv down lenovo_fix &>/dev/null
fi
mkdir -p "$INSTALL_DIR" &>/dev/null
set -e
@@ -16,8 +20,13 @@ else
echo "Config file already exists, skipping."
fi
echo "Copying systemd service file..."
cp systemd/lenovo_fix.service /etc/systemd/system
if pidof systemd 2>&1 1>/dev/null; then
echo "Copying systemd service file..."
cp systemd/lenovo_fix.service /etc/systemd/system
elif pidof runit 2>&1 1>/dev/null; then
echo "Copying runit service file"
cp -R runit/lenovo_fix /etc/sv/
fi
echo "Building virtualenv..."
cp -n requirements.txt lenovo_fix.py mmio.py "$INSTALL_DIR"
@@ -26,9 +35,15 @@ cd "$INSTALL_DIR"
. venv/bin/activate
pip install -r requirements.txt
echo "Enabling and starting systemd service..."
systemctl daemon-reload
systemctl enable lenovo_fix.service
systemctl restart lenovo_fix.service
if pidof systemd 2>&1 1>/dev/null; then
echo "Enabling and starting systemd service..."
systemctl daemon-reload
systemctl enable lenovo_fix.service
systemctl restart lenovo_fix.service
elif pidof runit 2>&1 1>/dev/null; then
echo "Enabling and starting runit service..."
ln -sv /etc/sv/lenovo_fix /var/service/
sv up lenovo_fix
fi
echo "All done."