This commit is contained in:
Bob Mottram 2018-05-09 18:22:35 +01:00
commit e79f2c9390
9 changed files with 111 additions and 45 deletions

View File

@ -203,6 +203,7 @@ function install_apps_selected {
fi
fi
app_index=$((app_index+1))
done
# if no apps to be installed then don't do anything

View File

@ -30,6 +30,7 @@ VARIANTS="full full-vim writer"
IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
MINIMUM_RAM_MB=2000
ETHERPAD_DOMAIN_NAME=
ETHERPAD_CODE=

View File

@ -30,6 +30,7 @@ VARIANTS='full full-vim social'
IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
NOT_ON_ONION=1
GNUSOCIAL_DOMAIN_NAME=
GNUSOCIAL_CODE=
@ -581,6 +582,7 @@ function remove_gnusocial {
fi
kill_pid=$(pgrep "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/queuedaemon.php" | head -n 1)
kill -9 "$kill_pid"
pkill "$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/queuedaemon.php"
if [ -d "/var/www/$GNUSOCIAL_DOMAIN_NAME" ]; then
rm -rf "/var/www/$GNUSOCIAL_DOMAIN_NAME"
@ -911,8 +913,8 @@ function install_gnusocial_main {
}
function install_gnusocial {
if [ ! "$ONION_ONLY" ]; then
ONION_ONLY='no'
if [[ "$ONION_ONLY" != 'no' ]]; then
return
fi
install_gnusocial_main
@ -935,9 +937,12 @@ function install_gnusocial {
sed -i 's|"theme":.*|"theme": "base16-apathy.css",|g' "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static/config.json"
fi
# unleash the daemons!
# this has to be run as root initially, otherwise database tables
# don't get created
cd "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" || exit 236482684
php scripts/checkschema.php
sh scripts/startdaemons.sh
/etc/cron.hourly/gnusocial-daemons
systemctl restart nginx

View File

@ -30,6 +30,7 @@ VARIANTS='full full-vim social'
IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
NOT_ON_ONION=1
HUBZILLA_DOMAIN_NAME=
HUBZILLA_CODE=

View File

@ -32,6 +32,7 @@ VARIANTS=""
IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=0
NOT_ON_ONION=1
VIDEOBRIDGE_PORT=5347
JITSI_ONION_PORT=8102

View File

@ -36,6 +36,8 @@ VARIANTS='full full-vim chat'
IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
NOT_ON_ONION=1
MINIMUM_RAM_MB=1500
MATRIX_DOMAIN_NAME=
MATRIX_CODE=

View File

@ -30,6 +30,7 @@ VARIANTS='full full-vim media'
IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
NOT_ON_ONION=1
POSTACTIV_DOMAIN_NAME=
POSTACTIV_CODE=
@ -595,6 +596,7 @@ function remove_postactiv {
fi
kill_pid=$(pgrep "/var/www/$POSTACTIV_DOMAIN_NAME/htdocs/scripts/queuedaemon.php" | head -n 1)
kill -9 "$kill_pid"
pkill "$POSTACTIV_DOMAIN_NAME/htdocs/scripts/queuedaemon.php"
if [ -d "/var/www/$POSTACTIV_DOMAIN_NAME" ]; then
rm -rf "/var/www/$POSTACTIV_DOMAIN_NAME"
@ -926,8 +928,8 @@ function install_postactiv_main {
}
function install_postactiv {
if [ ! "$ONION_ONLY" ]; then
ONION_ONLY='no'
if [[ "$ONION_ONLY" != 'no' ]]; then
return
fi
install_postactiv_main
@ -952,7 +954,12 @@ function install_postactiv {
expire_gnusocial_posts "$POSTACTIV_DOMAIN_NAME" "postactiv" "$POSTACTIV_EXPIRE_MONTHS"
# unleash the daemons!
# this has to be run as root initially, otherwise database tables
# don't get created
cd "/var/www/$POSTACTIV_DOMAIN_NAME/htdocs" || exit 3658254254
sh scripts/startdaemons.sh
php scripts/checkschema.php
/etc/cron.hourly/postactiv-daemons
systemctl restart nginx

View File

@ -30,6 +30,7 @@ VARIANTS='full full-vim chat'
IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
NOT_ON_ONION=1
RIOT_VERSION='0.13.3'
RIOT_FILENAME="riot-v${RIOT_VERSION}"

View File

@ -272,6 +272,39 @@ function get_apps_installed_names {
done
}
function app_not_on_onion_only {
app_name="$1"
read_config_param ONION_ONLY
if [[ "$ONION_ONLY" != 'no' ]]; then
if grep -q "NOT_ON_ONION=1" "/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}"; then
echo "0"
return
fi
fi
echo "1"
}
function enough_ram_for_app {
app_name="$1"
if ! grep -q "MINIMUM_RAM_MB=" "/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}"; then
echo "0"
return
fi
minimum_ram_MB=$(grep "MINIMUM_RAM_MB=" "/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}" | head -n 1 | awk -F '=' '{print $2}')
minimum_ram_bytes=$((minimum_ram_MB * 1024))
ram_available=$(grep MemTotal /proc/meminfo | awk '{print $2}')
if [ "$ram_available" -lt "$minimum_ram_bytes" ]; then
echo "1"
return
fi
echo "0"
}
# detects what apps are available
function detect_apps {
FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*"
@ -285,12 +318,15 @@ function detect_apps {
for filename in $FILES
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(enough_ram_for_app "$app_name") == "0" ]]; then
if [[ $(app_not_on_onion_only "$app_name") != "0" ]]; then
# shellcheck disable=SC2068
if ! item_in_array "${app_name}" ${APPS_AVAILABLE[@]}; then
APPS_AVAILABLE+=("${app_name}")
APPS_CHOSEN+=("0")
fi
fi
fi
done
function_check get_apps_installed
@ -318,6 +354,8 @@ function detect_installable_apps {
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(enough_ram_for_app "$app_name") == "0" ]]; then
if [[ $(app_not_on_onion_only "$app_name") != "0" ]]; then
# shellcheck disable=SC2068
if ! item_in_array "${app_name}" ${APPS_AVAILABLE[@]}; then
variants_list=$(app_variants "$filename")
@ -331,6 +369,8 @@ function detect_installable_apps {
fi
fi
fi
fi
fi
done
}
@ -350,6 +390,8 @@ function detect_installed_apps {
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(enough_ram_for_app "$app_name") == "0" ]]; then
if [[ $(app_not_on_onion_only "$app_name") != "0" ]]; then
if [[ $(app_is_installed "$app_name") == "1" ]]; then
# shellcheck disable=SC2068
if ! item_in_array "${app_name}" ${APPS_AVAILABLE[@]}; then
@ -360,6 +402,8 @@ function detect_installed_apps {
fi
fi
fi
fi
fi
done
}
@ -385,7 +429,8 @@ function choose_apps_for_variant {
for filename in $FILES
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
if [[ $(enough_ram_for_app "$app_name") == "0" ]]; then
if [[ $(app_not_on_onion_only "$app_name") != "0" ]]; then
# shellcheck disable=SC2068
if item_in_array "${app_name}" ${APPS_AVAILABLE[@]}; then
if grep -q "VARIANTS=" "${filename}"; then
@ -408,6 +453,8 @@ function choose_apps_for_variant {
APPS_CHOSEN+=("0")
fi
fi
fi
fi
done
function_check get_apps_installed