diff --git a/src/freedombone b/src/freedombone index 17d5ae7c..89987a0e 100755 --- a/src/freedombone +++ b/src/freedombone @@ -378,11 +378,67 @@ function show_help { exit 0 } + function interactive_configuration_remote_backups { # TODO exit 0 } +function save_configuration_file { + echo "MY_USERNAME=$MY_USERNAME" > freedombone.cfg + echo "DOMAIN_NAME=$DOMAIN_NAME" >> freedombone.cfg + echo "MY_EMAIL_ADDRESS=$MY_EMAIL_ADDRESS" >> freedombone.cfg + echo "SYSTEM_TYPE=$SYSTEM_TYPE" >> freedombone.cfg + echo "INSTALLING_ON_BBB=$INSTALLING_ON_BBB" >> freedombone.cfg + echo "DDNS_PROVIDER=$DDNS_PROVIDER" >> freedombone.cfg + echo "DDNS_USERNAME=$DDNS_USERNAME" >> freedombone.cfg + # does this need to be saved? + echo "DDNS_PASSWORD=$DDNS_PASSWORD" >> freedombone.cfg + echo "MY_NAME=$MY_NAME" >> freedombone.cfg + echo "LOCAL_NETWORK_STATIC_IP_ADDRESS=$LOCAL_NETWORK_STATIC_IP_ADDRESS" >> freedombone.cfg + echo "ROUTER_IP_ADDRESS=$ROUTER_IP_ADDRESS" >> freedombone.cfg + echo "ENABLE_CJDNS=$ENABLE_CJDNS" >> freedombone.cfg + if [ $WIKI_TITLE ]; then + echo "WIKI_TITLE=$WIKI_TITLE" >> freedombone.cfg + fi + if [ $WIKI_DOMAIN_NAME ]; then + echo "WIKI_DOMAIN_NAME=$WIKI_DOMAIN_NAME" >> freedombone.cfg + fi + if [ $WIKI_FREEDNS_SUBDOMAIN_CODE ]; then + echo "WIKI_FREEDNS_SUBDOMAIN_CODE=$WIKI_FREEDNS_SUBDOMAIN_CODE" >> freedombone.cfg + fi + if [ $FREEDNS_SUBDOMAIN_CODE ]; then + echo "FREEDNS_SUBDOMAIN_CODE=$FREEDNS_SUBDOMAIN_CODE" >> freedombone.cfg + fi + if [ $MY_BLOG_TITLE ]; then + echo "MY_BLOG_TITLE=$MY_BLOG_TITLE" >> freedombone.cfg + fi + if [ $FULLBLOG_DOMAIN_NAME ]; then + echo "FULLBLOG_DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME" >> freedombone.cfg + fi + if [ $FULLBLOG_FREEDNS_SUBDOMAIN_CODE ]; then + echo "FULLBLOG_FREEDNS_SUBDOMAIN_CODE=$FULLBLOG_FREEDNS_SUBDOMAIN_CODE" >> freedombone.cfg + fi + if [ $OWNCLOUD_DOMAIN_NAME ]; then + echo "OWNCLOUD_DOMAIN_NAME=$OWNCLOUD_DOMAIN_NAME" >> freedombone.cfg + fi + if [ $OWNCLOUD_FREEDNS_SUBDOMAIN_CODE ]; then + echo "OWNCLOUD_FREEDNS_SUBDOMAIN_CODE=$OWNCLOUD_FREEDNS_SUBDOMAIN_CODE" >> freedombone.cfg + fi + if [ $REDMATRIX_DOMAIN_NAME ]; then + echo "REDMATRIX_DOMAIN_NAME=$REDMATRIX_DOMAIN_NAME" >> freedombone.cfg + fi + if [ $REDMATRIX_FREEDNS_SUBDOMAIN_CODE ]; then + echo "REDMATRIX_FREEDNS_SUBDOMAIN_CODE=$REDMATRIX_FREEDNS_SUBDOMAIN_CODE" >> freedombone.cfg + fi + if [ $MICROBLOG_DOMAIN_NAME ]; then + echo "MICROBLOG_DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME" >> freedombone.cfg + fi + if [ $MICROBLOG_FREEDNS_SUBDOMAIN_CODE ]; then + echo "MICROBLOG_FREEDNS_SUBDOMAIN_CODE=$MICROBLOG_FREEDNS_SUBDOMAIN_CODE" >> freedombone.cfg + fi +} + function interactive_configuration { data=$(tempfile 2>/dev/null) trap "rm -f $data" 0 1 2 5 15 @@ -518,6 +574,8 @@ function interactive_configuration { exit 7229 fi + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Your full name (or nick)" 10 30 2> $data sel=$? @@ -530,30 +588,33 @@ function interactive_configuration { exit 3784 fi + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ - --inputbox "Static IP Address of this system" 10 30 2> $data + --title "Local Network Configuration" \ + --form "\nPlease enter the IP addresses:" 11 55 3 \ + "This system:" 1 1 "192.168.1.60" 1 16 16 15 \ + "Internet router:" 2 1 "192.168.1.254" 2 16 16 15 \ + 2> $data sel=$? case $sel in - 0) LOCAL_NETWORK_STATIC_IP_ADDRESS=$(cat $data);; 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" + echo "router $ROUTER_IP_ADDRESS" if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then exit 6950 fi - - dialog --backtitle "Freedombone Configuration" \ - --inputbox "LAN IP Address of the internet router" 10 30 2> $data - sel=$? - case $sel in - 0) ROUTER_IP_ADDRESS=$(cat $data);; - 1) exit 0;; - 255) exit 0;; - esac if [ ! $ROUTER_IP_ADDRESS ]; then - exit 9868 + exit 7582 fi + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --title "Mesh Networking" \ --backtitle "Freedombone Configuration" \ --defaultno \ @@ -565,7 +626,10 @@ function interactive_configuration { 255) exit 0;; esac + if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Wiki Title" 10 30 2> $data sel=$? @@ -578,6 +642,8 @@ function interactive_configuration { exit 5638 fi + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Wiki domain name" 10 30 2> $data sel=$? @@ -594,6 +660,8 @@ function interactive_configuration { fi if [[ $DDNS_PROVIDER=="default@freedns.afraid.org" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Wiki FreeDNS subdomain code" 10 30 2> $data sel=$? @@ -612,6 +680,8 @@ function interactive_configuration { fi if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Blog Title" 10 30 2> $data sel=$? @@ -622,6 +692,8 @@ function interactive_configuration { esac if [ $MY_BLOG_TITLE ]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Blog domain name" 10 30 2> $data sel=$? @@ -635,6 +707,8 @@ function interactive_configuration { fi if [[ $DDNS_PROVIDER=="default@freedns.afraid.org" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Blog FreeDNS subdomain code" 10 30 2> $data sel=$? @@ -651,6 +725,8 @@ function interactive_configuration { fi if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Owncloud domain name" 10 30 2> $data sel=$? @@ -665,6 +741,8 @@ function interactive_configuration { DOMAIN_NAME=$OWNCLOUD_DOMAIN_NAME fi if [[ $DDNS_PROVIDER=="default@freedns.afraid.org" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Owncloud FreeDNS subdomain code" 10 30 2> $data sel=$? @@ -684,6 +762,8 @@ function interactive_configuration { fi if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "RedMatrix domain name" 10 30 2> $data sel=$? @@ -698,6 +778,8 @@ function interactive_configuration { DOMAIN_NAME=$REDMATRIX_DOMAIN_NAME fi if [[ $DDNS_PROVIDER=="default@freedns.afraid.org" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "RedMatrix FreeDNS subdomain code" 10 30 2> $data sel=$? @@ -717,6 +799,8 @@ function interactive_configuration { fi if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Microblog domain name" 10 30 2> $data sel=$? @@ -728,6 +812,8 @@ function interactive_configuration { if [ $MICROBLOG_DOMAIN_NAME ]; then if [[ $DDNS_PROVIDER=="default@freedns.afraid.org" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Microblog FreeDNS subdomain code" 10 30 2> $data sel=$? @@ -744,6 +830,8 @@ function interactive_configuration { fi if [ ! $DOMAIN_NAME ]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Domain name" 10 30 2> $data sel=$? @@ -757,6 +845,8 @@ function interactive_configuration { fi if [[ $DDNS_PROVIDER=="default@freedns.afraid.org" ]]; then + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "FreeDNS subdomain code" 10 30 2> $data sel=$? @@ -771,6 +861,8 @@ function interactive_configuration { fi fi + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 dialog --backtitle "Freedombone Configuration" \ --inputbox "Your email address" 10 30 "$MY_USERNAME@$DOMAIN_NAME" 2> $data sel=$? @@ -783,7 +875,17 @@ function interactive_configuration { exit 8357 fi - #clear + save_configuration_file + + dialog --title "Encrypted backup to other servers" \ + --backtitle "Freedombone Configuration" \ + --defaultno \ + --yesno "\nDo you wish to configure some remote backup locations?" 7 60 + sel=$? + case $sel in + 0) interactive_configuration_remote_backups;; + esac + exit 0 }