throttled/install.sh

35 lines
752 B
Bash
Raw Normal View History

2018-04-20 10:46:00 +02:00
#!/bin/sh
INSTALL_DIR="/opt/lenovo_fix"
systemctl stop lenovo_fix.service &>/dev/null
mkdir -p "$INSTALL_DIR" &>/dev/null
set -e
cd "$(dirname "$0")"
echo "Copying config file..."
if [ ! -f /etc/lenovo_fix.conf ]; then
cp etc/lenovo_fix.conf /etc
else
echo "Config file already exists, skipping."
fi
echo "Copying systemd service file..."
cp systemd/lenovo_fix.service /etc/systemd/system
echo "Building virtualenv..."
2018-10-31 13:57:45 +01:00
cp -n requirements.txt lenovo_fix.py mmio.py "$INSTALL_DIR"
2018-04-20 10:46:00 +02:00
cd "$INSTALL_DIR"
2018-10-19 19:48:11 +02:00
/usr/bin/python3 -m venv venv
2018-04-23 14:22:19 +02:00
. venv/bin/activate
2018-04-20 10:46:00 +02:00
pip install -r requirements.txt
echo "Enabling and starting systemd service..."
systemctl daemon-reload
systemctl enable lenovo_fix.service
systemctl restart lenovo_fix.service
echo "All done."