Anpassungen erfolgt und erfolgreich
This commit is contained in:
@@ -1,53 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Setze Backup-Parameter
|
||||
REPO="ssh://stefan@172.25.28.34:22/srv/usbplatte/nauheim1vps"
|
||||
clear
|
||||
|
||||
# Repository auswählen – jetzt noch breiter!
|
||||
REPO_OPTION=$(whiptail --title "Backup Repository auswählen" --menu "Wähle ein Repository oder gib eine eigene Adresse ein:" 20 120 2 \
|
||||
"1" "Standard: ssh://stefan@172.25.28.34:22/srv/usbplatte/nauheim1vps" \
|
||||
"2" "Eigene Eingabe" 3>&1 1>&2 2>&3)
|
||||
|
||||
if [ "$REPO_OPTION" == "1" ]; then
|
||||
REPO="ssh://stefan@172.25.28.34:22/srv/usbplatte/nauheim1vps"
|
||||
else
|
||||
REPO=$(whiptail --inputbox "Gib das Repository ein:" 10 120 --title "Benutzerdefiniertes Repository" 3>&1 1>&2 2>&3)
|
||||
fi
|
||||
|
||||
# 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)
|
||||
PASSPHRASE=$(whiptail --passwordbox "Bitte gib die Passphrase für das Borgbackup-Repository ein:" 10 120 --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() {
|
||||
borg info "$REPO" > /tmp/repo_info.txt 2>&1
|
||||
dialog --title "Repository-Informationen" --backtitle "Borg Backup" --scrollbar --textbox /tmp/repo_info.txt 25 160
|
||||
dialog --title "Repository-Informationen" --backtitle "Borg Backup" --scrollbar --textbox /tmp/repo_info.txt 25 240
|
||||
rm /tmp/repo_info.txt
|
||||
}
|
||||
|
||||
function list_archives() {
|
||||
borg list "$REPO" > /tmp/archive_list.txt 2>&1
|
||||
dialog --title "Verfügbare Archive" --backtitle "Borg Backup" --scrollbar --textbox /tmp/archive_list.txt 25 160
|
||||
dialog --title "Verfügbare Archive" --backtitle "Borg Backup" --scrollbar --textbox /tmp/archive_list.txt 25 240
|
||||
rm /tmp/archive_list.txt
|
||||
}
|
||||
|
||||
function show_archive_details() {
|
||||
# Liste der Archive abrufen und formatieren
|
||||
ARCHIVES=$(borg list "$REPO" | awk '{print $1}')
|
||||
|
||||
if [ -z "$ARCHIVES" ]; then
|
||||
whiptail --msgbox "Keine Archive gefunden!" 8 40 --title "Fehler"
|
||||
whiptail --msgbox "Keine Archive gefunden!" 10 120 --title "Fehler"
|
||||
return
|
||||
fi
|
||||
|
||||
# Konvertiere die Liste in das Whiptail-Menüformat
|
||||
OPTIONS=()
|
||||
while read -r line; do
|
||||
OPTIONS+=("$line" " ")
|
||||
done <<< "$ARCHIVES"
|
||||
|
||||
ARCHIVE=$(whiptail --title "Archiv auswählen" --menu "Wähle ein Archiv aus" 20 60 10 "${OPTIONS[@]}" 3>&1 1>&2 2>&3)
|
||||
ARCHIVE=$(whiptail --title "Archiv auswählen" --menu "Wähle ein Archiv aus" 20 120 10 "${OPTIONS[@]}" 3>&1 1>&2 2>&3)
|
||||
|
||||
if [ -n "$ARCHIVE" ]; then
|
||||
borg info "$REPO::$ARCHIVE" > /tmp/archive_info.txt 2>&1
|
||||
dialog --title "Details zu Archiv $ARCHIVE" --backtitle "Borg Backup" --scrollbar --textbox /tmp/archive_info.txt 25 160
|
||||
dialog --title "Details zu Archiv $ARCHIVE" --backtitle "Borg Backup" --scrollbar --textbox /tmp/archive_info.txt 25 240
|
||||
rm /tmp/archive_info.txt
|
||||
fi
|
||||
}
|
||||
|
||||
# Hauptmenü mit Whiptail
|
||||
while true; do
|
||||
OPTION=$(whiptail --title "Borg Backup Menü" --menu "Wähle eine Option" 15 50 4 \
|
||||
OPTION=$(whiptail --title "Borg Backup Menü" --menu "Wähle eine Option" 20 120 4 \
|
||||
"1" "Repository-Informationen anzeigen" \
|
||||
"2" "Liste aller Archive anzeigen" \
|
||||
"3" "Details zu einem bestimmten Archiv anzeigen" \
|
||||
@@ -65,7 +72,7 @@ while true; do
|
||||
;;
|
||||
4)
|
||||
clear
|
||||
whiptail --msgbox "Beende das Skript." 8 40 --title "Borg Backup"
|
||||
whiptail --msgbox "Beende das Skript." 10 120 --title "Borg Backup"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user