Interactive entry of remote backup details
This commit is contained in:
parent
3379da743d
commit
442fc05c88
|
@ -380,8 +380,49 @@ function show_help {
|
|||
|
||||
|
||||
function interactive_configuration_remote_backups {
|
||||
# TODO
|
||||
exit 0
|
||||
# clear any existing list
|
||||
if [ -f $FRIENDS_SERVERS_LIST ]; then
|
||||
rm -f $FRIENDS_SERVERS_LIST
|
||||
touch $FRIENDS_SERVERS_LIST
|
||||
fi
|
||||
# number of entries made
|
||||
entering_remote_backups_ctr=1
|
||||
|
||||
entering_remote_backups_done="no"
|
||||
while [[ $entering_remote_backups_done == "no" ]]
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle "Freedombone Configuration" \
|
||||
--title "Remote Backup ${entering_remote_backups_ctr}" \
|
||||
--form "\nPlease specify the SSH login details:" 11 55 4 \
|
||||
"Username:" 1 1 "" 1 16 16 15 \
|
||||
"Domain:" 2 1 "" 2 16 16 15 \
|
||||
"SSH port:" 3 1 "22" 3 16 5 4 \
|
||||
"Password:" 4 1 "" 4 16 20 100 \
|
||||
2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) entering_remote_backups_done="yes";;
|
||||
255) entering_remote_backups_done="yes";;
|
||||
esac
|
||||
remote_ssh_username=$(cat $data | sed -n 1p)
|
||||
remote_ssh_domain=$(cat $data | sed -n 2p)
|
||||
remote_ssh_port=$(cat $data | sed -n 3p)
|
||||
remote_ssh_password=$(cat $data | sed -n 4p)
|
||||
if [[ $remote_ssh_username != "" && \
|
||||
$remote_ssh_domain != "" && \
|
||||
$remote_ssh_port != "" && \
|
||||
$remote_ssh_password != "" ]]; then
|
||||
echo "$remote_ssh_username@$remote_ssh_domain:$remote_ssh_port//home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
|
||||
else
|
||||
entering_remote_backups_done="yes"
|
||||
fi
|
||||
entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
|
||||
done
|
||||
if [ -f $FRIENDS_SERVERS_LIST ]; then
|
||||
chown $MY_USERNAME:$MY_USERNAME $FRIENDS_SERVERS_LIST
|
||||
fi
|
||||
}
|
||||
|
||||
function save_configuration_file {
|
||||
|
@ -601,7 +642,6 @@ function interactive_configuration {
|
|||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
esac
|
||||
echo "result $(cat $data)"
|
||||
LOCAL_NETWORK_STATIC_IP_ADDRESS=$(cat $data | sed -n 1p)
|
||||
ROUTER_IP_ADDRESS=$(cat $data | sed -n 2p)
|
||||
echo "local $LOCAL_NETWORK_STATIC_IP_ADDRESS"
|
||||
|
@ -673,7 +713,7 @@ function interactive_configuration {
|
|||
if [ ! $WIKI_FREEDNS_SUBDOMAIN_CODE ]; then
|
||||
exit 5277
|
||||
fi
|
||||
if [[ $DOMAIN_NAME==$WIKI_DOMAIN_NAME ]]; then
|
||||
if [[ $DOMAIN_NAME == "$WIKI_DOMAIN_NAME" ]]; then
|
||||
FREEDNS_SUBDOMAIN_CODE=$WIKI_FREEDNS_SUBDOMAIN_CODE
|
||||
fi
|
||||
fi
|
||||
|
@ -754,7 +794,7 @@ function interactive_configuration {
|
|||
if [ ! $OWNCLOUD_FREEDNS_SUBDOMAIN_CODE ]; then
|
||||
exit 2583
|
||||
fi
|
||||
if [[ $DOMAIN_NAME==$OWNCLOUD_DOMAIN_NAME ]]; then
|
||||
if [[ $DOMAIN_NAME == "$OWNCLOUD_DOMAIN_NAME" ]]; then
|
||||
FREEDNS_SUBDOMAIN_CODE=$OWNCLOUD_FREEDNS_SUBDOMAIN_CODE
|
||||
fi
|
||||
fi
|
||||
|
@ -791,7 +831,7 @@ function interactive_configuration {
|
|||
if [ ! $REDMATRIX_FREEDNS_SUBDOMAIN_CODE ]; then
|
||||
exit 9654
|
||||
fi
|
||||
if [[ $DOMAIN_NAME==$REDMATRIX_DOMAIN_NAME ]]; then
|
||||
if [[ $DOMAIN_NAME == "$REDMATRIX_DOMAIN_NAME" ]]; then
|
||||
FREEDNS_SUBDOMAIN_CODE=$REDMATRIX_FREEDNS_SUBDOMAIN_CODE
|
||||
fi
|
||||
fi
|
||||
|
@ -877,6 +917,8 @@ function interactive_configuration {
|
|||
|
||||
save_configuration_file
|
||||
|
||||
FRIENDS_SERVERS_LIST=/home/$MY_USERNAME/backup.list
|
||||
|
||||
dialog --title "Encrypted backup to other servers" \
|
||||
--backtitle "Freedombone Configuration" \
|
||||
--defaultno \
|
||||
|
|
Loading…
Reference in New Issue