move variables and add password ask for borg backup
This commit is contained in:
@@ -14,16 +14,19 @@ export PS1="\[\e[31m\][\[\e[m\]\[\e[38;5;172m\]\u\[\e[m\]@\[\e[38;5;153m\]\h\[\e
|
|||||||
##############################################################################################################################
|
##############################################################################################################################
|
||||||
# Borg Repo finder
|
# Borg Repo finder
|
||||||
##############################################################################################################################
|
##############################################################################################################################
|
||||||
|
source "/variables.sh"
|
||||||
|
|
||||||
function sepurator {
|
function sepurator {
|
||||||
echo "==============================================================================="
|
echo "=============================================================================================="
|
||||||
}
|
}
|
||||||
|
|
||||||
function find_borg_repo {
|
function find_borg_repo {
|
||||||
repo_list=( $(find "$1" -name "index.*" -type f | rev | cut -d '/' -f "2-" | rev) )
|
repo_list=( $(find "$1" -name "index.*" -type f | rev | cut -d '/' -f "2-" | rev) )
|
||||||
|
|
||||||
if [ -z "$repo_list" ]; then
|
if [ -z "$repo_list" ]; then
|
||||||
|
sepurator
|
||||||
echo "* Can not find borg repository"
|
echo "* Can not find borg repository"
|
||||||
exit 1
|
sepurator
|
||||||
else
|
else
|
||||||
sepurator
|
sepurator
|
||||||
echo "* Select borg repository"
|
echo "* Select borg repository"
|
||||||
@@ -61,9 +64,37 @@ function select_borg_repo {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
sepurator
|
||||||
|
}
|
||||||
|
|
||||||
|
function ask_for_repo_password {
|
||||||
|
if grep -q 'key' "$BORG_REPO/config"; then
|
||||||
|
echo "* BORG REPO has a password"
|
||||||
|
sepurator
|
||||||
|
echo "(you can leave it empty if you not like to export BORG_PASSPHRASE)"
|
||||||
|
read -s -p "Please enter password: " BORG_REPO_PASSWORD
|
||||||
|
echo ""
|
||||||
|
if [ "$BORG_REPO_PASSWORD" != "" ]; then
|
||||||
|
export BORG_PASSPHRASE="$BORG_REPO_PASSWORD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "* BORG REPO has no password"
|
||||||
|
fi
|
||||||
|
sepurator
|
||||||
|
}
|
||||||
|
|
||||||
|
function print_container_info {
|
||||||
|
sepurator
|
||||||
|
echo "BorgServer powered by $BORG_VERSION - Image Hostname: $HOSTNAME | Image Version: $DOCKER_IMAGE_VERSION"
|
||||||
|
sepurator
|
||||||
}
|
}
|
||||||
|
|
||||||
find_borg_repo backups/
|
find_borg_repo backups/
|
||||||
export BORG_REPO="${repo_list[selected_repo]}"
|
export BORG_REPO="${repo_list[selected_repo]}"
|
||||||
clear
|
if [ ! -z "$BORG_REPO" ]; then
|
||||||
|
ask_for_repo_password
|
||||||
|
clear
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_container_info
|
||||||
neofetch
|
neofetch
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ VOLUME ["/sshkeys/host"]
|
|||||||
|
|
||||||
COPY motd.txt /etc/motd
|
COPY motd.txt /etc/motd
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
|
COPY variables.sh /
|
||||||
|
|
||||||
COPY .bash_profile /root/
|
COPY .bash_profile /root/
|
||||||
COPY .bashrc /root/
|
COPY .bashrc /root/
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
DOCKER_IMAGE_VERSION="1.0.8"
|
source "/variables.sh"
|
||||||
BORG_VERSION=$(borg -V)
|
|
||||||
SSH_FOLDERS=( /sshkeys/clients /sshkeys/host )
|
|
||||||
##############################################################################################################################
|
##############################################################################################################################
|
||||||
# Funktionen
|
# Funktionen
|
||||||
##############################################################################################################################
|
##############################################################################################################################
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
DOCKER_IMAGE_VERSION="1.0.9"
|
||||||
|
BORG_VERSION=$(borg -V)
|
||||||
|
SSH_FOLDERS=( /sshkeys/clients /sshkeys/host )
|
||||||
Reference in New Issue
Block a user