Tidy gnusocial app

This commit is contained in:
Bob Mottram 2016-10-03 13:49:29 +01:00
parent c078225608
commit 97c900ab28
2 changed files with 27 additions and 51 deletions

View File

@ -85,24 +85,15 @@ function install_interactive_gnusocial {
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 | head -n 1 | 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
read_config_param "MICROBLOG_COMMIT"
read_config_param "ONION_ONLY"
read_config_param "MICROBLOG_DOMAIN_NAME"
read_config_param "MICROBLOG_CODE"
read_config_param "MICROBLOG_WELCOME_MESSAGE"
read_config_param "MICROBLOG_BACKGROUND_IMAGE_URL"
read_config_param "DDNS_PROVIDER"
if [[ $ONION_ONLY != "no" ]]; then
MICROBLOG_DOMAIN_NAME='microblog.local'
else
@ -250,6 +241,7 @@ function upgrade_gnusocial {
if grep -q "gnusocial domain" $COMPLETION_FILE; then
MICROBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
fi
read_config_param "MICROBLOG_COMMIT"
# update to the next commit
function_check set_repo_commit
@ -1039,24 +1031,13 @@ function install_gnusocial {
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 | head -n 1 | 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
read_config_param "MICROBLOG_COMMIT"
read_config_param "ONION_ONLY"
read_config_param "MICROBLOG_DOMAIN_NAME"
read_config_param "MICROBLOG_CODE"
read_config_param "MICROBLOG_WELCOME_MESSAGE"
read_config_param "MICROBLOG_BACKGROUND_IMAGE_URL"
read_config_param "DDNS_PROVIDER"
install_gnusocial_main
expire_gnusocial_posts

View File

@ -28,6 +28,16 @@
# 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/>.
function read_config_param {
param_name="$1"
if [ -f $CONFIGURATION_FILE ]; then
if grep -q "$param_name" $CONFIGURATION_FILE; then
$param_name=$(grep "$param_name" $CONFIGURATION_FILE | head -n 1 | awk -F '=' '{print $2}')
fi
fi
}
function read_configuration {
# if not installing on a Beaglebone then use sdb as the USB drive by default
if [ ! $INSTALLING_ON_BBB ]; then
@ -146,12 +156,6 @@ function read_configuration {
if grep -q "RSS_READER_DOMAIN_NAME" $CONFIGURATION_FILE; then
RSS_READER_DOMAIN_NAME=$(grep "RSS_READER_DOMAIN_NAME" $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 "MICROBLOG_WELCOME_MESSAGE" $CONFIGURATION_FILE; then
MICROBLOG_WELCOME_MESSAGE=$(grep "MICROBLOG_WELCOME_MESSAGE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "PROJECT_WEBSITE" $CONFIGURATION_FILE; then
PROJECT_WEBSITE=$(grep "PROJECT_WEBSITE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
@ -212,9 +216,6 @@ function read_configuration {
if grep -q "ZERONET_FORUM_COMMIT" $CONFIGURATION_FILE; then
ZERONET_FORUM_COMMIT=$(grep "ZERONET_FORUM_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MICROBLOG_COMMIT" $CONFIGURATION_FILE; then
MICROBLOG_COMMIT=$(grep "MICROBLOG_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "NGINX_ENSITE_REPO" $CONFIGURATION_FILE; then
NGINX_ENSITE_REPO=$(grep "NGINX_ENSITE_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
@ -436,12 +437,6 @@ function read_configuration {
if grep -q "PUBLIC_MAILING_LIST" $CONFIGURATION_FILE; then
PUBLIC_MAILING_LIST=$(grep "PUBLIC_MAILING_LIST" $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 "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE; then
HUBZILLA_DOMAIN_NAME=$(grep "HUBZILLA_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi