Interactive installs for individual apps
This commit is contained in:
parent
637cc7610b
commit
7a9678a785
|
@ -61,7 +61,97 @@ function configure_interactive_blog {
|
|||
}
|
||||
|
||||
function install_interactive_blog {
|
||||
echo -n ''
|
||||
if [ ! $ONION_ONLY ]; then
|
||||
ONION_ONLY='no'
|
||||
fi
|
||||
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
|
||||
ONION_ONLY=$(grep "ONION_ONLY" $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
|
||||
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 "DDNS_PROVIDER" $CONFIGURATION_FILE; then
|
||||
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
|
||||
if [[ $ONION_ONLY != "no" ]]; then
|
||||
MY_BLOG_TITLE='My Blog'
|
||||
FULLBLOG_DOMAIN_NAME='blog.local'
|
||||
else
|
||||
FULLBLOG_DETAILS_COMPLETE=
|
||||
while [ ! $FULLBLOG_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 $"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 33 40 \
|
||||
$"Domain:" 2 1 "$(grep 'FULLBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 33 40 \
|
||||
$"Code:" 3 1 "$(grep 'FULLBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 3 16 33 255 \
|
||||
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 33 40 \
|
||||
$"Domain:" 2 1 "$(grep 'FULLBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 33 40 \
|
||||
2> $data
|
||||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
MY_BLOG_TITLE=$(cat $data | sed -n 1p)
|
||||
FULLBLOG_DOMAIN_NAME=$(cat $data | sed -n 2p)
|
||||
if [ $FULLBLOG_DOMAIN_NAME ]; then
|
||||
if [[ $FULLBLOG_DOMAIN_NAME == "$WIKI_DOMAIN_NAME" ]]; then
|
||||
FULLBLOG_DOMAIN_NAME=""
|
||||
fi
|
||||
TEST_DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME
|
||||
validate_domain_name
|
||||
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)
|
||||
validate_freedns_code "$FULLBLOG_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
FULLBLOG_DOMAIN_NAME=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ $FULLBLOG_DOMAIN_NAME ]; then
|
||||
FULLBLOG_DETAILS_COMPLETE="yes"
|
||||
fi
|
||||
done
|
||||
|
||||
if grep -q "MY_BLOG_TITLE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MY_BLOG_TITLE=.*|MY_BLOG_TITLE=$MY_BLOG_TITLE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MY_BLOG_TITLE=$MY_BLOG_TITLE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "FULLBLOG_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|FULLBLOG_DOMAIN_NAME=.*|FULLBLOG_DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "FULLBLOG_DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "FULLBLOG_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|FULLBLOG_CODE=.*|FULLBLOG_CODE=$FULLBLOG_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "FULLBLOG_CODE=$FULLBLOG_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function change_password_blog {
|
||||
|
|
|
@ -54,7 +54,112 @@ GNUSOCIAL_NSFW_REPO="https://gitgud.io/ShitposterClub/SensitiveContent"
|
|||
GNUSOCIAL_NSFW_COMMIT='a096bbe0cfae9a9b177682920ffb58d32a48e136'
|
||||
|
||||
function install_interactive_gnusocial {
|
||||
echo -n ''
|
||||
if [ ! $ONION_ONLY ]; then
|
||||
ONION_ONLY='no'
|
||||
fi
|
||||
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
|
||||
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
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 "MICROBLOG_WELCOME_MESSAGE" $CONFIGURATION_FILE; then
|
||||
MICROBLOG_WELCOME_MESSAGE=$(grep "MICROBLOG_WELCOME_MESSAGE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "MICROBLOG_BACKGROUND_IMAGE_URL" $CONFIGURATION_FILE; then
|
||||
MICROBLOG_BACKGROUND_IMAGE_URL=$(grep "MICROBLOG_BACKGROUND_IMAGE_URL" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
|
||||
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if [[ $ONION_ONLY != "no" ]]; then
|
||||
MICROBLOG_DOMAIN_NAME='microblog.local'
|
||||
else
|
||||
MICROBLOG_DETAILS_COMPLETE=
|
||||
while [ ! $MICROBLOG_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 $"Microblog Configuration" \
|
||||
--form $"\nPlease enter your Microblog details. Welcome message and background image URL can be left blank.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
|
||||
$"Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
|
||||
$"Welcome Message:" 2 1 "$(grep '$MICROBLOG_WELCOME_MESSAGE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
|
||||
$"Background image URL:" 3 1 "$(grep '$MICROBLOG_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
|
||||
$"Code:" 4 1 "$(grep 'MICROBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 4 25 33 255 \
|
||||
2> $data
|
||||
else
|
||||
dialog --backtitle $"Freedombone Configuration" \
|
||||
--title $"Microblog Configuration" \
|
||||
--form $"\nPlease enter your Microblog details. Welcome message and background image URL can be left blank.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
|
||||
$"Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
|
||||
$"Welcome Message:" 2 1 "$(grep '$MICROBLOG_WELCOME_MESSAGE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
|
||||
$"Background image URL:" 3 1 "$(grep '$MICROBLOG_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
|
||||
2> $data
|
||||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
MICROBLOG_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
welcome_msg=$(cat $data | sed -n 2p)
|
||||
if [ ${#welcome_msg} -gt 1 ]; then
|
||||
MICROBLOG_WELCOME_MESSAGE=$welcome_msg
|
||||
fi
|
||||
img_url=$(cat $data | sed -n 3p)
|
||||
if [ ${#img_url} -gt 1 ]; then
|
||||
MICROBLOG_BACKGROUND_IMAGE_URL=$img_url
|
||||
fi
|
||||
if [ $MICROBLOG_DOMAIN_NAME ]; then
|
||||
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
|
||||
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 4p)
|
||||
validate_freedns_code "$MICROBLOG_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
MICROBLOG_DOMAIN_NAME=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ $MICROBLOG_DOMAIN_NAME ]; then
|
||||
MICROBLOG_DETAILS_COMPLETE="yes"
|
||||
fi
|
||||
done
|
||||
# save the results in the config file
|
||||
if grep -q "MICROBLOG_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MICROBLOG_DOMAIN_NAME=.*|MICROBLOG_DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MICROBLOG_DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "MICROBLOG_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MICROBLOG_CODE=.*|MICROBLOG_CODE=$MICROBLOG_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MICROBLOG_CODE=$MICROBLOG_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "MICROBLOG_WELCOME_MESSAGE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MICROBLOG_WELCOME_MESSAGE=.*|MICROBLOG_WELCOME_MESSAGE=$MICROBLOG_WELCOME_MESSAGE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MICROBLOG_WELCOME_MESSAGE=$MICROBLOG_WELCOME_MESSAGE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "MICROBLOG_BACKGROUND_IMAGE_URL=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MICROBLOG_BACKGROUND_IMAGE_URL=.*|MICROBLOG_BACKGROUND_IMAGE_URL=$MICROBLOG_BACKGROUND_IMAGE_URL|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MICROBLOG_BACKGROUND_IMAGE_URL=$MICROBLOG_BACKGROUND_IMAGE_URL" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function change_password_gnusocial {
|
||||
|
|
|
@ -40,7 +40,85 @@ GIT_ADMIN_PASSWORD=
|
|||
GOGS_BIN=
|
||||
|
||||
function install_interactive_gogs {
|
||||
echo -n ''
|
||||
if [ ! $ONION_ONLY ]; then
|
||||
ONION_ONLY='no'
|
||||
fi
|
||||
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
|
||||
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "GIT_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||
GIT_DOMAIN_NAME=$(grep "GIT_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "GIT_CODE" $CONFIGURATION_FILE; then
|
||||
GIT_CODE=$(grep "GIT_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
|
||||
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if [[ $ONION_ONLY != "no" ]]; then
|
||||
GIT_DOMAIN_NAME='git.local'
|
||||
else
|
||||
DEVELOPER_DETAILS_COMPLETE=
|
||||
while [ ! $DEVELOPER_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 $"Developer Configuration" \
|
||||
--form $"\nPlease enter your Git hosting site details.\nIf You don't need developer tools then just select Ok" 11 55 3 \
|
||||
$"Domain:" 1 1 "$(grep 'GIT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 33 40 \
|
||||
$"Code:" 2 1 "$(grep 'GIT_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 33 255 \
|
||||
2> $data
|
||||
else
|
||||
dialog --backtitle $"Freedombone Configuration" \
|
||||
--title $"Developer Configuration" \
|
||||
--form $"\nPlease enter your Git hosting site details.\nIf You don't need developer tools then just select Ok" 11 55 2 \
|
||||
$"Domain:" 1 1 "$(grep 'GIT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 33 40 \
|
||||
2> $data
|
||||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
GIT_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
if [ $GIT_DOMAIN_NAME ]; then
|
||||
TEST_DOMAIN_NAME=$GIT_DOMAIN_NAME
|
||||
validate_domain_name
|
||||
if [[ $TEST_DOMAIN_NAME != $GIT_DOMAIN_NAME ]]; then
|
||||
GIT_DOMAIN_NAME=
|
||||
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
|
||||
else
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
GIT_CODE=$(cat $data | sed -n 2p)
|
||||
validate_freedns_code "$GIT_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
GIT_DOMAIN_NAME=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
DEVELOPER_DETAILS_COMPLETE="yes"
|
||||
fi
|
||||
if [ $GIT_DOMAIN_NAME ]; then
|
||||
DEVELOPER_DETAILS_COMPLETE="yes"
|
||||
fi
|
||||
done
|
||||
|
||||
# save the results in the config file
|
||||
if grep -q "GIT_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|GIT_DOMAIN_NAME=.*|GIT_DOMAIN_NAME=$GIT_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "GIT_DOMAIN_NAME=$GIT_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "GIT_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|GIT_CODE=.*|GIT_CODE=$GIT_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "GIT_CODE=$GIT_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function change_password_gogs {
|
||||
|
|
|
@ -126,7 +126,81 @@ function configure_interactive_hubzilla {
|
|||
}
|
||||
|
||||
function install_interactive_hubzilla {
|
||||
echo -n ''
|
||||
if [ ! $ONION_ONLY ]; then
|
||||
ONION_ONLY='no'
|
||||
fi
|
||||
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
|
||||
ONION_ONLY=$(grep "ONION_ONLY" $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 "DDNS_PROVIDER" $CONFIGURATION_FILE; then
|
||||
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if [[ $ONION_ONLY != "no" ]]; then
|
||||
HUBZILLA_DOMAIN_NAME='hubzilla.local'
|
||||
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.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 55 3 \
|
||||
$"Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 33 40 \
|
||||
$"Code:" 2 1 "$(grep 'HUBZILLA_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 33 255 \
|
||||
2> $data
|
||||
else
|
||||
dialog --backtitle $"Freedombone Configuration" \
|
||||
--title $"Hubzilla Configuration" \
|
||||
--form $"\nPlease enter your Hubzilla details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 11 55 3 \
|
||||
$"Domain:" 1 1 "$(grep 'HUBZILLA_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 33 40 \
|
||||
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)
|
||||
validate_freedns_code "$HUBZILLA_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
HUBZILLA_DOMAIN_NAME=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ $HUBZILLA_DOMAIN_NAME ]; then
|
||||
HUBZILLA_DETAILS_COMPLETE="yes"
|
||||
fi
|
||||
done
|
||||
# save the results in the config file
|
||||
if grep -q "HUBZILLA_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|HUBZILLA_DOMAIN_NAME=.*|HUBZILLA_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "HUBZILLA_DOMAIN_NAME=$HUBZILLA_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "HUBZILLA_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|HUBZILLA_CODE=.*|HUBZILLA_CODE=$HUBZILLA_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "HUBZILLA_CODE=$HUBZILLA_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function change_password_hubzilla {
|
||||
|
|
|
@ -38,7 +38,85 @@ MEDIAGOBLIN_ADMIN_PASSWORD=
|
|||
MEDIAGOBLIN_ONION_PORT=8096
|
||||
|
||||
function install_interactive_mediagoblin {
|
||||
echo -n ''
|
||||
if [ ! $ONION_ONLY ]; then
|
||||
ONION_ONLY='no'
|
||||
fi
|
||||
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
|
||||
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "MEDIAGOBLIN_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||
MEDIAGOBLIN_DOMAIN_NAME=$(grep "MEDIAGOBLIN_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE; then
|
||||
MEDIAGOBLIN_CODE=$(grep "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "DDNS_PROVIDER" $CONFIGURATION_FILE; then
|
||||
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if [[ $ONION_ONLY != "no" ]]; then
|
||||
MEDIAGOBLIN_DOMAIN_NAME='media.local'
|
||||
else
|
||||
MEDIAGOBLIN_DETAILS_COMPLETE=
|
||||
while [ ! $MEDIAGOBLIN_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 $"Mediagoblin Configuration" \
|
||||
--form $"\nPlease enter your Mediagoblin details, or just select Ok if you don't need a Mediagoblin site:" 11 55 2 \
|
||||
$"Domain:" 1 1 "$(grep 'MEDIAGOBLIN_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 33 40 \
|
||||
$"Code:" 2 1 "$(grep 'MEDIAGOBLIN_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 16 33 255 \
|
||||
2> $data
|
||||
else
|
||||
dialog --backtitle $"Freedombone Configuration" \
|
||||
--title $"Mediagoblin Configuration" \
|
||||
--form $"\nPlease enter your Mediagoblin details, or just select Ok if you don't need a Mediagoblin site:" 11 55 2 \
|
||||
$"Domain:" 1 1 "$(grep 'MEDIAGOBLIN_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 16 33 40 \
|
||||
2> $data
|
||||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
MEDIAGOBLIN_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
if [ $MEDIAGOBLIN_DOMAIN_NAME ]; then
|
||||
TEST_DOMAIN_NAME=$MEDIAGOBLIN_DOMAIN_NAME
|
||||
validate_domain_name
|
||||
if [[ $TEST_DOMAIN_NAME != $MEDIAGOBLIN_DOMAIN_NAME ]]; then
|
||||
MEDIAGOBLIN_DOMAIN_NAME='invalid'
|
||||
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
|
||||
else
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
MEDIAGOBLIN_CODE=$(cat $data | sed -n 2p)
|
||||
validate_freedns_code "$MEDIAGOBLIN_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
MEDIAGOBLIN_DOMAIN_NAME='invalid'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ $MEDIAGOBLIN_DOMAIN_NAME ]; then
|
||||
if [[ $MEDIAGOBLIN_DOMAIN_NAME == 'invalid' ]]; then
|
||||
MEDIAGOBLIN_DOMAIN_NAME=
|
||||
else
|
||||
MEDIAGOBLIN_DETAILS_COMPLETE="yes"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# save the results in the config file
|
||||
if grep -q "MEDIAGOBLIN_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MEDIAGOBLIN_DOMAIN_NAME=.*|MEDIAGOBLIN_DOMAIN_NAME=$MEDIAGOBLIN_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MEDIAGOBLIN_DOMAIN_NAME=$MEDIAGOBLIN_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "MEDIAGOBLIN_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|MEDIAGOBLIN_CODE=.*|MEDIAGOBLIN_CODE=$MEDIAGOBLIN_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "MEDIAGOBLIN_CODE=$MEDIAGOBLIN_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function change_password_mediagoblin {
|
||||
|
|
|
@ -37,7 +37,96 @@ WIKI_CODE=
|
|||
WIKI_ONION_PORT=8089
|
||||
|
||||
function install_interactive_wiki {
|
||||
echo -n ''
|
||||
if [ ! $ONION_ONLY ]; then
|
||||
ONION_ONLY='no'
|
||||
fi
|
||||
if grep -q "ONION_ONLY" $CONFIGURATION_FILE; then
|
||||
ONION_ONLY=$(grep "ONION_ONLY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
if grep -q "WIKI_TITLE" $CONFIGURATION_FILE; then
|
||||
WIKI_TITLE=$(grep "WIKI_TITLE" $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 "DDNS_PROVIDER" $CONFIGURATION_FILE; then
|
||||
DDNS_PROVIDER=$(grep "DDNS_PROVIDER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||
fi
|
||||
|
||||
if [[ $ONION_ONLY != "no" ]]; then
|
||||
WIKI_TITLE=$'My Wiki'
|
||||
WIKI_DOMAIN_NAME='wiki.local'
|
||||
else
|
||||
WIKI_DETAILS_COMPLETE=
|
||||
while [ ! $WIKI_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 $"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 33 40 \
|
||||
$"Domain:" 2 1 "$(grep 'WIKI_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 33 40 \
|
||||
$"Code:" 3 1 "$(grep 'WIKI_CODE' temp.cfg | awk -F '=' '{print $2}')" 3 16 33 255 \
|
||||
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 33 40 \
|
||||
$"Domain:" 2 1 "$(grep 'WIKI_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2 16 33 40 \
|
||||
2> $data
|
||||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
WIKI_TITLE=$(cat $data | sed -n 1p)
|
||||
WIKI_DOMAIN_NAME=$(cat $data | sed -n 2p)
|
||||
if [ $WIKI_DOMAIN_NAME ]; then
|
||||
TEST_DOMAIN_NAME=$WIKI_DOMAIN_NAME
|
||||
validate_domain_name
|
||||
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)
|
||||
validate_freedns_code "$WIKI_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
WIKI_DOMAIN_NAME=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ $WIKI_DOMAIN_NAME ]; then
|
||||
WIKI_DETAILS_COMPLETE="yes"
|
||||
fi
|
||||
done
|
||||
|
||||
# save the results in the config file
|
||||
if grep -q "WIKI_TITLE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|WIKI_TITLE=.*|WIKI_TITLE=$WIKI_TITLE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "WIKI_TITLE=$WIKI_TITLE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "WIKI_DOMAIN_NAME=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|WIKI_DOMAIN_NAME=.*|WIKI_DOMAIN_NAME=$WIKI_DOMAIN_NAME|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "WIKI_DOMAIN_NAME=$WIKI_DOMAIN_NAME" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
if grep -q "WIKI_CODE=" $CONFIGURATION_FILE; then
|
||||
sed -i "s|WIKI_CODE=.*|WIKI_CODE=$WIKI_CODE|g" $CONFIGURATION_FILE
|
||||
else
|
||||
echo "WIKI_CODE=$WIKI_CODE" >> $CONFIGURATION_FILE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function change_password_wiki {
|
||||
|
|
|
@ -224,6 +224,7 @@ function remove_apps {
|
|||
|
||||
function install_apps {
|
||||
is_interactive=$1
|
||||
|
||||
app_index=0
|
||||
for a in "${APPS_AVAILABLE[@]}"
|
||||
do
|
||||
|
@ -235,6 +236,16 @@ function install_apps {
|
|||
install_interactive_${a}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
app_index=$[app_index+1]
|
||||
done
|
||||
|
||||
app_index=0
|
||||
for a in "${APPS_AVAILABLE[@]}"
|
||||
do
|
||||
if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
|
||||
if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
|
||||
echo $"Installing application: ${a}"
|
||||
install_${a}
|
||||
echo $"${a} was installed"
|
||||
|
@ -242,6 +253,7 @@ function install_apps {
|
|||
fi
|
||||
app_index=$[app_index+1]
|
||||
done
|
||||
|
||||
update_installed_apps_list
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# .---. . .
|
||||
# | | |
|
||||
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
||||
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
||||
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
||||
#
|
||||
# Freedom in the Cloud
|
||||
#
|
||||
# Validation functions
|
||||
#
|
||||
# License
|
||||
# =======
|
||||
#
|
||||
# Copyright (C) 2014-2016 Bob Mottram <bob@robotics.uk.to>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# If this file exists it contains a global password used with
|
||||
# disk image installs. This simplifies password management for
|
||||
# deployment at scale
|
||||
|
||||
function validate_domain_name {
|
||||
# count the number of dots in the domain name
|
||||
dots=${TEST_DOMAIN_NAME//[^.]}
|
||||
no_of_dots=${#dots}
|
||||
if (( no_of_dots > 3 )); then
|
||||
TEST_DOMAIN_NAME="The domain $TEST_DOMAIN_NAME has too many subdomains. It should be of the type w.x.y.z, x.y.z or y.z"
|
||||
fi
|
||||
if (( no_of_dots == 0 )); then
|
||||
TEST_DOMAIN_NAME="The domain $TEST_DOMAIN_NAME has no top level domain. It should be of the type w.x.y.z, x.y.z or y.z"
|
||||
fi
|
||||
}
|
||||
|
||||
function validate_freedns_code {
|
||||
freedns_code="$1"
|
||||
|
||||
FREEDNS_MESSAGE=$"Please enter the FreeDNS code for this domain.\n\nThe code can be found by going to https://freedns.afraid.org, selecting 'Dynamic DNS' and then opening 'Wget example'. The code will consist of letters and numbers and be between the ? and = characters."
|
||||
|
||||
if [[ "$freedns_code" == *"."* || "$freedns_code" == "http"* || "$freedns_code" == *"wget "* || "$freedns_code" == *" "* ]]; then
|
||||
dialog --title $"Invalid FreeDNS Code" --msgbox "$FREEDNS_MESSAGE" 10 70
|
||||
VALID_CODE=
|
||||
fi
|
||||
if [ ${#freedns_code} -lt 30 ]; then
|
||||
dialog --title $"Invalid FreeDNS Code" --msgbox $'FreeDNS code is too short. Did you enter the entire code?' 6 70
|
||||
VALID_CODE=
|
||||
fi
|
||||
VALID_CODE='yes'
|
||||
}
|
||||
|
||||
# NOTE: deliberately no exit 0
|
Loading…
Reference in New Issue