erste Grundversion

This commit is contained in:
2025-05-19 21:09:15 +02:00
parent e74fae10df
commit 3e32af6954

View File

@@ -4,31 +4,34 @@
REPO="ssh://stefan@172.25.28.34:22/srv/usbplatte/nauheim1vps" REPO="ssh://stefan@172.25.28.34:22/srv/usbplatte/nauheim1vps"
clear clear
# Funktion, um Informationen anzuzeigen # Frage die Passphrase einmal ab
PASSPHRASE=$(whiptail --passwordbox "Bitte gib die Passphrase für das Borgbackup-Repository ein:" 8 40 --title "Borg Backup" 3>&1 1>&2 2>&3)
export BORG_PASSPHRASE="$PASSPHRASE"
# Funktion, um Informationen schön in Whiptail anzuzeigen
function show_repo_info() { function show_repo_info() {
echo "Repository-Informationen abrufen..." INFO=$(borg info $REPO 2>&1)
borg info $REPO whiptail --msgbox "Repository-Informationen:\n\n$INFO" 20 70 --title "Borg Backup"
} }
function list_archives() { function list_archives() {
echo "Verfügbare Archive im Repository:" ARCHIVES=$(borg list $REPO 2>&1)
borg list $REPO whiptail --msgbox "Verfügbare Archive:\n\n$ARCHIVES" 20 70 --title "Borg Backup"
} }
function show_archive_details() { function show_archive_details() {
echo "Details zu einem bestimmten Archiv:" ARCHIVE=$(whiptail --inputbox "Gib den Namen des Archivs ein:" 8 40 --title "Borg Backup" 3>&1 1>&2 2>&3)
read -p "Gib den Namen des Archivs ein: " ARCHIVE INFO=$(borg info $REPO::$ARCHIVE 2>&1)
borg info $REPO::$ARCHIVE whiptail --msgbox "Details zu Archiv $ARCHIVE:\n\n$INFO" 20 70 --title "Borg Backup"
} }
# Hauptskript: Wiederhole das Menü, solange der Nutzer nicht "Beenden" wählt # Hauptmenü mit Whiptail
while true; do while true; do
echo "Was möchtest du tun?" OPTION=$(whiptail --title "Borg Backup Menü" --menu "Wähle eine Option" 15 50 4 \
echo "1) Repository-Informationen anzeigen" "1" "Repository-Informationen anzeigen" \
echo "2) Liste aller Archive anzeigen" "2" "Liste aller Archive anzeigen" \
echo "3) Details zu einem bestimmten Archiv anzeigen" "3" "Details zu einem bestimmten Archiv anzeigen" \
echo "4) Beenden" "4" "Beenden" 3>&1 1>&2 2>&3)
read -p "Wähle eine Option (1-4): " OPTION
case $OPTION in case $OPTION in
1) 1)
@@ -41,14 +44,8 @@ while true; do
show_archive_details show_archive_details
;; ;;
4) 4)
echo "Beende das Skript." whiptail --msgbox "Beende das Skript." 8 40 --title "Borg Backup"
exit 0 exit 0
;; ;;
*)
echo "Ungültige Eingabe. Bitte wähle eine Option zwischen 1 und 4."
;;
esac esac
# Warte kurz, bevor das Menü erneut angezeigt wird
echo ""
done done