diff --git a/src/freedombone b/src/freedombone index 042c3a02..8d72a263 100755 --- a/src/freedombone +++ b/src/freedombone @@ -200,6 +200,7 @@ MICROBLOG_COMMIT='771f08b3c761ff122c3fff7bdb13ec6625828018' MICROBLOG_THEME_REPO="https://git.gnu.io/h2p/Qvitter.git" MICROBLOG_THEME_COMMIT='8abbdeb3c0a6a34754411452ae832d2f19cef7ab' MICROBLOG_WELCOME_MESSAGE=$'
Another Freedombone site
' +MICROBLOG_BACKGROUND_IMAGE_URL= # Domain name for hubzilla installation HUBZILLA_DOMAIN_NAME= @@ -1023,6 +1024,9 @@ function read_configuration { if [[ $CONFIGURATION_FILE != "/root/${PROJECT_NAME}.cfg" ]]; then cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg 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 "MICROBLOG_WELCOME_MESSAGE" $CONFIGURATION_FILE; then MICROBLOG_WELCOME_MESSAGE=$(grep "MICROBLOG_WELCOME_MESSAGE" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi @@ -8609,6 +8613,8 @@ function install_gnu_social_theme { return fi + apt-get -y install wget + if [ ! -d /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins ]; then mkdir -p /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins fi @@ -8618,6 +8624,17 @@ function install_gnu_social_theme { cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins/Qvitter git checkout $MICROBLOG_THEME_COMMIT -b $MICROBLOG_THEME_COMMIT + # download a custom background image + if [ $MICROBLOG_BACKGROUND_IMAGE_URL ]; then + MICROBLOG_BACKGROUND_IMAGE_URL_EXT=$(echo $MICROBLOG_BACKGROUND_IMAGE_URL | awk -F '.' '{print $2}') + wget $MICROBLOG_BACKGROUND_IMAGE_URL -o img/custom.${MICROBLOG_BACKGROUND_IMAGE_URL_EXT} + if [ ! -f img/custom.${MICROBLOG_BACKGROUND_IMAGE_URL_EXT} ]; then + echo "$MICROBLOG_BACKGROUND_IMAGE_URL" + echo $'Custom background image for microblog could not be downloaded' + exit 87524 + fi + fi + microblog_config_file=/var/www/$MICROBLOG_DOMAIN_NAME/htdocs/config.php if ! grep -q "addPlugin('Qvitter')" $microblog_config_file; then MICROBLOG_WELCOME_MESSAGE=$(echo $MICROBLOG_WELCOME_MESSAGE | sed "s|\$MICROBLOG_DOMAIN_NAME|$MICROBLOG_DOMAIN_NAME|g") @@ -8630,7 +8647,11 @@ function install_gnu_social_theme { echo "\$config['site']['qvitter']['timebetweenpolling'] = 120000; // two minutes" >> $microblog_config_file echo "\$config['site']['qvitter']['urlshortenerapiurl'] = 'http://qttr.at/shortener.php';" >> $microblog_config_file echo "\$config['site']['qvitter']['urlshortenersignature'] = 'b6afeec983';" >> $microblog_config_file - echo "\$config['site']['qvitter']['sitebackground'] = 'img/vagnsmossen.jpg';" >> $microblog_config_file + if [ $MICROBLOG_BACKGROUND_IMAGE_URL ]; then + echo "\$config['site']['qvitter']['sitebackground'] = 'img/custom.${MICROBLOG_BACKGROUND_IMAGE_URL_EXT}';" >> $microblog_config_file + else + echo "\$config['site']['qvitter']['sitebackground'] = 'img/vagnsmossen.jpg';" >> $microblog_config_file + fi echo "\$config['site']['qvitter']['favicon'] = 'img/favicon.ico?v=4';" >> $microblog_config_file echo "\$config['site']['qvitter']['sprite'] = Plugin::staticPath('Qvitter', '').'img/sprite.png?v=40';" >> $microblog_config_file echo "\$config['site']['qvitter']['enablewelcometext'] = true;" >> $microblog_config_file @@ -8639,6 +8660,10 @@ function install_gnu_social_theme { echo "\$config['site']['qvitter']['customwelcometext']['fr'] = '$MICROBLOG_WELCOME_MESSAGE';" >> $microblog_config_file echo "\$config['site']['qvitter']['customwelcometext']['es'] = '$MICROBLOG_WELCOME_MESSAGE';" >> $microblog_config_file echo "\$config['site']['qvitter']['blocked_ips'] = array();" >> $microblog_config_file + else + if [ -f img/custom.${MICROBLOG_BACKGROUND_IMAGE_URL_EXT} ]; then + sed -i "s|\$config['site']['qvitter']['sitebackground'].*|\$config['site']['qvitter']['sitebackground'] = 'img/custom.${MICROBLOG_BACKGROUND_IMAGE_URL_EXT}';|g" $microblog_config_file + fi fi if ! grep -q "GNU Social theme commit" $COMPLETION_FILE; then diff --git a/src/freedombone-config b/src/freedombone-config index 1802a411..6c25f5e5 100755 --- a/src/freedombone-config +++ b/src/freedombone-config @@ -96,6 +96,7 @@ HUBZILLA_CODE= MICROBLOG_DOMAIN_NAME= MICROBLOG_CODE= MICROBLOG_WELCOME_MESSAGE=$"Another $PROJECT_NAME site
" +MICROBLOG_BACKGROUND_IMAGE_URL= GIT_DOMAIN_NAME= GIT_CODE= MEDIAGOBLIN_DOMAIN_NAME= @@ -261,6 +262,9 @@ function save_configuration_file { if [ $MICROBLOG_WELCOME_MESSAGE ]; then echo "MICROBLOG_WELCOME_MESSAGE=$MICROBLOG_WELCOME_MESSAGE" >> $CONFIGURATION_FILE fi + if [ $MICROBLOG_BACKGROUND_IMAGE_URL ]; then + echo "MICROBLOG_BACKGROUND_IMAGE_URL=$MICROBLOG_BACKGROUND_IMAGE_URL" >> $CONFIGURATION_FILE + fi if [ $GIT_DOMAIN_NAME ]; then echo "GIT_DOMAIN_NAME=$GIT_DOMAIN_NAME" >> $CONFIGURATION_FILE fi @@ -1576,17 +1580,19 @@ function interactive_configuration { if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then dialog --backtitle $"Freedombone Configuration" \ --title $"Microblog Configuration" \ - --form $"\nPlease enter your Microblog details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 3 \ - $"Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 20 25 30 \ - $"Welcome Message:" 2 1 "$(grep '$MICROBLOG_WELCOME_MESSAGE' temp.cfg | awk -F '=' '{print $2}')" 3 20 50 30 \ - $"Code:" 3 1 "$(grep 'MICROBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 20 25 30 \ + --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 25 30 \ + $"Welcome Message:" 2 1 "$(grep '$MICROBLOG_WELCOME_MESSAGE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 30 \ + $"Background image URL:" 3 1 "$(grep '$MICROBLOG_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 30 \ + $"Code:" 4 1 "$(grep 'MICROBLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 4 25 25 30 \ 2> $data else dialog --backtitle $"Freedombone Configuration" \ --title $"Microblog Configuration" \ - --form $"\nPlease enter your Microblog details\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 13 65 3 \ - $"Domain:" 1 1 "$(grep 'MICROBLOG_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 20 25 30 \ - $"Welcome Message:" 2 1 "$(grep '$MICROBLOG_WELCOME_MESSAGE' temp.cfg | awk -F '=' '{print $2}')" 2 20 50 30 \ + --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 25 30 \ + $"Welcome Message:" 2 1 "$(grep '$MICROBLOG_WELCOME_MESSAGE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 30 \ + $"Background image URL:" 3 1 "$(grep '$MICROBLOG_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 30 \ 2> $data fi sel=$? @@ -1598,6 +1604,10 @@ function interactive_configuration { 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 @@ -1610,7 +1620,7 @@ function interactive_configuration { 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 3p) + MICROBLOG_CODE=$(cat $data | sed -n 4p) if [ ${#MICROBLOG_CODE} -lt 30 ]; then MICROBLOG_DOMAIN_NAME= dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50 @@ -1880,6 +1890,9 @@ function read_configuration { 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 "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE; then HUBZILLA_DOMAIN_NAME=$(grep "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}') fi