Beginning of social instance builds

This commit is contained in:
Bob Mottram 2017-06-16 15:39:48 +01:00
parent 39628a200d
commit ba1b541e3f
8 changed files with 169 additions and 33 deletions

View File

@ -13,7 +13,7 @@
# License
# =======
#
# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
#
# 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
@ -65,6 +65,18 @@ if [[ $command_options == "menuconfig-onion" ]]; then
ONION_ONLY="yes"
fi
if [[ $command_options == "menuconfig-gnusocial" ]]; then
MINIMAL_INSTALL="yes"
ONION_ONLY="no"
SOCIALINSTANCE='gnusocial'
fi
if [[ $command_options == "menuconfig-postactiv" ]]; then
MINIMAL_INSTALL="yes"
ONION_ONLY="no"
SOCIALINSTANCE='postactiv'
fi
if [ ! $CONFIGURATION_FILE ]; then
CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
fi

View File

@ -95,6 +95,7 @@ MINIMAL_INSTALL="yes"
DEFAULT_LANGUAGE='en_GB.UTF-8'
ONION_ONLY="no"
SELECTED_USERNAME=
SOCIALINSTANCE=
# Mirrors settings
FRIENDS_MIRRORS_SERVER=
@ -144,13 +145,14 @@ function show_help {
echo $'Creates an inventory of remote backup locations'
echo ''
echo ''
echo $' -h --help Show help'
echo $' -f --filename Configuration file (usually freedombone.cfg)'
echo $' -m --min Minimum password length (characters)'
echo $' -w --www Freedombone web site'
echo $' -b --bm Freedombone support Bitmessage address'
echo $' -o --onion [yes|no] Whether to only create .onion sites'
echo $' --minimal [yes|no] For minimalistic "consumer grade" installs'
echo $' -h --help Show help'
echo $' -f --filename Configuration file (usually freedombone.cfg)'
echo $' -m --min Minimum password length (characters)'
echo $' -w --www Freedombone web site'
echo $' -b --bm Freedombone support Bitmessage address'
echo $' -o --onion [yes|no] Whether to only create .onion sites'
echo $' --minimal [yes|no] For minimalistic "consumer grade" installs'
echo $' --social [gnusocial|postactiv] Create gnusocial/postactiv instance'
echo ''
exit 0
}
@ -184,7 +186,63 @@ function choose_email_address {
save_configuration_values
}
function choose_social_instance_domain_name {
DEFAULT_DOMAIN_DETAILS_COMPLETE=
while [ ! $DEFAULT_DOMAIN_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 $"Instance domain" \
--form $"\nEnter your instance domain name and its FreeDNS code:" 11 55 3 \
$"Domain:" 1 1 "$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 24 33 40 \
$"Code:" 2 1 "$(grep 'DEFAULT_DOMAIN_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 24 33 255 \
2> $data
sel=$?
case $sel in
1) exit 1;;
255) exit 1;;
esac
DEFAULT_DOMAIN_NAME=$(cat $data | sed -n 1p)
DEFAULT_DOMAIN_CODE=$(cat $data | sed -n 2p)
if [ $DEFAULT_DOMAIN_NAME ]; then
validate_freedns_code "$DEFAULT_DOMAIN_CODE"
if [ ! $VALID_CODE ]; then
DEFAULT_DOMAIN_NAME=
fi
fi
else
dialog --backtitle $"Freedombone Configuration" \
--inputbox $"Enter your instance domain name:" 10 45 \
"$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$?
case $sel in
0) DEFAULT_DOMAIN_NAME=$(cat $data);;
1) exit 1;;
255) exit 1;;
esac
fi
if [ $DEFAULT_DOMAIN_NAME ]; then
TEST_DOMAIN_NAME=$DEFAULT_DOMAIN_NAME
validate_domain_name
if [[ $TEST_DOMAIN_NAME != $DEFAULT_DOMAIN_NAME ]]; then
DEFAULT_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
DEFAULT_DOMAIN_DETAILS_COMPLETE="yes"
fi
fi
done
save_configuration_values
}
function choose_default_domain_name {
if [ $SOCIALINSTANCE ]; then
choose_social_instance_domain_name
return
fi
if [[ $ONION_ONLY != "no" ]]; then
DEFAULT_DOMAIN_NAME="${PROJECT_NAME}.local"
else
@ -782,6 +840,12 @@ do
shift
FREEDOMBONE_WEBSITE="$1"
;;
--social)
shift
if [[ "$1" == 'gnusocial' || "$1" == 'postactiv' ]]; then
SOCIALINSTANCE="$1"
fi
;;
--minimal)
shift
MINIMAL_INSTALL="$1"
@ -1046,10 +1110,14 @@ function interactive_config {
interactive_select_language
if [[ $ONION_ONLY == "no" ]]; then
INITIAL_MESSAGE=$"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."
if [ $SOCIALINSTANCE ]; then
INITIAL_MESSAGE=$"Welcome to your Freedombone $SOCIALINSTANCE instance.\n\nEnsure that you have your domain and dynamic DNS settings ready.\n\nFor more information please visit ${FREEDOMBONE_WEBSITE}/socialinstance.html."
else
INITIAL_MESSAGE=$"Welcome to the Freedombone interactive installer. Communications freedom is only a short time away.\n\nWeb sites created will only be viewable within a Tor browser.\n\nFor more information please visit $FREEDOMBONE_WEBSITE."
if [[ $ONION_ONLY == "no" ]]; then
INITIAL_MESSAGE=$"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."
else
INITIAL_MESSAGE=$"Welcome to the Freedombone interactive installer. Communications freedom is only a short time away.\n\nWeb sites created will only be viewable within a Tor browser.\n\nFor more information please visit $FREEDOMBONE_WEBSITE."
fi
fi
dialog --title $"Freedombone" --msgbox "$INITIAL_MESSAGE" 15 50

View File

@ -138,6 +138,9 @@ INSECURE='no'
# a new identity at every shutdown/boot
AMNESIC='no'
# Is this a dedicated gnusocial or postactiv instance?
SOCIALINSTANCE=
# Versions used for Arch/Parabola setup
MBR_VERSION='1.1.11'
@ -400,6 +403,10 @@ do
shift
PROJECT_REPO="$1"
;;
--social|--instance)
shift
SOCIALINSTANCE="$1"
;;
-m|--mirror)
shift
MIRROR="$1"
@ -546,6 +553,10 @@ if [[ $AMNESIC != 'no' ]]; then
IMAGE_NAME="${IMAGE_NAME}-amnesic"
fi
if [[ "$SOCIALINSTANCE" == "gnusocial" || "$SOCIALINSTANCE" == "postactiv" ]]; then
IMAGE_NAME="${IMAGE_NAME}-${SOCIALINSTANCE}"
fi
cd $TEMPBUILD_DIR
make $IMAGE_TYPE \
MYUSERNAME="$USERNAME" \
@ -580,7 +591,8 @@ make $IMAGE_TYPE \
VARIANT="$VARIANT" \
MINIMUM_PASSWORD_LENGTH="$MINIMUM_PASSWORD_LENGTH" \
INSECURE="$INSECURE" \
AMNESIC="$AMNESIC"
AMNESIC="$AMNESIC" \
SOCIALINSTANCE="$SOCIALINSTANCE"
if [ ! "$?" = "0" ]; then
echo $'Build failed'

View File

@ -106,6 +106,9 @@ MESH_INSTALL_DIR=/var/lib
# a new identity at every shutdown/boot
AMNESIC='no'
# Whether this is a dedicated gnusocial or postactiv instance
SOCIALINSTANCE=
# defines the initial keyboard layout
KEYBOARD_MAP='gb'
@ -401,14 +404,22 @@ EOF
echo " make install" >> $rootdir/root/.bashrc
if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "usb" ]]; then
if [[ $ONION_ONLY == "no" ]]; then
if [[ $MINIMAL_INSTALL == "no" ]]; then
echo " ${PROJECT_NAME} menuconfig-full" >> $rootdir/root/.bashrc
else
echo " ${PROJECT_NAME} menuconfig" >> $rootdir/root/.bashrc
fi
if [[ "$SOCIALINSTANCE" == "gnusocial" ]]; then
echo " ${PROJECT_NAME} menuconfig-gnusocial" >> $rootdir/root/.bashrc
else
echo " ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
if [[ "$SOCIALINSTANCE" == "postactiv" ]]; then
echo " ${PROJECT_NAME} menuconfig-postactiv" >> $rootdir/root/.bashrc
else
if [[ $ONION_ONLY == "no" ]]; then
if [[ $MINIMAL_INSTALL == "no" ]]; then
echo " ${PROJECT_NAME} menuconfig-full" >> $rootdir/root/.bashrc
else
echo " ${PROJECT_NAME} menuconfig" >> $rootdir/root/.bashrc
fi
else
echo " ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
fi
fi
fi
else
echo " echo ''" >> $rootdir/root/.bashrc
@ -1226,9 +1237,27 @@ function image_preinstall_repos {
if [ ! -d $rootdir/repos ]; then
mkdir $rootdir/repos
fi
git clone $CMAKE_REPO $rootdir/repos/cmake
git clone $INADYN_REPO $rootdir/repos/inadyn
git clone $TOMB_REPO $rootdir/repos/tomb
if [[ $SOCIALINSTANCE == "gnusocial" ]]; then
git clone $GNUSOCIAL_REPO $rootdir/repos/gnusocial
git clone $GNUSOCIAL_MARKDOWN_REPO $rootdir/repos/gnusocial-markdown
git clone $QVITTER_THEME_REPO $rootdir/repos/qvitter
git clone $PLEROMA_REPO $rootdir/repos/pleroma
return
fi
if [[ $SOCIALINSTANCE == "postactiv" ]]; then
git clone $GNUSOCIAL_MARKDOWN_REPO $rootdir/repos/gnusocial-markdown
git clone $QVITTER_THEME_REPO $rootdir/repos/qvitter
git clone $PLEROMA_REPO $rootdir/repos/pleroma
git clone $POSTACTIV_REPO $rootdir/repos/postactiv
return
fi
git clone $CRYPTPAD_REPO $rootdir/repos/cryptpad
git clone $DOKUWIKI_REPO $rootdir/repos/dokuwiki
git clone $ETHERPAD_REPO $rootdir/repos/etherpad

View File

@ -77,6 +77,7 @@ export VARIANT
export MINIMUM_PASSWORD_LENGTH
export INSECURE
export AMNESIC
export SOCIALINSTANCE
# Locate vmdebootstrap program fetched in Makefile
basedir=`pwd`
@ -241,6 +242,7 @@ sed -i "s|VARIANT=.*|VARIANT=\"${VARIANT}\"|g" $TEMP_CUSTOMISE3
sed -i "s|MINIMUM_PASSWORD_LENGTH=.*|MINIMUM_PASSWORD_LENGTH=\"${MINIMUM_PASSWORD_LENGTH}\"|g" $TEMP_CUSTOMISE3
sed -i "s|INSECURE=.*|INSECURE=\"${INSECURE}\"|g" $TEMP_CUSTOMISE3
sed -i "s|AMNESIC=.*|AMNESIC=\"${AMNESIC}\"|g" $TEMP_CUSTOMISE3
sed -i "s|SOCIALINSTANCE=.*|SOCIALINSTANCE=\"${SOCIALINSTANCE}\"|g" $TEMP_CUSTOMISE3
sed -i 's|#!/bin/bash||g' $TEMP_CUSTOMISE3
cat $TEMP_CUSTOMISE2 $TEMP_CUSTOMISE3 > $TEMP_CUSTOMISE4

View File

@ -103,7 +103,8 @@ configuration_variables=(FRIENDS_MIRRORS_SERVER
IPV6_NETWORK
HWRNG_TYPE
ENABLE_BATMAN
PUBLIC_MAILING_LIST)
PUBLIC_MAILING_LIST
SOCIALINSTANCE)
function get_completion_param {
param_name="$1"

View File

@ -59,25 +59,34 @@ function interactive_configuration {
rm -f /tmp/meshuserdevice
fi
if [[ $ONION_ONLY == "no" ]]; then
if [[ $MINIMAL_INSTALL == "no" ]]; then
${PROJECT_NAME}-config \
-f $CONFIGURATION_FILE \
-w $PROJECT_WEBSITE \
-m $MINIMUM_PASSWORD_LENGTH
if [ $SOCIALINSTANCE ]; then
${PROJECT_NAME}-config \
-f $CONFIGURATION_FILE \
-w $PROJECT_WEBSITE \
-m $MINIMUM_PASSWORD_LENGTH \
--minimal "yes" \
--social $SOCIALINSTANCE
else
if [[ $ONION_ONLY == "no" ]]; then
if [[ $MINIMAL_INSTALL == "no" ]]; then
${PROJECT_NAME}-config \
-f $CONFIGURATION_FILE \
-w $PROJECT_WEBSITE \
-m $MINIMUM_PASSWORD_LENGTH
else
${PROJECT_NAME}-config \
-f $CONFIGURATION_FILE \
-w $PROJECT_WEBSITE \
-m $MINIMUM_PASSWORD_LENGTH \
--minimal "yes"
fi
else
${PROJECT_NAME}-config \
-f $CONFIGURATION_FILE \
-w $PROJECT_WEBSITE \
-m $MINIMUM_PASSWORD_LENGTH \
--minimal "yes"
--onion "yes"
fi
else
${PROJECT_NAME}-config \
-f $CONFIGURATION_FILE \
-w $PROJECT_WEBSITE \
-m $MINIMUM_PASSWORD_LENGTH \
--onion "yes"
fi
if [ -f /tmp/meshuserdevice ]; then
# mesh network user device installation

View File

@ -77,6 +77,9 @@ DEBIAN_VERSION="stretch"
# social key management
ENABLE_SOCIAL_KEY_MANAGEMENT="no"
# Whether this is a dedicated gnusocial or postactiv instance
SOCIALINSTANCE=
# include utils
UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
for f in $UTILS_FILES