Compare commits

...

3 Commits

Author SHA1 Message Date
d090f5822f erste beide Optionen ok 2025-05-19 21:16:16 +02:00
afab977f61 Option 1 und 2 rudimentär lauffähig 2025-05-19 21:13:53 +02:00
3e32af6954 erste Grundversion 2025-05-19 21:09:15 +02:00

View File

@@ -4,31 +4,37 @@
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 in einer scrollbaren Anzeige auszugeben
function show_repo_info() { function show_repo_info() {
echo "Repository-Informationen abrufen..." borg info "$REPO" > /tmp/repo_info.txt 2>&1
borg info $REPO dialog --title "Repository-Informationen" --backtitle "Borg Backup" --scrollbar --textbox /tmp/repo_info.txt 25 160
rm /tmp/repo_info.txt
} }
function list_archives() { function list_archives() {
echo "Verfügbare Archive im Repository:" borg list "$REPO" > /tmp/archive_list.txt 2>&1
borg list $REPO dialog --title "Verfügbare Archive" --backtitle "Borg Backup" --scrollbar --textbox /tmp/archive_list.txt 25 160
rm /tmp/archive_list.txt
} }
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 borg info "$REPO::$ARCHIVE" > /tmp/archive_info.txt 2>&1
borg info $REPO::$ARCHIVE dialog --title "Details zu Archiv $ARCHIVE" --backtitle "Borg Backup" --scrollbar --textbox /tmp/archive_info.txt 25 80
rm /tmp/archive_info.txt
} }
# 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 +47,9 @@ while true; do
show_archive_details show_archive_details
;; ;;
4) 4)
echo "Beende das Skript." clear
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