Preparing interactive configuration for Hubzilla
This commit is contained in:
parent
7b68fa1847
commit
a17ed9867e
|
@ -31,6 +31,9 @@
|
|||
|
||||
NO_OF_ARGS=$#
|
||||
|
||||
# whether to enable hubzilla or redmatrix
|
||||
ENABLE_HUBZILLA="no"
|
||||
|
||||
# Web site
|
||||
FREEDOMBONE_WEBSITE="http://freedombone.uk.to"
|
||||
|
||||
|
@ -82,6 +85,8 @@ OWNCLOUD_DOMAIN_NAME=
|
|||
OWNCLOUD_CODE=
|
||||
REDMATRIX_DOMAIN_NAME=
|
||||
REDMATRIX_CODE=
|
||||
HUBZILLA_DOMAIN_NAME=
|
||||
HUBZILLA_CODE=
|
||||
MICROBLOG_DOMAIN_NAME=
|
||||
MICROBLOG_CODE=
|
||||
GIT_DOMAIN_NAME=
|
||||
|
@ -213,6 +218,12 @@ function save_configuration_file {
|
|||
if [ $REDMATRIX_CODE ]; then
|
||||
echo "REDMATRIX_CODE=$REDMATRIX_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if [ $HUBZILLA_DOMAIN_NAME ]; then
|
||||
echo "HUBZILLA_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if [ $HUBZILLA_CODE ]; then
|
||||
echo "HUBZILLA_CODE=$HUBZILLA_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if [ $MICROBLOG_DOMAIN_NAME ]; then
|
||||
echo "MICROBLOG_DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
|
@ -1223,51 +1234,101 @@ function interactive_configuration {
|
|||
fi
|
||||
|
||||
if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
|
||||
REDMATRIX_DETAILS_COMPLETE=
|
||||
while [ ! $REDMATRIX_DETAILS_COMPLETE ]
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
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 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
REDMATRIX_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
if [ $REDMATRIX_DOMAIN_NAME ]; then
|
||||
TEST_DOMAIN_NAME=$REDMATRIX_DOMAIN_NAME
|
||||
validate_domain_name
|
||||
if [[ $TEST_DOMAIN_NAME != $REDMATRIX_DOMAIN_NAME ]]; then
|
||||
REDMATRIX_DOMAIN_NAME=
|
||||
dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
|
||||
if [[ $ENABLE_HUBZILLA == "no" ]]; then
|
||||
REDMATRIX_DETAILS_COMPLETE=
|
||||
while [ ! $REDMATRIX_DETAILS_COMPLETE ]
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
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
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
REDMATRIX_CODE=$(cat $data | sed -n 2p)
|
||||
if [ ${#REDMATRIX_CODE} -lt 30 ]; then
|
||||
REDMATRIX_DOMAIN_NAME=
|
||||
dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
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 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
REDMATRIX_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
if [ $REDMATRIX_DOMAIN_NAME ]; then
|
||||
TEST_DOMAIN_NAME=$REDMATRIX_DOMAIN_NAME
|
||||
validate_domain_name
|
||||
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 30 ]; then
|
||||
REDMATRIX_DOMAIN_NAME=
|
||||
dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ $REDMATRIX_DOMAIN_NAME ]; then
|
||||
REDMATRIX_DETAILS_COMPLETE="yes"
|
||||
fi
|
||||
done
|
||||
if [ $REDMATRIX_DOMAIN_NAME ]; then
|
||||
REDMATRIX_DETAILS_COMPLETE="yes"
|
||||
fi
|
||||
done
|
||||
|
||||
else
|
||||
|
||||
HUBZILLA_DETAILS_COMPLETE=
|
||||
while [ ! $HUBZILLA_DETAILS_COMPLETE ]
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
dialog --backtitle "Freedombone Configuration" \
|
||||
--title "Hubzilla Configuration" \
|
||||
--form "\nPlease enter your Hubzilla details:" 11 55 3 \
|
||||
"Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
|
||||
"Code:" 2 1 "$(grep 'HUBZILLA_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 25 30 \
|
||||
2> $data
|
||||
else
|
||||
dialog --backtitle "Freedombone Configuration" \
|
||||
--title "Hubzilla Configuration" \
|
||||
--form "\nPlease enter your Hubzilla details:" 11 55 3 \
|
||||
"Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 25 30 \
|
||||
2> $data
|
||||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
HUBZILLA_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
if [ $HUBZILLA_DOMAIN_NAME ]; then
|
||||
TEST_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME
|
||||
validate_domain_name
|
||||
if [[ $TEST_DOMAIN_NAME != $HUBZILLA_DOMAIN_NAME ]]; then
|
||||
HUBZILLA_DOMAIN_NAME=
|
||||
dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
|
||||
else
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
HUBZILLA_CODE=$(cat $data | sed -n 2p)
|
||||
if [ ${#HUBZILLA_CODE} -lt 30 ]; then
|
||||
HUBZILLA_DOMAIN_NAME=
|
||||
dialog --title "FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ $HUBZILLA_DOMAIN_NAME ]; then
|
||||
HUBZILLA_DETAILS_COMPLETE="yes"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
save_configuration_file
|
||||
fi
|
||||
|
||||
|
@ -1301,6 +1362,9 @@ function interactive_configuration {
|
|||
if [[ $MICROBLOG_DOMAIN_NAME == "$REDMATRIX_DOMAIN_NAME" ]]; then
|
||||
MICROBLOG_DOMAIN_NAME=""
|
||||
fi
|
||||
if [[ $MICROBLOG_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then
|
||||
MICROBLOG_DOMAIN_NAME=""
|
||||
fi
|
||||
TEST_DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME
|
||||
validate_domain_name
|
||||
if [[ $TEST_DOMAIN_NAME != $MICROBLOG_DOMAIN_NAME ]]; then
|
||||
|
@ -1558,6 +1622,12 @@ function read_configuration {
|
|||
if grep -q "REDMATRIX_CODE" $CONFIGURATION_FILE; then
|
||||
REDMATRIX_CODE=$(grep "REDMATRIX_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||
HUBZILLA_DOMAIN_NAME=$(grep "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "HUBZILLA_CODE" $CONFIGURATION_FILE; then
|
||||
HUBZILLA_CODE=$(grep "HUBZILLA_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
|
||||
|
|
Loading…
Reference in New Issue