diff --git a/src/freedombone b/src/freedombone index 4a5f0d63..dee545d0 100755 --- a/src/freedombone +++ b/src/freedombone @@ -130,26 +130,31 @@ MEDIAGOBLIN_ADMIN_PASSWORD= # Domain name for microblog installation MICROBLOG_DOMAIN_NAME= +MICROBLOG_CODE= MICROBLOG_REPO="git://gitorious.org/social/mainline.git" MICROBLOG_ADMIN_PASSWORD= # Domain name or redmatrix installation REDMATRIX_DOMAIN_NAME= +REDMATRIX_CODE= REDMATRIX_REPO="https://github.com/friendica/red.git" REDMATRIX_ADDONS_REPO="https://github.com/friendica/red-addons.git" REDMATRIX_ADMIN_PASSWORD= # Domain name for Owncloud installation OWNCLOUD_DOMAIN_NAME= +OWNCLOUD_CODE= OWNCLOUD_ADMIN_PASSWORD= # Domain name for your wiki WIKI_DOMAIN_NAME= WIKI_ADMIN_PASSWORD= WIKI_TITLE="Freedombone Wiki" +WIKI_CODE= # Domain name for your blog FULLBLOG_DOMAIN_NAME= +FULLBLOG_CODE= MY_BLOG_TITLE="My Blog" MY_BLOG_SUBTITLE="Another Freedombone Blog" @@ -803,18 +808,33 @@ function read_configuration { if grep -q "MICROBLOG_DOMAIN_NAME" $CONFIGURATION_FILE; then MICROBLOG_DOMAIN_NAME=$(grep "MICROBLOG_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "MICROBLOG_CODE" $CONFIGURATION_FILE; then + MICROBLOG_CODE=$(grep "MICROBLOG_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "REDMATRIX_DOMAIN_NAME" $CONFIGURATION_FILE; then REDMATRIX_DOMAIN_NAME=$(grep "REDMATRIX_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "REDMATRIX_CODE" $CONFIGURATION_FILE; then + REDMATRIX_CODE=$(grep "REDMATRIX_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "OWNCLOUD_DOMAIN_NAME" $CONFIGURATION_FILE; then OWNCLOUD_DOMAIN_NAME=$(grep "OWNCLOUD_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "OWNCLOUD_CODE" $CONFIGURATION_FILE; then + OWNCLOUD_CODE=$(grep "OWNCLOUD_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "WIKI_DOMAIN_NAME" $CONFIGURATION_FILE; then WIKI_DOMAIN_NAME=$(grep "WIKI_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "WIKI_CODE" $CONFIGURATION_FILE; then + WIKI_CODE=$(grep "WIKI_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE; then FULLBLOG_DOMAIN_NAME=$(grep "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "FULLBLOG_CODE" $CONFIGURATION_FILE; then + FULLBLOG_CODE=$(grep "FULLBLOG_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "MY_BLOG_TITLE" $CONFIGURATION_FILE; then MY_BLOG_TITLE=$(grep "MY_BLOG_TITLE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi diff --git a/src/freedombone-config b/src/freedombone-config index 0a6ee263..2e598cc2 100755 --- a/src/freedombone-config +++ b/src/freedombone-config @@ -69,11 +69,16 @@ NAMESERVER1= NAMESERVER2= WIKI_TITLE= WIKI_DOMAIN_NAME= +WIKI_CODE= MY_BLOG_TITLE= FULLBLOG_DOMAIN_NAME= +FULLBLOG_CODE= OWNCLOUD_DOMAIN_NAME= +OWNCLOUD_CODE= REDMATRIX_DOMAIN_NAME= +REDMATRIX_CODE= MICROBLOG_DOMAIN_NAME= +MICROBLOG_CODE= CONFIGURATION_FILE= @@ -157,21 +162,36 @@ function save_configuration_file { if [ $WIKI_DOMAIN_NAME ]; then echo "WIKI_DOMAIN_NAME=$WIKI_DOMAIN_NAME" >> $CONFIGURATION_FILE fi + if [ $WIKI_CODE ]; then + echo "WIKI_CODE=$WIKI_CODE" >> $CONFIGURATION_FILE + fi if [ $MY_BLOG_TITLE ]; then echo "MY_BLOG_TITLE=$MY_BLOG_TITLE" >> $CONFIGURATION_FILE fi if [ $FULLBLOG_DOMAIN_NAME ]; then echo "FULLBLOG_DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME" >> $CONFIGURATION_FILE fi + if [ $FULLBLOG_CODE ]; then + echo "FULLBLOG_CODE=$FULLBLOG_CODE" >> $CONFIGURATION_FILE + fi if [ $OWNCLOUD_DOMAIN_NAME ]; then echo "OWNCLOUD_DOMAIN_NAME=$OWNCLOUD_DOMAIN_NAME" >> $CONFIGURATION_FILE fi + if [ $OWNCLOUD_CODE ]; then + echo "OWNCLOUD_CODE=$OWNCLOUD_CODE" >> $CONFIGURATION_FILE + fi if [ $REDMATRIX_DOMAIN_NAME ]; then echo "REDMATRIX_DOMAIN_NAME=$REDMATRIX_DOMAIN_NAME" >> $CONFIGURATION_FILE fi + if [ $REDMATRIX_CODE ]; then + echo "REDMATRIX_CODE=$REDMATRIX_CODE" >> $CONFIGURATION_FILE + fi if [ $MICROBLOG_DOMAIN_NAME ]; then echo "MICROBLOG_DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME" >> $CONFIGURATION_FILE fi + if [ $MICROBLOG_CODE ]; then + echo "MICROBLOG_CODE=$MICROBLOG_CODE" >> $CONFIGURATION_FILE + fi } # test a domain name to see if it's valid @@ -194,6 +214,8 @@ function interactive_configuration { cp $CONFIGURATION_FILE temp.cfg fi + FREEDNS_MESSAGE="Please enter the FreeDNS code for this domain" + dialog --title "Freedombone" --msgbox "Welcome to the Freedombone interactive installer. Communications freedom is only a short time away.\n\nEnsure that you have your domain and dynamic DNS settings ready.\n\nFor more information please visit $FREEDOMBONE_WEBSITE or send a Bitmessage to $FREEDOMBONE_BITMESSAGE" 15 50 data=$(tempfile 2>/dev/null) @@ -585,16 +607,28 @@ function interactive_configuration { save_configuration_file if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then - while [ ! $WIKI_DOMAIN_NAME ] + WIKI_DETAILS_COMPLETE= + while [ ! $WIKI_DETAILS_COMPLETE ] do data=$(tempfile 2>/dev/null) trap "rm -f $data" 0 1 2 5 15 - dialog --backtitle "Freedombone Configuration" \ - --title "Wiki Configuration" \ - --form "\nPlease enter your wiki details:" 11 55 3 \ - "Title:" 1 1 "$(grep 'WIKI_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \ - "Domain:" 2 1 "$(grep 'WIKI_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 40 \ - 2> $data + + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + dialog --backtitle "Freedombone Configuration" \ + --title "Wiki Configuration" \ + --form "\nPlease enter your wiki details:" 11 55 4 \ + "Title:" 1 1 "$(grep 'WIKI_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \ + "Domain:" 2 1 "$(grep 'WIKI_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 40 \ + "Code:" 3 1 "$(grep 'WIKI_CODE' temp.cfg | awk -F '=' '{print $2}')" 3 16 25 40 \ + 2> $data + else + dialog --backtitle "Freedombone Configuration" \ + --title "Wiki Configuration" \ + --form "\nPlease enter your wiki details:" 11 55 3 \ + "Title:" 1 1 "$(grep 'WIKI_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 40 \ + "Domain:" 2 1 "$(grep 'WIKI_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 40 \ + 2> $data + fi sel=$? case $sel in 1) exit 0;; @@ -608,23 +642,45 @@ function interactive_configuration { if [[ $TEST_DOMAIN_NAME != $WIKI_DOMAIN_NAME ]]; then WIKI_DOMAIN_NAME= dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50 + else + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + WIKI_CODE=$(cat $data | sed -n 3p) + if [ ${#WIKI_CODE} -lt 5 ]; then + WIKI_DOMAIN_NAME= + dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 + fi + fi fi fi + if [ $WIKI_DOMAIN_NAME ]; then + WIKI_DETAILS_COMPLETE="yes" + fi done save_configuration_file fi if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then - while [ ! $FULLBLOG_DOMAIN_NAME ] + FULLBLOG_DETAILS_COMPLETE= + while [ ! $FULLBLOG_DETAILS_COMPLETE ] do data=$(tempfile 2>/dev/null) trap "rm -f $data" 0 1 2 5 15 - dialog --backtitle "Freedombone Configuration" \ - --title "Blog Configuration" \ - --form "\nPlease enter your blog details:" 11 55 3 \ - "Title:" 1 1 "$(grep 'MY_BLOG_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ - "Domain:" 2 1 "$(grep 'FULLBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ - 2> $data + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + dialog --backtitle "Freedombone Configuration" \ + --title "Blog Configuration" \ + --form "\nPlease enter your blog details:" 11 55 4 \ + "Title:" 1 1 "$(grep 'MY_BLOG_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ + "Domain:" 2 1 "$(grep 'FULLBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ + "Code:" 3 1 "$(grep 'FULLBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 3 16 25 30 \ + 2> $data + else + dialog --backtitle "Freedombone Configuration" \ + --title "Blog Configuration" \ + --form "\nPlease enter your blog details:" 11 55 3 \ + "Title:" 1 1 "$(grep 'MY_BLOG_TITLE' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ + "Domain:" 2 1 "$(grep 'FULLBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ + 2> $data + fi sel=$? case $sel in 1) exit 0;; @@ -641,22 +697,43 @@ function interactive_configuration { if [[ $TEST_DOMAIN_NAME != $FULLBLOG_DOMAIN_NAME ]]; then FULLBLOG_DOMAIN_NAME= dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50 + else + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + FULLBLOG_CODE=$(cat $data | sed -n 3p) + if [ ${#FULLBLOG_CODE} -lt 5 ]; then + FULLBLOG_DOMAIN_NAME= + dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 + fi + fi fi fi + if [ $FULLBLOG_DOMAIN_NAME ]; then + FULLBLOG_DETAILS_COMPLETE="yes" + fi done save_configuration_file fi if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then - while [ ! $OWNCLOUD_DOMAIN_NAME ] + OWNCLOUD_DETAILS_COMPLETE= + while [ ! $OWNCLOUD_DETAILS_COMPLETE ] do data=$(tempfile 2>/dev/null) trap "rm -f $data" 0 1 2 5 15 - dialog --backtitle "Freedombone Configuration" \ - --title "Owncloud Configuration" \ - --form "\nPlease enter your Owncloud details:" 11 55 3 \ - "Domain:" 1 1 "$(grep 'OWNCLOUD_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ - 2> $data + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + dialog --backtitle "Freedombone Configuration" \ + --title "Owncloud Configuration" \ + --form "\nPlease enter your Owncloud details:" 11 55 3 \ + "Domain:" 1 1 "$(grep 'OWNCLOUD_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ + "Code:" 2 1 "$(grep 'OWNCLOUD_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ + 2> $data + else + dialog --backtitle "Freedombone Configuration" \ + --title "Owncloud Configuration" \ + --form "\nPlease enter your Owncloud details:" 11 55 3 \ + "Domain:" 1 1 "$(grep 'OWNCLOUD_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ + 2> $data + fi sel=$? case $sel in 1) exit 0;; @@ -669,22 +746,43 @@ function interactive_configuration { if [[ $TEST_DOMAIN_NAME != $OWNCLOUD_DOMAIN_NAME ]]; then OWNCLOUD_DOMAIN_NAME= dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50 + else + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + OWNCLOUD_CODE=$(cat $data | sed -n 2p) + if [ ${#OWNCLOUD_CODE} -lt 5 ]; then + OWNCLOUD_DOMAIN_NAME= + dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 + fi + fi fi fi + if [ $OWNCLOUD_DOMAIN_NAME ]; then + OWNCLOUD_DETAILS_COMPLETE="yes" + fi done save_configuration_file fi if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then - while [ ! $REDMATRIX_DOMAIN_NAME ] + REDMATRIX_DETAILS_COMPLETE= + while [ ! $REDMATRIX_DETAILS_COMPLETE ] do data=$(tempfile 2>/dev/null) trap "rm -f $data" 0 1 2 5 15 - dialog --backtitle "Freedombone Configuration" \ - --title "RedMatrix Configuration" \ - --form "\nPlease enter your RedMatrix details:" 11 55 3 \ - "Domain:" 1 1 "$(grep 'REDMATRIX_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ - 2> $data + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + dialog --backtitle "Freedombone Configuration" \ + --title "RedMatrix Configuration" \ + --form "\nPlease enter your RedMatrix details:" 11 55 3 \ + "Domain:" 1 1 "$(grep 'REDMATRIX_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ + "Code:" 2 1 "$(grep 'REDMATRIX_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ + 2> $data + else + dialog --backtitle "Freedombone Configuration" \ + --title "RedMatrix Configuration" \ + --form "\nPlease enter your RedMatrix details:" 11 55 3 \ + "Domain:" 1 1 "$(grep 'REDMATRIX_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ + 2> $data + fi sel=$? case $sel in 1) exit 0;; @@ -697,22 +795,43 @@ function interactive_configuration { if [[ $TEST_DOMAIN_NAME != $REDMATRIX_DOMAIN_NAME ]]; then REDMATRIX_DOMAIN_NAME= dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50 + else + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + REDMATRIX_CODE=$(cat $data | sed -n 2p) + if [ ${#REDMATRIX_CODE} -lt 5 ]; then + REDMATRIX_DOMAIN_NAME= + dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 + fi + fi fi fi + if [ $REDMATRIX_DOMAIN_NAME ]; then + REDMATRIX_DETAILS_COMPLETE="yes" + fi done save_configuration_file fi if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then - while [ ! $MICROBLOG_DOMAIN_NAME ] + MICROBLOG_DETAILS_COMPLETE= + while [ ! $MICROBLOG_DETAILS_COMPLETE ] do data=$(tempfile 2>/dev/null) trap "rm -f $data" 0 1 2 5 15 - dialog --backtitle "Freedombone Configuration" \ - --title "Microblog Configuration" \ - --form "\nPlease enter your Microblog details:" 11 55 3 \ - "Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ - 2> $data + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + dialog --backtitle "Freedombone Configuration" \ + --title "Microblog Configuration" \ + --form "\nPlease enter your Microblog details:" 11 55 3 \ + "Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ + "Code:" 2 1 "$(grep 'MICROBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \ + 2> $data + else + dialog --backtitle "Freedombone Configuration" \ + --title "Microblog Configuration" \ + --form "\nPlease enter your Microblog details:" 11 55 3 \ + "Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \ + 2> $data + fi sel=$? case $sel in 1) exit 0;; @@ -728,8 +847,19 @@ function interactive_configuration { if [[ $TEST_DOMAIN_NAME != $MICROBLOG_DOMAIN_NAME ]]; then MICROBLOG_DOMAIN_NAME= dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50 + else + if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then + MICROBLOG_CODE=$(cat $data | sed -n 2p) + if [ ${#MICROBLOG_CODE} -lt 5 ]; then + MICROBLOG_DOMAIN_NAME= + dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 + fi + fi fi fi + if [ $MICROBLOG_DOMAIN_NAME ]; then + MICROBLOG_DETAILS_COMPLETE="yes" + fi done save_configuration_file fi @@ -851,18 +981,33 @@ function read_configuration { if grep -q "MICROBLOG_DOMAIN_NAME" $CONFIGURATION_FILE; then MICROBLOG_DOMAIN_NAME=$(grep "MICROBLOG_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "MICROBLOG_CODE" $CONFIGURATION_FILE; then + MICROBLOG_CODE=$(grep "MICROBLOG_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "REDMATRIX_DOMAIN_NAME" $CONFIGURATION_FILE; then REDMATRIX_DOMAIN_NAME=$(grep "REDMATRIX_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "REDMATRIX_CODE" $CONFIGURATION_FILE; then + REDMATRIX_CODE=$(grep "REDMATRIX_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "OWNCLOUD_DOMAIN_NAME" $CONFIGURATION_FILE; then OWNCLOUD_DOMAIN_NAME=$(grep "OWNCLOUD_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "OWNCLOUD_CODE" $CONFIGURATION_FILE; then + OWNCLOUD_CODE=$(grep "OWNCLOUD_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "WIKI_DOMAIN_NAME" $CONFIGURATION_FILE; then WIKI_DOMAIN_NAME=$(grep "WIKI_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "WIKI_CODE" $CONFIGURATION_FILE; then + WIKI_CODE=$(grep "WIKI_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE; then FULLBLOG_DOMAIN_NAME=$(grep "FULLBLOG_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi + if grep -q "FULLBLOG_CODE" $CONFIGURATION_FILE; then + FULLBLOG_CODE=$(grep "FULLBLOG_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi if grep -q "MY_BLOG_TITLE" $CONFIGURATION_FILE; then MY_BLOG_TITLE=$(grep "MY_BLOG_TITLE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi