Initial commit: Implementiere PiCopy - Automatischer USB-Kopierdienst mit Web-Interface, einschließlich Installations- und Bereitstellungsskripten sowie Systemd-Service.
This commit is contained in:
42
install.sh
Normal file
42
install.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# PiCopy Installations-Script für den Raspberry Pi
|
||||
# Ausführen auf dem Pi als root oder mit sudo:
|
||||
# sudo bash install.sh
|
||||
|
||||
set -e
|
||||
|
||||
PI_DIR="/opt/picopy"
|
||||
SERVICE="picopy"
|
||||
|
||||
echo "=== PiCopy Installation ==="
|
||||
|
||||
# Abhängigkeiten installieren
|
||||
echo ">> Pakete installieren..."
|
||||
apt-get update -q
|
||||
apt-get install -y python3 python3-venv python3-pip lsblk
|
||||
|
||||
# Verzeichnis anlegen
|
||||
echo ">> Verzeichnis anlegen: $PI_DIR"
|
||||
mkdir -p "$PI_DIR/logs"
|
||||
|
||||
# Python-Umgebung
|
||||
echo ">> Python venv erstellen..."
|
||||
python3 -m venv "$PI_DIR/venv"
|
||||
"$PI_DIR/venv/bin/pip" install --quiet flask pyudev
|
||||
|
||||
# App-Dateien kopieren
|
||||
echo ">> Dateien kopieren..."
|
||||
cp app.py "$PI_DIR/app.py"
|
||||
|
||||
# Systemd-Service einrichten
|
||||
echo ">> Systemd-Service einrichten..."
|
||||
cp picopy.service "/etc/systemd/system/$SERVICE.service"
|
||||
systemctl daemon-reload
|
||||
systemctl enable "$SERVICE"
|
||||
systemctl restart "$SERVICE"
|
||||
|
||||
echo ""
|
||||
echo "=== Installation abgeschlossen ==="
|
||||
echo "Web-Interface: http://$(hostname -I | awk '{print $1}'):8080"
|
||||
echo "Status: systemctl status $SERVICE"
|
||||
echo "Logs: journalctl -u $SERVICE -f"
|
||||
Reference in New Issue
Block a user