release
This commit is contained in:
39
install.sh
Normal file
39
install.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
BASE_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$BASE_DIR"
|
||||
|
||||
chmod +x *.sh
|
||||
|
||||
if [[ -d .venv ]]; then
|
||||
rm -rf .venv 2>/dev/null || sudo rm -rf .venv
|
||||
fi
|
||||
|
||||
python3 -m venv .venv
|
||||
# shellcheck disable=SC1091
|
||||
source .venv/bin/activate
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install -r requirements.txt
|
||||
python3 -c "import aiohttp, zeroconf"
|
||||
|
||||
mkdir -p "$BASE_DIR/loxone" "$BASE_DIR/data"
|
||||
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
if [[ -w /etc/systemd/system ]]; then
|
||||
cp -f "$BASE_DIR/systemd/shd-alice.service" /etc/systemd/system/shd-alice.service
|
||||
cp -f "$BASE_DIR/systemd/shd-alice-plugin.service" /etc/systemd/system/shd-alice-plugin.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable shd-alice.service || true
|
||||
systemctl enable shd-alice-plugin.service || true
|
||||
systemctl restart shd-alice-plugin.service || true
|
||||
elif command -v sudo >/dev/null 2>&1; then
|
||||
sudo cp -f "$BASE_DIR/systemd/shd-alice.service" /etc/systemd/system/shd-alice.service || true
|
||||
sudo cp -f "$BASE_DIR/systemd/shd-alice-plugin.service" /etc/systemd/system/shd-alice-plugin.service || true
|
||||
sudo systemctl daemon-reload || true
|
||||
sudo systemctl enable shd-alice.service || true
|
||||
sudo systemctl enable shd-alice-plugin.service || true
|
||||
sudo systemctl restart shd-alice-plugin.service || true
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Install done."
|
||||
Reference in New Issue
Block a user