Download scripts/protondrive_refresh.sh from gibihm/gotti-mirror: direct link, hf CLI and curl.
- Browser
- Download file 1.69 kB
-
https://huggingface.co/datasets/gibihm/gotti-mirror/resolve/main/scripts/protondrive_refresh.sh
- Command line
-
hf download hf://datasets/gibihm/gotti-mirror/scripts/protondrive_refresh.sh
-
curl -L -o protondrive_refresh.sh https://huggingface.co/datasets/gibihm/gotti-mirror/resolve/main/scripts/protondrive_refresh.sh
1.69 kB
| # | |
| # protondrive_refresh.sh | |
| # Fragt einen frischen Proton-Drive 2FA-Code ab, refreshed das gecachte | |
| # rclone-Token und startet den ProtonDrive-Mount (systemd --user) neu. | |
| # | |
| # Aufruf: | |
| # ~/dashboard/protondrive_refresh.sh # fragt interaktiv nach dem Code | |
| # ~/dashboard/protondrive_refresh.sh 123456 # Code als Argument (z.B. Cron/Script) | |
| # | |
| # Voraussetzung: systemd --user Service "rclone-protondrive.service" | |
| # Mount-Punkt: /home/nextlevel/ProtonDrive | |
| # Remote-Name: ProtonDrive_Atomdeich | |
| set -euo pipefail | |
| REMOTE="ProtonDrive_Atomdeich" | |
| MOUNT="/home/nextlevel/ProtonDrive" | |
| SERVICE="rclone-protondrive.service" | |
| # 2FA-Code holen: Argument oder interaktive (verdeckte) Eingabe | |
| if [[ -n "${1:-}" ]]; then | |
| CODE="$1" | |
| else | |
| read -rsp "2FA-Code fuer ProtonDrive ($REMOTE): " CODE | |
| echo | |
| fi | |
| if [[ -z "$CODE" ]]; then | |
| echo "FEHLER: kein 2FA-Code uebergeben." >&2 | |
| exit 1 | |
| fi | |
| echo "[*] Service stoppen ..." | |
| systemctl --user stop "$SERVICE" || true | |
| sleep 1 | |
| echo "[*] Token via frischem 2FA-Code refreshen ..." | |
| if ! rclone lsd "$REMOTE:" --protondrive-2fa="$CODE" >/dev/null; then | |
| echo "FEHLER: Token-Refresh fehlgeschlagen (falscher/abgelaufener Code?)" >&2 | |
| echo "[*] Service trotzdem wieder starten ..." >&2 | |
| systemctl --user start "$SERVICE" || true | |
| exit 2 | |
| fi | |
| echo "[+] Token refreshed." | |
| echo "[*] Mount neu starten ..." | |
| systemctl --user start "$SERVICE" | |
| sleep 3 | |
| if mount | grep -q "on $MOUNT type fuse.rclone"; then | |
| echo "[+] ProtonDrive ist gemountet unter: $MOUNT" | |
| echo "[+] Inhalt:" | |
| ls -1 "$MOUNT" | sed 's/^/ /' | |
| else | |
| echo "WARNUNG: Mount nicht aktiv - bitte 'systemctl --user status $SERVICE' pruefen." >&2 | |
| exit 3 | |
| fi | |