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 # 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 # 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 # 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" ONION_ONLY="yes"
fi 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 if [ ! $CONFIGURATION_FILE ]; then
CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
fi fi

View File

@ -95,6 +95,7 @@ MINIMAL_INSTALL="yes"
DEFAULT_LANGUAGE='en_GB.UTF-8' DEFAULT_LANGUAGE='en_GB.UTF-8'
ONION_ONLY="no" ONION_ONLY="no"
SELECTED_USERNAME= SELECTED_USERNAME=
SOCIALINSTANCE=
# Mirrors settings # Mirrors settings
FRIENDS_MIRRORS_SERVER= FRIENDS_MIRRORS_SERVER=
@ -151,6 +152,7 @@ function show_help {
echo $' -b --bm Freedombone support Bitmessage address' echo $' -b --bm Freedombone support Bitmessage address'
echo $' -o --onion [yes|no] Whether to only create .onion sites' echo $' -o --onion [yes|no] Whether to only create .onion sites'
echo $' --minimal [yes|no] For minimalistic "consumer grade" installs' echo $' --minimal [yes|no] For minimalistic "consumer grade" installs'
echo $' --social [gnusocial|postactiv] Create gnusocial/postactiv instance'
echo '' echo ''
exit 0 exit 0
} }
@ -184,7 +186,63 @@ function choose_email_address {
save_configuration_values 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 { function choose_default_domain_name {
if [ $SOCIALINSTANCE ]; then
choose_social_instance_domain_name
return
fi
if [[ $ONION_ONLY != "no" ]]; then if [[ $ONION_ONLY != "no" ]]; then
DEFAULT_DOMAIN_NAME="${PROJECT_NAME}.local" DEFAULT_DOMAIN_NAME="${PROJECT_NAME}.local"
else else
@ -782,6 +840,12 @@ do
shift shift
FREEDOMBONE_WEBSITE="$1" FREEDOMBONE_WEBSITE="$1"
;; ;;
--social)
shift
if [[ "$1" == 'gnusocial' || "$1" == 'postactiv' ]]; then
SOCIALINSTANCE="$1"
fi
;;
--minimal) --minimal)
shift shift
MINIMAL_INSTALL="$1" MINIMAL_INSTALL="$1"
@ -1046,11 +1110,15 @@ function interactive_config {
interactive_select_language interactive_select_language
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
if [[ $ONION_ONLY == "no" ]]; then 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." 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 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." 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
fi
dialog --title $"Freedombone" --msgbox "$INITIAL_MESSAGE" 15 50 dialog --title $"Freedombone" --msgbox "$INITIAL_MESSAGE" 15 50

View File

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

View File

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

View File

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

View File

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

View File

@ -59,6 +59,14 @@ function interactive_configuration {
rm -f /tmp/meshuserdevice rm -f /tmp/meshuserdevice
fi fi
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 [[ $ONION_ONLY == "no" ]]; then
if [[ $MINIMAL_INSTALL == "no" ]]; then if [[ $MINIMAL_INSTALL == "no" ]]; then
${PROJECT_NAME}-config \ ${PROJECT_NAME}-config \
@ -79,6 +87,7 @@ function interactive_configuration {
-m $MINIMUM_PASSWORD_LENGTH \ -m $MINIMUM_PASSWORD_LENGTH \
--onion "yes" --onion "yes"
fi fi
fi
if [ -f /tmp/meshuserdevice ]; then if [ -f /tmp/meshuserdevice ]; then
# mesh network user device installation # mesh network user device installation
rm -f /tmp/meshuserdevice rm -f /tmp/meshuserdevice

View File

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