Browse Source

Tidying

stockholm
Bob Mottram 5 years ago
parent
commit
607d4bdc95
  1. 6
      src/freedombone-addcert
  2. 4
      src/freedombone-app-batman
  3. 12
      src/freedombone-app-dlna
  4. 12
      src/freedombone-app-dokuwiki
  5. 59
      src/freedombone-app-gnusocial
  6. 4
      src/freedombone-app-gogs
  7. 540
      src/freedombone-app-htmly
  8. 18
      src/freedombone-app-hubzilla
  9. 20
      src/freedombone-app-ipfs
  10. 16
      src/freedombone-app-librevault
  11. 12
      src/freedombone-app-mediagoblin
  12. 4
      src/freedombone-app-mumble
  13. 14
      src/freedombone-app-rss
  14. 14
      src/freedombone-app-searx
  15. 8
      src/freedombone-app-sip
  16. 4
      src/freedombone-app-syncthing
  17. 4
      src/freedombone-app-tahoelafs
  18. 10
      src/freedombone-app-tox
  19. 6
      src/freedombone-app-webmail
  20. 10
      src/freedombone-app-xmpp
  21. 22
      src/freedombone-app-zeronet
  22. 2
      src/freedombone-backup-remote
  23. 82
      src/freedombone-base-email
  24. 4
      src/freedombone-base-tripwire
  25. 2
      src/freedombone-controlpanel
  26. 8
      src/freedombone-encrypt-mail
  27. 4
      src/freedombone-restore-local
  28. 8
      src/freedombone-restore-remote
  29. 2
      src/freedombone-rmuser
  30. 14
      src/freedombone-syncthing
  31. 4
      src/freedombone-utils-avahi
  32. 6
      src/freedombone-utils-backup
  33. 4
      src/freedombone-utils-cmake
  34. 85
      src/freedombone-utils-config
  35. 64
      src/freedombone-utils-cron
  36. 4
      src/freedombone-utils-cryptopp
  37. 8
      src/freedombone-utils-database
  38. 12
      src/freedombone-utils-dns
  39. 10
      src/freedombone-utils-filesystem
  40. 4
      src/freedombone-utils-final
  41. 34
      src/freedombone-utils-firewall
  42. 9
      src/freedombone-utils-git
  43. 2
      src/freedombone-utils-go
  44. 4
      src/freedombone-utils-international
  45. 4
      src/freedombone-utils-login
  46. 58
      src/freedombone-utils-monkeysphere
  47. 84
      src/freedombone-utils-network
  48. 4
      src/freedombone-utils-nodejs
  49. 34
      src/freedombone-utils-onion
  50. 4
      src/freedombone-utils-passwords
  51. 12
      src/freedombone-utils-repos
  52. 222
      src/freedombone-utils-rng
  53. 4
      src/freedombone-utils-selector
  54. 10
      src/freedombone-utils-setup
  55. 12
      src/freedombone-utils-ssh
  56. 4
      src/freedombone-utils-tracker
  57. 8
      src/freedombone-utils-upgrade
  58. 4
      src/freedombone-utils-watchdog
  59. 25
      src/freedombone-utils-web
  60. 11
      src/freedombone-utils-wifi
  61. 18
      src/freedombone-utils-zram

6
src/freedombone-addcert

@ -186,7 +186,11 @@ function add_cert_letsencrypt {
if [ ! $MY_EMAIL_ADDRESS ]; then
if [ -f $COMPLETION_FILE ]; then
if grep -q "Admin user:" $COMPLETION_FILE; then
ADMIN_USER=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
function_check get_completion_param
ADMIN_USER=$(get_completion_param "Admin user")
if [ ${#ADMIN_USER} -eq 0 ]; then
exit 463732
fi
MY_EMAIL_ADDRESS=$ADMIN_USER@$HOSTNAME
fi
fi

4
src/freedombone-app-batman

@ -46,7 +46,7 @@ function change_password_batman {
}
function configure_firewall_for_batman {
if grep -Fxq "configure_firewall_for_batman" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
if [[ $ENABLE_BATMAN != "yes" ]]; then
@ -55,7 +55,7 @@ function configure_firewall_for_batman {
function_check save_firewall_settings
save_firewall_settings
echo 'configure_firewall_for_batman' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function reconfigure_batman {

12
src/freedombone-app-dlna

@ -78,7 +78,7 @@ function upgrade_dlna {
}
function configure_firewall_for_dlna {
if grep -Fxq "configure_firewall_for_dlna" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
@ -92,7 +92,7 @@ function configure_firewall_for_dlna {
OPEN_PORTS+=('DLNA 1900')
OPEN_PORTS+=('DLNA 8200')
echo 'configure_firewall_for_dlna' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function backup_local_dlna {
@ -168,7 +168,7 @@ function remove_dlna {
}
function install_dlna_main {
if grep -Fxq "install_dlna_main" $COMPLETION_FILE; then
if [[ $(app_is_installed dlna_main) == "1" ]]; then
return
fi
@ -217,11 +217,11 @@ function install_dlna_main {
function_check configure_firewall_for_dlna
configure_firewall_for_dlna
echo 'install_dlna_main' >> $COMPLETION_FILE
install_completed dlna_main
}
function script_for_attaching_usb_drive {
if grep -Fxq "script_for_attaching_usb_drive" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
echo '#!/bin/bash' > /usr/bin/attach-music
@ -256,7 +256,7 @@ function script_for_attaching_usb_drive {
ln -s /usr/bin/remove-music /usr/bin/detach-pictures
ln -s /usr/bin/remove-music /usr/bin/remove-pictures
echo 'script_for_attaching_usb_drive' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function install_dlna {

12
src/freedombone-app-dokuwiki

@ -85,7 +85,8 @@ function backup_local_dokuwiki {
function restore_local_dokuwiki {
if [ -d /var/lib/dokuwiki ]; then
echo $"Restoring Dokuwiki installation"
DOKUWIKI_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "dokuwiki domain" | awk -F ':' '{print $2}')
function_check get_completion_param
DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
temp_restore_dir=/root/tempdokuwiki
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir dokuwiki
@ -131,7 +132,8 @@ function backup_remote_dokuwiki {
function restore_remote_dokuwiki {
if [ -d $SERVER_DIRECTORY/backup/dokuwiki ]; then
DOKUWIKI_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "dokuwiki domain" | awk -F ':' '{print $2}')
function_check get_completion_param
DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
echo $"Restoring Dokuwiki installation $DOKUWIKI_DOMAIN_NAME"
function_check restore_directory_from_friend
restore_directory_from_friend /root/tempdokuwiki dokuwiki
@ -561,11 +563,7 @@ function install_dokuwiki {
chmod 600 /home/$MY_USERNAME/README
fi
if ! grep -q "dokuwiki domain" $COMPLETION_FILE; then
echo "dokuwiki domain:$DOKUWIKI_DOMAIN_NAME" >> $COMPLETION_FILE
else
sed -i "s|dokuwiki domain.*|dokuwiki domain:$DOKUWIKI_DOMAIN_NAME|g" $COMPLETION_FILE
fi
set_completion_param "dokuwiki domain" "$DOKUWIKI_DOMAIN_NAME"
APP_INSTALLED=1
}

59
src/freedombone-app-gnusocial

@ -74,7 +74,8 @@ gnusocial_variables=(GNUSOCIAL_COMMIT
function remove_user_gnusocial {
remove_username="$1"
GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
function_check get_completion_param
GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
if [ -d /var/www/$GNUSOCIAL_DOMAIN_NAME ]; then
cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
php scripts/deleteprofile.php -n $remove_username -y
@ -85,7 +86,7 @@ function add_user_gnusocial {
new_username="$1"
new_user_password="$2"
GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
if [ -d /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs ]; then
cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
php scripts/registeruser.php -n $new_username -w "$new_user_password" -e "$new_username@$HOSTNAME"
@ -231,7 +232,7 @@ function reconfigure_gnusocial {
function upgrade_gnusocial {
if grep -q "gnusocial domain" $COMPLETION_FILE; then
GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
fi
# update to the next commit
@ -246,7 +247,7 @@ function upgrade_gnusocial {
function backup_local_gnusocial {
GNUSOCIAL_DOMAIN_NAME='gnusocial'
if grep -q "gnusocial domain" $COMPLETION_FILE; then
GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
fi
source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
@ -274,7 +275,7 @@ function restore_local_gnusocial {
if ! grep -q "gnusocial domain" $COMPLETION_FILE; then
return
fi
GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
if [ $GNUSOCIAL_DOMAIN_NAME ]; then
echo $"Restoring gnusocial"
temp_restore_dir=/root/tempgnusocial
@ -300,7 +301,7 @@ function restore_local_gnusocial {
function backup_remote_gnusocial {
if grep -q "gnusocial domain" $COMPLETION_FILE; then
GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
temp_backup_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
if [ -d $temp_backup_dir ]; then
function_check suspend_site
@ -325,7 +326,7 @@ function backup_remote_gnusocial {
function restore_remote_gnusocial {
if grep -q "gnusocial domain" $COMPLETION_FILE; then
echo $"Restoring gnusocial"
GNUSOCIAL_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gnusocial domain" | head -n 1 | awk -F ':' '{print $2}')
GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
# stop the daemons
cd /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
@ -412,11 +413,7 @@ function install_gnusocial_main {
cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
git checkout $GNUSOCIAL_COMMIT -b $GNUSOCIAL_COMMIT
if ! grep -q "gnusocial commit" $COMPLETION_FILE; then
echo "gnusocial commit:$GNUSOCIAL_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/gnusocial commit.*/gnusocial commit:$GNUSOCIAL_COMMIT/g" $COMPLETION_FILE
fi
set_completion_param "gnusocial commit" "$GNUSOCIAL_COMMIT"
chmod a+w /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
chown www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
@ -642,11 +639,7 @@ function install_gnusocial_main {
fi
fi
if ! grep -q "gnusocial domain" $COMPLETION_FILE; then
echo "gnusocial domain:$GNUSOCIAL_DOMAIN_NAME" >> $COMPLETION_FILE
else
sed -i "s|gnusocial domain.*|gnusocial domain:$GNUSOCIAL_DOMAIN_NAME|g" $COMPLETION_FILE
fi
set_completion_param "gnusocial domain" "$GNUSOCIAL_DOMAIN_NAME"
install_completed gnusocial_main
}
@ -715,11 +708,7 @@ function install_gnusocial_plugin_sharings {
chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
if ! grep -q "gnusocial sharings plugin commit" $COMPLETION_FILE; then
echo "gnusocial sharings plugin commit:$SHARINGS_COMMIT" >> $COMPLETION_FILE
else
sed -i "s|gnusocial sharings plugin commit.*|gnusocial sharings plugin commit:$SHARINGS_COMMIT|g" $COMPLETION_FILE
fi
set_completion_param gnusocial "sharings plugin commit" "$SHARINGS_COMMIT"
install_completed gnusocial_plugin_sharings
}
@ -761,11 +750,7 @@ function install_gnusocial_plugin_sharings_theme {
chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
if ! grep -q "gnusocial sharings plugin theme commit" $COMPLETION_FILE; then
echo "gnusocial sharings plugin theme commit:$SHARINGS_THEME_COMMIT" >> $COMPLETION_FILE
else
sed -i "s|gnusocial sharings plugin theme commit.*|gnusocial sharings plugin theme commit:$SHARINGS_THEME_COMMIT|g" $COMPLETION_FILE
fi
set_completions_param "gnusocial sharings plugin theme commit" "$SHARINGS_THEME_COMMIT"
install_completed gnusocial_plugin_sharings_theme
}
@ -914,11 +899,7 @@ function install_gnusocial_theme {
fi
fi
if ! grep -q "gnusocial theme commit" $COMPLETION_FILE; then
echo "gnusocial theme commit:$GNUSOCIAL_THEME_COMMIT" >> $COMPLETION_FILE
else
sed -i "s|gnusocial theme commit.*|gnusocial theme commit:$GNUSOCIAL_THEME_COMMIT|g" $COMPLETION_FILE
fi
set_completions_param "gnusocial theme commit" "$GNUSOCIAL_THEME_COMMIT"
chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
@ -957,11 +938,7 @@ function install_gnusocial_markdown {
echo "addPlugin('Markdown');" >> $gnusocial_config_file
fi
if ! grep -q "gnusocial Markdown commit" $COMPLETION_FILE; then
echo "gnusocial Markdown commit:$GNUSOCIAL_MARKDOWN_COMMIT" >> $COMPLETION_FILE
else
sed -i "s|gnusocial Markdown commit.*|gnusocial Markdown commit:$GNUSOCIAL_MARKDOWN_COMMIT|g" $COMPLETION_FILE
fi
set_completions_param "gnusocial markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT"
chown -R www-data:www-data $GNUSOCIAL_PATH
@ -978,7 +955,7 @@ function install_gnusocial_plugin_nsfw {
function_check set_repo_commit
set_repo_commit /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins "gnusocial NSFW plugin commit" "$GNUSOCIAL_NSFW_COMMIT" $GNUSOCIAL_NSFW_REPO
if grep -Fxq "install_gnusocial_plugin_nsfw" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
@ -1006,11 +983,7 @@ function install_gnusocial_plugin_nsfw {
chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
if ! grep -q "gnusocial NSFW plugin commit" $COMPLETION_FILE; then
echo "gnusocial NSFW plugin commit:$GNUSOCIAL_NSFW_COMMIT" >> $COMPLETION_FILE
else
sed -i "s|gnusocial NSFW plugin commit.*|gnusocial NSFW plugin commit:$GNUSOCIAL_NSFW_COMMIT|g" $COMPLETION_FILE
fi
set_completions_param "gnusocial NSFW plugin commit" "$GNUSOCIAL_NSFW_COMMIT"
install_completed gnusocial_plugin_nsfw
}

4
src/freedombone-app-gogs

@ -128,7 +128,7 @@ function upgrade_gogs {
return
fi
CURR_GOGS_VERSION=$(cat $COMPLETION_FILE | grep "gogs version" | head -n 1 | awk -F ':' '{print $2}')
CURR_GOGS_VERSION=$(get_completion_param "gogs version")
if [[ "${CURR_GOGS_VERSION}" == "${GOGS_VERSION}" ]]; then
return
fi
@ -288,7 +288,7 @@ function backup_remote_gogs {
function restore_remote_gogs {
if grep -q "gogs domain" $COMPLETION_FILE; then
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "gogs domain" | awk -F ':' '{print $2}')
GIT_DOMAIN_NAME=$(get_completion_param "gogs domain")
function_check gogs_create_database
gogs_create_database

540
src/freedombone-app-htmly

@ -30,18 +30,18 @@
VARIANTS="full full-vim writer"
HYMLY_DOMAIN_NAME=
HYMLY_CODE=
HYMLY_ONION_PORT=8086
HYMLY_REPO="https://github.com/danpros/htmly"
HYMLY_COMMIT='bf5fe9486160be4da86d8987d3e5c977e1dc6d32'
HTMLY_DOMAIN_NAME=
HTMLY_CODE=
HTMLY_ONION_PORT=8086
HTMLY_REPO="https://github.com/danpros/htmly"
HTMLY_COMMIT='bf5fe9486160be4da86d8987d3e5c977e1dc6d32'
HTMLY_TITLE="My Htmly"
HTMLY_SUBTITLE="Another ${PROJECT_NAME} Htmly"
htmly_variables=(HYMLY_REPO
HYMLY_COMMIT
HYMLY_DOMAIN_NAME
HYMLY_CODE
htmly_variables=(HTMLY_REPO
HTMLY_COMMIT
HTMLY_DOMAIN_NAME
HTMLY_CODE
HTMLY_TITLE
HTMLY_SUBTITLE
ONION_ONLY
@ -91,8 +91,8 @@ function set_avatar_from_url {
function remove_user_htmly {
remove_username="$1"
if [ -f /var/www/${HYMLY_DOMAIN_NAME}/htdocs/config/users/${remove_username}.ini ]; then
rm /var/www/${HYMLY_DOMAIN_NAME}/htdocs/config/users/${remove_username}.ini
if [ -f /var/www/${HTMLY_DOMAIN_NAME}/htdocs/config/users/${remove_username}.ini ]; then
rm /var/www/${HTMLY_DOMAIN_NAME}/htdocs/config/users/${remove_username}.ini
fi
}
@ -105,7 +105,7 @@ function add_user_htmly {
new_username="$1"
new_user_password="$2"
if [ ! -d /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users ]; then
if [ ! -d /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users ]; then
echo '2'
return
fi
@ -114,11 +114,11 @@ function add_user_htmly {
echo '3'
return
fi
echo ';Password' > /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
echo "password = $NEW_USER_PASSWORD_HASH" >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
echo 'encryption = password_hash' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
echo ';Role' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
echo 'role = admin' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
echo ';Password' > /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
echo "password = $NEW_USER_PASSWORD_HASH" >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
echo 'encryption = password_hash' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
echo ';Role' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
echo 'role = admin' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$new_username.ini
echo '0'
}
@ -152,21 +152,19 @@ function install_interactive_htmly {
if [[ $ONION_ONLY != "no" ]]; then
HTMLY_TITLE='My Htmly'
HYMLY_DOMAIN_NAME='htmly.local'
HTMLY_DOMAIN_NAME='htmly.local'
write_config_param "HTMLY_TITLE" "$HTMLY_TITLE"
write_config_param "HYMLY_DOMAIN_NAME" "$HYMLY_DOMAIN_NAME"
write_config_param "HTMLY_DOMAIN_NAME" "$HTMLY_DOMAIN_NAME"
else
function_check interactive_site_details_with_title
interactive_site_details_with_title "htmly" "HTMLY_TITLE" "HYMLY_DOMAIN_NAME" "HYMLY_CODE"
interactive_site_details_with_title "htmly" "HTMLY_TITLE" "HTMLY_DOMAIN_NAME" "HTMLY_CODE"
fi
APP_INSTALLED=1
}
function change_password_htmly {
if ! grep -q "htmly domain:" $COMPLETION_FILE; then
echo "htmly domain:$HYMLY_DOMAIN_NAME" >> $COMPLETION_FILE
fi
HYMLY_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "htmly domain" | head -n 1 | awk -F ':' '{print $2}')
set_completion_param "htmly domain" "$HTMLY_DOMAIN_NAME"
HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
HTMLY_USERNAME="$1"
HTMLY_PASSWORD="$2"
@ -179,7 +177,7 @@ function change_password_htmly {
echo $'Htmly admin password could not be hashed'
exit 625728
fi
sed -i "s|password =.*|password = $HTMLY_PASSWORD_HASH|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$HTMLY_USERNAME.ini
sed -i "s|password =.*|password = $HTMLY_PASSWORD_HASH|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$HTMLY_USERNAME.ini
}
function reconfigure_htmly {
@ -187,25 +185,25 @@ function reconfigure_htmly {
}
function upgrade_htmly {
read_config_param "HYMLY_DOMAIN_NAME"
read_config_param "HTMLY_DOMAIN_NAME"
function_check set_repo_commit
set_repo_commit /var/www/$HYMLY_DOMAIN_NAME/htdocs "htmly commit" "$HYMLY_COMMIT" $HYMLY_REPO
set_repo_commit /var/www/$HTMLY_DOMAIN_NAME/htdocs "htmly commit" "$HTMLY_COMMIT" $HTMLY_REPO
}
function backup_local_htmly {
HYMLY_DOMAIN_NAME='htmly'
HTMLY_DOMAIN_NAME='htmly'
if grep -q "htmly domain" $COMPLETION_FILE; then
HYMLY_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "htmly domain" | awk -F ':' '{print $2}')
HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
fi
source_directory=/var/www/${HYMLY_DOMAIN_NAME}/htdocs
source_directory=/var/www/${HTMLY_DOMAIN_NAME}/htdocs
if [ -d $source_directory ]; then
dest_directory=htmly
echo $"Backing up $source_directory to $dest_directory"
function_check suspend_site
suspend_site ${HYMLY_DOMAIN_NAME}
suspend_site ${HTMLY_DOMAIN_NAME}
function_check backup_directory_to_usb
backup_directory_to_usb $source_directory $dest_directory
@ -218,52 +216,52 @@ function backup_local_htmly {
}
function restore_local_htmly {
HYMLY_DOMAIN_NAME='htmly'
HTMLY_DOMAIN_NAME='htmly'
if grep -q "htmly domain" $COMPLETION_FILE; then
HYMLY_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "htmly domain" | awk -F ':' '{print $2}')
HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
fi
if [ $HYMLY_DOMAIN_NAME ]; then
if [ $HTMLY_DOMAIN_NAME ]; then
echo $"Restoring htmly installation"
temp_restore_dir=/root/temphtmly
restore_directory_from_usb $temp_restore_dir htmly
rm -rf /var/www/${HYMLY_DOMAIN_NAME}/htdocs
cp -r $temp_restore_dir/var/www/${HYMLY_DOMAIN_NAME}/htdocs /var/www/${HYMLY_DOMAIN_NAME}/
rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
cp -r $temp_restore_dir/var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/
if [ ! "$?" = "0" ]; then
set_user_permissions
backup_unmount_drive
exit 593
fi
rm -rf $temp_restore_dir
if [ ! -d /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content ]; then
if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
echo $"No content directory found after restoring htmly"
set_user_permissions
backup_unmount_drive
exit 287
fi
chown -R www-data:www-data /var/www/${HYMLY_DOMAIN_NAME}/htdocs
chown -R www-data:www-data /var/www/${HTMLY_DOMAIN_NAME}/htdocs
# Ensure that the bundled SSL cert is being used
if [ -f /etc/ssl/certs/${HYMLY_DOMAIN_NAME}.bundle.crt ]; then
sed -i "s|${HYMLY_DOMAIN_NAME}.crt|${HYMLY_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${HYMLY_DOMAIN_NAME}
if [ -f /etc/ssl/certs/${HTMLY_DOMAIN_NAME}.bundle.crt ]; then
sed -i "s|${HTMLY_DOMAIN_NAME}.crt|${HTMLY_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${HTMLY_DOMAIN_NAME}
fi
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
if [ -d /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post ]; then
mv /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/*.md /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post ]; then
mv /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/*.md /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post
fi
fi
done
if [ -d /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME} ]; then
ln -s /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${HYMLY_DOMAIN_NAME}.key
ln -s /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${HYMLY_DOMAIN_NAME}.pem
if [ -d /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME} ]; then
ln -s /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${HTMLY_DOMAIN_NAME}.key
ln -s /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${HTMLY_DOMAIN_NAME}.pem
fi
fi
}
function backup_remote_htmly {
if grep -q "htmly domain" $COMPLETION_FILE; then
HYMLY_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "htmly domain" | awk -F ':' '{print $2}')
temp_backup_dir=/var/www/${HYMLY_DOMAIN_NAME}/htdocs
HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
temp_backup_dir=/var/www/${HTMLY_DOMAIN_NAME}/htdocs
if [ -d $temp_backup_dir ]; then
echo $"Backing up htmly"
backup_directory_to_friend $temp_backup_dir htmly
@ -277,63 +275,63 @@ function backup_remote_htmly {
function restore_remote_htmly {
if [ -d $SERVER_DIRECTORY/backup/htmly ]; then
HYMLY_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "htmly domain" | awk -F ':' '{print $2}')
echo $"Restoring htmly installation $HYMLY_DOMAIN_NAME"
HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
echo $"Restoring htmly installation $HTMLY_DOMAIN_NAME"
temp_restore_dir=/root/temphtmly
mkdir $temp_restore_dir
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir htmly
rm -rf /var/www/${HYMLY_DOMAIN_NAME}/htdocs
cp -r $temp_restore_dir/var/www/${HYMLY_DOMAIN_NAME}/htdocs /var/www/${HYMLY_DOMAIN_NAME}/
rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
cp -r $temp_restore_dir/var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/
if [ ! "$?" = "0" ]; then
exit 593
fi
rm -rf $temp_restore_dir
if [ ! -d /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content ]; then
if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
echo $"No content directory found after restoring htmly"
exit 287
fi
# Ensure that the bundled SSL cert is being used
if [ -f /etc/ssl/certs/${HYMLY_DOMAIN_NAME}.bundle.crt ]; then
sed -i "s|${HYMLY_DOMAIN_NAME}.crt|${HYMLY_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${HYMLY_DOMAIN_NAME}
if [ -f /etc/ssl/certs/${HTMLY_DOMAIN_NAME}.bundle.crt ]; then
sed -i "s|${HTMLY_DOMAIN_NAME}.crt|${HTMLY_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${HTMLY_DOMAIN_NAME}
fi
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
if [ -d /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post ]; then
mv /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/*.md /var/www/${HYMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post ]; then
mv /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/*.md /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content/$USERNAME/htmly/uncategorized/post
fi
fi
done
if [ -d /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME} ]; then
ln -s /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${HYMLY_DOMAIN_NAME}.key
ln -s /etc/letsencrypt/live/${HYMLY_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${HYMLY_DOMAIN_NAME}.pem
if [ -d /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME} ]; then
ln -s /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${HTMLY_DOMAIN_NAME}.key
ln -s /etc/letsencrypt/live/${HTMLY_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${HTMLY_DOMAIN_NAME}.pem
fi
echo $"Restore of htmly complete"
fi
}
function remove_htmly {
if [ ${#HYMLY_DOMAIN_NAME} -eq 0 ]; then
if [ ${#HTMLY_DOMAIN_NAME} -eq 0 ]; then
return
fi
read_config_param "HYMLY_DOMAIN_NAME"
nginx_dissite $HYMLY_DOMAIN_NAME
if [ -f /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME ]; then
rm -f /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
read_config_param "HTMLY_DOMAIN_NAME"
nginx_dissite $HTMLY_DOMAIN_NAME
if [ -f /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME ]; then
rm -f /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
fi
if [ -d /var/www/$HYMLY_DOMAIN_NAME ]; then
rm -rf /var/www/$HYMLY_DOMAIN_NAME
if [ -d /var/www/$HTMLY_DOMAIN_NAME ]; then
rm -rf /var/www/$HTMLY_DOMAIN_NAME
fi
if [ $HYMLY_CODE ]; then
if [ $HTMLY_CODE ]; then
if [ -f /usr/bin/dynamicdns ]; then
sed -i "/$HYMLY_DOMAIN_NAME/d" /usr/bin/dynamicdns
sed -i "/$HYMLY_CODE/d" /usr/bin/dynamicdns
sed -i "/$HTMLY_DOMAIN_NAME/d" /usr/bin/dynamicdns
sed -i "/$HTMLY_CODE/d" /usr/bin/dynamicdns
fi
fi
function_check remove_onion_service
remove_onion_service htmly ${HYMLY_ONION_PORT}
remove_onion_service htmly ${HTMLY_ONION_PORT}
sed -i '/install_htmly/d' $COMPLETION_FILE
sed -i '/Htmly .*/d' $COMPLETION_FILE
}
@ -341,254 +339,250 @@ function remove_htmly {
function get_htmly_admin_password {
if [ -f /home/$MY_USERNAME/README ]; then
if grep -q "Your htmly password is" /home/$MY_USERNAME/README; then
HYMLY_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "Your htmly password is" | awk -F ':' '{print $2}' | sed 's/^ *//')
HTMLY_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "Your htmly password is" | awk -F ':' '{print $2}' | sed 's/^ *//')
fi
fi
}
function install_htmly_social_networks {
# set social networks
if grep -q "social.hubzilla" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini; then
sed -i "s|;social.hubzilla|social.hubzilla|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|social.hubzilla.*|social.hubzilla = \"$HUBZILLA_DOMAIN_NAME\"|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
if grep -q "social.hubzilla" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini; then
sed -i "s|;social.hubzilla|social.hubzilla|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|social.hubzilla.*|social.hubzilla = \"$HUBZILLA_DOMAIN_NAME\"|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
fi
if grep -q "social.gnusocial" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini; then
sed -i "s|;social.gnusocial|social.gnusocial|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|social.gnusocial.*|social.gnusocial = \"$MICROHTMLY_DOMAIN_NAME\"|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
if grep -q "social.gnusocial" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini; then
sed -i "s|;social.gnusocial|social.gnusocial|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|social.gnusocial.*|social.gnusocial = \"$MICROHTMLY_DOMAIN_NAME\"|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
fi
# clear proprietary social network strings
sed -i 's|social.facebook.*|social.facebook = ""|g' /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i 's|social.twitter.*|social.twitter = ""|g' /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i 's|social.google.*|social.google = ""|g' /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i 's|social.facebook.*|social.facebook = ""|g' /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i 's|social.twitter.*|social.twitter = ""|g' /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i 's|social.google.*|social.google = ""|g' /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
}
function install_htmly_user {
# create a user password
function_check get_htmly_admin_password
get_htmly_admin_password
if [ ! $HYMLY_ADMIN_PASSWORD ]; then
if [ ! $HTMLY_ADMIN_PASSWORD ]; then
if [ -f $IMAGE_PASSWORD_FILE ]; then
HYMLY_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
HTMLY_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
else
HYMLY_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
HTMLY_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
fi
echo '' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo $'HTMLy Htmly' >> /home/$MY_USERNAME/README
echo '==========' >> /home/$MY_USERNAME/README
echo $"Your htmly username: $MY_USERNAME" >> /home/$MY_USERNAME/README
echo $"Your htmly password is: $HYMLY_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
echo $"Your htmly password is: $HTMLY_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
if [[ $ONION_ONLY == 'no' ]]; then
echo $"Log into your htmly at https://$HYMLY_DOMAIN_NAME/login" >> /home/$MY_USERNAME/README
echo $"Log into your htmly at https://$HTMLY_DOMAIN_NAME/login" >> /home/$MY_USERNAME/README
fi
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
chmod 600 /home/$MY_USERNAME/README
fi
# create a user
HYMLY_ADMIN_PASSWORD_HASH=$(${PROJECT_NAME}-sec --htmlyhash "$HYMLY_ADMIN_PASSWORD")
if [ ${#HYMLY_ADMIN_PASSWORD_HASH} -lt 8 ]; then
HTMLY_ADMIN_PASSWORD_HASH=$(${PROJECT_NAME}-sec --htmlyhash "$HTMLY_ADMIN_PASSWORD")
if [ ${#HTMLY_ADMIN_PASSWORD_HASH} -lt 8 ]; then
echo $'Htmly admin password could not be hashed'
exit 625728
fi
echo ';Password' > /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo "password = $HYMLY_ADMIN_PASSWORD_HASH" >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo 'encryption = password_hash' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo ';Role' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo 'role = admin' >> /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo ';Password' > /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo "password = $HTMLY_ADMIN_PASSWORD_HASH" >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo 'encryption = password_hash' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo ';Role' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo 'role = admin' >> /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
}
function install_htmly_settings {
cp /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini.example /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|site.url.*|site.url = '/'|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|htmly.title.*|htmly.title = '$HTMLY_TITLE'|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|htmly.tagline.*|htmly.tagline = '$HTMLY_SUBTITLE'|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i 's|timezone.*|timezone = "Europe/London"|g' /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|Your name|$MY_NAME|g" /var/www/$HYMLY_DOMAIN_NAME/htdocs/config/config.ini
cp /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini.example /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|site.url.*|site.url = '/'|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|htmly.title.*|htmly.title = '$HTMLY_TITLE'|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|htmly.tagline.*|htmly.tagline = '$HTMLY_SUBTITLE'|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i 's|timezone.*|timezone = "Europe/London"|g' /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
sed -i "s|Your name|$MY_NAME|g" /var/www/$HTMLY_DOMAIN_NAME/htdocs/config/config.ini
}
function install_htmly_website {
function_check nginx_http_redirect
nginx_http_redirect $HYMLY_DOMAIN_NAME
echo 'server {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' listen 443 ssl;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " root /var/www/$HYMLY_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " server_name $HYMLY_DOMAIN_NAME;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' access_log off;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " error_log /var/log/nginx/${HYMLY_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' index index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' charset utf-8;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
nginx_http_redirect $HTMLY_DOMAIN_NAME
echo 'server {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' listen 443 ssl;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " root /var/www/$HTMLY_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " server_name $HTMLY_DOMAIN_NAME;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' access_log off;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " error_log /var/log/nginx/${HTMLY_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' charset utf-8;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
function_check nginx_ssl
nginx_ssl $HYMLY_DOMAIN_NAME
nginx_ssl $HTMLY_DOMAIN_NAME
function_check nginx_disable_sniffing
nginx_disable_sniffing $HYMLY_DOMAIN_NAME
echo ' add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location / {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
nginx_disable_sniffing $HTMLY_DOMAIN_NAME
echo ' add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location / {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
function_check nginx_limits
nginx_limits $HYMLY_DOMAIN_NAME
echo ' rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' allow all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # statically serve these file types when possible' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # otherwise fall back to front controller' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # allow browser to cache them' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' expires 30d;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # block these file types' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # or a unix socket' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~* \.php$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # Zero-day exploit defense.' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # With php5-cgi alone:' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # With php5-fpm:' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' include fastcgi_params;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' fastcgi_index index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # deny access to all dot files' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~ /\. {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' #deny access to store' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~ /store {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~ /\.ht {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '}' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
nginx_limits $HTMLY_DOMAIN_NAME
echo ' rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' allow all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # statically serve these file types when possible' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # otherwise fall back to front controller' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # allow browser to cache them' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' expires 30d;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # block these file types' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # or a unix socket' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~* \.php$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # Zero-day exploit defense.' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # With php5-cgi alone:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # With php5-fpm:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' include fastcgi_params;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' fastcgi_index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # deny access to all dot files' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~ /\. {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' #deny access to store' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~ /store {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~ /\.ht {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '}' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
}
function install_htmly_website_onion {
echo 'server {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " listen 127.0.0.1:${HYMLY_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " root /var/www/$HYMLY_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " server_name $HYMLY_DOMAIN_NAME;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' access_log off;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " error_log /var/log/nginx/${HYMLY_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' index index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' charset utf-8;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo 'server {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " listen 127.0.0.1:${HTMLY_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " root /var/www/$HTMLY_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " server_name $HTMLY_DOMAIN_NAME;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' access_log off;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " error_log /var/log/nginx/${HTMLY_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' charset utf-8;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
function_check nginx_disable_sniffing
nginx_disable_sniffing $HYMLY_DOMAIN_NAME
echo ' add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location / {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
nginx_disable_sniffing $HTMLY_DOMAIN_NAME
echo ' add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location / {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
function_check nginx_limits
nginx_limits $HYMLY_DOMAIN_NAME
echo ' rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' allow all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # statically serve these file types when possible' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # otherwise fall back to front controller' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # allow browser to cache them' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' expires 30d;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # block these file types' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # or a unix socket' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~* \.php$ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
nginx_limits $HTMLY_DOMAIN_NAME
echo ' rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' allow all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # statically serve these file types when possible' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # otherwise fall back to front controller' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # allow browser to cache them' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' expires 30d;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # block these file types' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # or a unix socket' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~* \.php$ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
function_check nginx_limits
nginx_limits $HYMLY_DOMAIN_NAME
echo ' # Zero-day exploit defense.' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo " # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # With php5-cgi alone:' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # With php5-fpm:' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' include fastcgi_params;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' fastcgi_index index.php;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' # deny access to all dot files' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~ /\. {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' #deny access to store' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~ /store {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' location ~ /\.ht {' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo '}' >> /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
nginx_limits $HTMLY_DOMAIN_NAME
echo ' # Zero-day exploit defense.' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo " # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # With php5-cgi alone:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # With php5-fpm:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' include fastcgi_params;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' fastcgi_index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' # deny access to all dot files' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~ /\. {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' #deny access to store' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~ /store {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' location ~ /\.ht {' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' deny all;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
echo '}' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
}
function install_htmly_from_repo {
if [ ! -d /var/www/$HYMLY_DOMAIN_NAME ]; then
mkdir /var/www/$HYMLY_DOMAIN_NAME
if [ ! -d /var/www/$HTMLY_DOMAIN_NAME ]; then
mkdir /var/www/$HTMLY_DOMAIN_NAME
fi
cd /var/www/$HYMLY_DOMAIN_NAME
git_clone $HYMLY_REPO htdocs
cd /var/www/$HTMLY_DOMAIN_NAME
git_clone $HTMLY_REPO htdocs
cd htdocs
git checkout $HYMLY_COMMIT -b $HYMLY_COMMIT
if ! grep -q "htmly commit" $COMPLETION_FILE; then
echo "htmly commit:$HYMLY_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/htmly commit.*/htmly commit:$HYMLY_COMMIT/g" $COMPLETION_FILE
fi
git checkout $HTMLY_COMMIT -b $HTMLY_COMMIT
set_completion_param "htmly commit" "$HTMLY_COMMIT"
}
function install_htmly {
@ -596,7 +590,7 @@ function install_htmly {
ONION_ONLY='no'
fi
if [ ! $HYMLY_DOMAIN_NAME ]; then
if [ ! $HTMLY_DOMAIN_NAME ]; then
echo $'The htmly domain name was not specified'
exit 5062
fi
@ -611,13 +605,13 @@ function install_htmly {
function_check install_htmly_website
install_htmly_website
else
echo -n '' > /etc/nginx/sites-available/$HYMLY_DOMAIN_NAME
echo -n '' > /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
fi
function_check install_htmly_website_onion
install_htmly_website_onion
function_check create_site_certificate
create_site_certificate $HYMLY_DOMAIN_NAME 'yes'
create_site_certificate $HTMLY_DOMAIN_NAME 'yes'
function_check configure_php
configure_php
@ -631,30 +625,28 @@ function install_htmly {
function_check install_htmly_user
install_htmly_user
chown -R www-data:www-data /var/www/$HYMLY_DOMAIN_NAME/htdocs
chown -R www-data:www-data /var/www/$HTMLY_DOMAIN_NAME/htdocs
HYMLY_ONION_HOSTNAME=$(add_onion_service htmly 80 ${HYMLY_ONION_PORT})
HTMLY_ONION_HOSTNAME=$(add_onion_service htmly 80 ${HTMLY_ONION_PORT})
function_check nginx_ensite
nginx_ensite $HYMLY_DOMAIN_NAME
nginx_ensite $HTMLY_DOMAIN_NAME
systemctl restart php5-fpm
systemctl restart nginx
if ! grep -q "Htmly onion domain" /home/$MY_USERNAME/README; then
echo $"Htmly onion domain: ${HYMLY_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
echo $"Log into your htmly at https://${HYMLY_ONION_HOSTNAME}/login" >> /home/$MY_USERNAME/README
echo $"Htmly onion domain: ${HTMLY_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
echo $"Log into your htmly at https://${HTMLY_ONION_HOSTNAME}/login" >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
chmod 600 /home/$MY_USERNAME/README
fi
function_check add_ddns_domain
add_ddns_domain $HYMLY_DOMAIN_NAME
add_ddns_domain $HTMLY_DOMAIN_NAME
if ! grep -q "htmly domain:" $COMPLETION_FILE; then
echo "htmly domain:$HYMLY_DOMAIN_NAME" >> $COMPLETION_FILE
fi
set_completion_param "htmly domain" "$HTMLY_DOMAIN_NAME"
APP_INSTALLED=1
}

18
src/freedombone-app-hubzilla

@ -59,7 +59,7 @@ function hubzilla_renew_cert {
1) return;;
255) return;;
esac
HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "hubzilla domain" | awk -F ':' '{print $2}')
HUBZILLA_DOMAIN_NAME=$(get_completion_param "hubzilla domain")
if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs ]; then
dialog --title $"Renew SSL certificate" \
--msgbox $"Hubzilla install directory not found" 6 40
@ -80,7 +80,7 @@ function hubzilla_channel_directory_server {
--msgbox $"Hubzilla is not installed on this system" 6 40
return
fi
HUBZILLA_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "hubzilla domain" | awk -F ':' '{print $2}')
HUBZILLA_DOMAIN_NAME=$(get_completion_param "hubzilla domain")
if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs ]; then
dialog --title $"Hubzilla channel directory server" \
--msgbox $"Hubzilla install directory not found" 6 40
@ -327,11 +327,7 @@ function install_hubzilla {
function_check git_clone
git_clone $HUBZILLA_REPO hubzilla
git checkout $HUBZILLA_COMMIT -b $HUBZILLA_COMMIT
if ! grep -q "hubzilla commit" $COMPLETION_FILE; then
echo "hubzilla commit:$HUBZILLA_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/hubzilla commit.*/hubzilla commit:$HUBZILLA_COMMIT/g" $COMPLETION_FILE
fi
set_completion_param "hubzilla commit" "$HUBZILLA_COMMIT"
rm -rf $HUBZILLA_PATH
mv hubzilla $HUBZILLA_PATH
@ -339,11 +335,7 @@ function install_hubzilla {
git_clone $HUBZILLA_ADDONS_REPO $HUBZILLA_PATH/addon
cd $HUBZILLA_PATH/addon
git checkout $HUBZILLA_ADDONS_COMMIT -b $HUBZILLA_ADDONS_COMMIT
if ! grep -q "hubzilla addons commit" $COMPLETION_FILE; then
echo "hubzilla addons commit:$HUBZILLA_ADDONS_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/hubzilla addons commit.*/hubzilla addons commit:$HUBZILLA_ADDONS_COMMIT/g" $COMPLETION_FILE
fi
set_completion_param "hubzilla addons commit" "$HUBZILLA_ADDONS_COMMIT"
# some extra themes
git_clone $HUBZILLA_THEMES_REPO $HUBZILLA_PATH/redmatrix-themes1
@ -599,7 +591,7 @@ function install_hubzilla {
${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$HUBZILLA_DOMAIN_NAME" -g hubzilla --public no
echo "hubzilla domain:${HUBZILLA_DOMAIN_NAME}" >> $COMPLETION_FILE
set_completion_param "hubzilla domain" "${HUBZILLA_DOMAIN_NAME}"
APP_INSTALLED=1
}

20
src/freedombone-app-ipfs

@ -89,7 +89,7 @@ function backup_local_ipfs {
if ! grep -q "Admin user" $COMPLETION_FILE; then
return
fi
ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
ADMIN_USERNAME=$(get_completion_param "Admin user")
source_directory=/home/$ADMIN_USERNAME/.ipfs
if [ -d $source_directory ]; then
dest_directory=ipfs
@ -111,7 +111,7 @@ function restore_local_ipfs {
temp_restore_dir=/root/tempipfs
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir ipfs
ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
ADMIN_USERNAME=$(get_completion_param "Admin user")
cp -rf $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs
if [ ! "$?" = "0" ]; then
rm -rf $temp_restore_dir
@ -130,7 +130,7 @@ function backup_remote_ipfs {
if ! grep -q "Admin user" $COMPLETION_FILE; then
return
fi
ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
ADMIN_USERNAME=$(get_completion_param "Admin user")
if [ -d /home/$ADMIN_USERNAME/.ipfs ]; then
echo $"Backing up IPFS"
backup_directory_to_friend /home/$ADMIN_USERNAME/.ipfs ipfs
@ -193,7 +193,7 @@ function remove_ipfs {
}
function configure_firewall_for_ipfs {
if grep -Fxq "configure_firewall_for_ipfs" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
if [[ $ONION_ONLY != "no" ]]; then
@ -204,11 +204,11 @@ function configure_firewall_for_ipfs {
save_firewall_settings
OPEN_PORTS+=("IPFS $IPFS_PORT")
echo 'configure_firewall_for_ipfs' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function mesh_install_ipfs_js {
if grep -Fxq "mesh_install_ipfs_js" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
@ -280,7 +280,7 @@ EOF
chroot ${rootdir} systemctl enable ${IPFS_DAEMON_NAME}
echo 'mesh install_ipfs_js' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function install_ipfs_js {
@ -515,11 +515,7 @@ function install_ipfs_go {
exit 735639
fi
if ! grep -q "ipfs commit" $COMPLETION_FILE; then
echo "ipfs commit:$IPFS_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/ipfs commit.*/ipfs commit:$IPFS_COMMIT/g" $COMPLETION_FILE
fi
set_completion_param "ipfs commit" "$IPFS_COMMIT"
make install
if [ ! "$?" = "0" ]; then

16
src/freedombone-app-librevault

@ -120,7 +120,7 @@ function remove_librevault {
}
function configure_firewall_for_librevault {
if grep -Fxq "configure_firewall_for_librevault" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
iptables -A INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
@ -128,7 +128,7 @@ function configure_firewall_for_librevault {
function_check save_firewall_settings
save_firewall_settings
OPEN_PORTS+=("Librevault $LIBREVAULT_PORT")
echo 'configure_firewall_for_librevault' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function mesh_install_librevault {
@ -263,11 +263,7 @@ function install_librevault {
make install
ldconfig
if ! grep -q "Protobuf commit" $COMPLETION_FILE; then
echo "Protobuf commit:$PROTOBUF_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/Protobuf commit.*/Protobuf commit:$PROTOBUF_COMMIT/g" $COMPLETION_FILE
fi
set_completion_param "Protobuf commit" "$PROTOBUF_COMMIT"
git_clone $LIBREVAULT_REPO $INSTALL_DIR/librevault
cd $INSTALL_DIR/librevault
@ -286,11 +282,7 @@ function install_librevault {
cmake --build .
make install
if ! grep -q "Librevault commit" $COMPLETION_FILE; then
echo "Librevault commit:$LIBREVAULT_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/Librevault commit.*/Librevault commit:$LIBREVAULT_COMMIT/g" $COMPLETION_FILE
fi
set_completion_param "Librevault commit" "$LIBREVAULT_COMMIT"
LIBREVAULT_DAEMON=/etc/systemd/system/librevault-daemon.service
echo '[Unit]' > $LIBREVAULT_DAEMON

12
src/freedombone-app-mediagoblin

@ -211,11 +211,7 @@ function install_mediagoblin {
git submodule init
git submodule update
if ! grep -q "Mediagoblin commit" $COMPLETION_FILE; then
echo "Mediagoblin commit:$MEDIAGOBLIN_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/Mediagoblin commit.*/Mediagoblin commit:$MEDIAGOBLIN_COMMIT/g" $COMPLETION_FILE
fi
set_completion_param "mediagoblin commit" "$MEDIAGOBLIN_COMMIT"
chown -hR mediagoblin:www-data $MEDIAGOBLIN_WORKING_DIRECTORY
su -c "cd $MEDIAGOBLIN_WORKING_DIRECTORY && ./bootstrap.sh" - mediagoblin
@ -497,11 +493,7 @@ function install_mediagoblin {
add_ddns_domain $MEDIAGOBLIN_DOMAIN_NAME
if ! grep -q "Mediagoblin domain" $COMPLETION_FILE; then
echo "Mediagoblin domain:$MEDIAGOBLIN_DOMAIN_NAME" >> $COMPLETION_FILE
else
sed -i "s/Mediagoblin domain.*/Mediagoblin domain:$MEDIAGOBLIN_DOMAIN_NAME/g" $COMPLETION_FILE
fi
set_completion_param "mediagoblin domain" "$MEDIAGOBLIN_DOMAIN_NAME"
APP_INSTALLED=1
}

4
src/freedombone-app-mumble

@ -178,7 +178,7 @@ function get_mumble_server_password {
}
function configure_firewall_for_mumble {
if grep -Fxq "configure_firewall_for_mumble" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
if [[ $ONION_ONLY != "no" ]]; then
@ -190,7 +190,7 @@ function configure_firewall_for_mumble {
save_firewall_settings
OPEN_PORTS+=("Mumble $MUMBLE_PORT")
echo 'configure_firewall_for_mumble' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function install_mumble {

14
src/freedombone-app-rss

@ -129,7 +129,7 @@ function upgrade_rss {
function backup_local_rss {
if [ -d /etc/share/tt-rss ]; then
RSS_READER_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "rss reader domain" | awk -F ':' '{print $2}')
RSS_READER_DOMAIN_NAME=$(get_completion_param "rss reader domain")
echo $"Backing up ttrss"
@ -298,9 +298,7 @@ function install_rss_main {
fi
cd $RSS_READER_PATH
git checkout $RSS_READER_COMMIT -b $RSS_READER_COMMIT
if ! grep -q "rss reader commit" $COMPLETION_FILE; then
echo "rss reader commit:$RSS_READER_COMMIT" >> $COMPLETION_FILE
fi
set_completion_param "rss reader commit" "$RSS_READER_COMMIT"
function_check install_mariadb
install_mariadb
@ -543,9 +541,7 @@ function install_rss_gnusocial {
cp -r $INSTALL_DIR/ttrss-gnusocial $RSS_READER_GNUSOCIAL_PATH
cd $RSS_READER_GNUSOCIAL_PATH
git checkout $RSS_READER_GNUSOCIAL_COMMIT -b $RSS_READER_GNUSOCIAL_COMMIT
if ! grep -q "rss reader gnusocial commit" $COMPLETION_FILE; then
echo "rss reader gnusocial commit:$RSS_READER_GNUSOCIAL_COMMIT" >> $COMPLETION_FILE
fi
set_completion_param "rss reader gnusocial commit" "$RSS_READER_GNUSOCIAL_COMMIT"
chown -R www-data:www-data $RSS_READER_GNUSOCIAL_PATH
install_completed rss_gnusocial
}
@ -584,9 +580,7 @@ function install_rss_mobile_reader {
fi
cd $RSS_MOBILE_READER_PATH
git checkout $RSS_MOBILE_READER_COMMIT -b $RSS_MOBILE_READER_COMMIT
if ! grep -q "rss mobile reader commit" $COMPLETION_FILE; then
echo "rss mobile reader commit:$RSS_MOBILE_READER_COMMIT" >> $COMPLETION_FILE
fi
set_completion_param "rss mobile reader commit" "$RSS_MOBILE_READER_COMMIT"
echo 'define({' > $RSS_MOBILE_READER_PATH/scripts/conf.js
echo ' apiPath: "/tt-rss/"' >> $RSS_MOBILE_READER_PATH/scripts/conf.js

14
src/freedombone-app-searx

@ -69,7 +69,7 @@ function upgrade_searx {
echo ' http : socks5://127.0.0.1:9050' >> ${SEARX_PATH}/searx/searx/settings.yml
echo ' https: socks5://127.0.0.1:9050' >> ${SEARX_PATH}/searx/searx/settings.yml
fi
SEARX_SECRET_KEY=$(cat $COMPLETION_FILE | grep "Search engine key" | awk -F ':' '{print $2}')
SEARX_SECRET_KEY=$(get_completion_param "searx key")
sed -i "s|secret_key.*|secret_key : \"${SEARX_SECRET_KEY}\"|g" ${SEARX_PATH}/searx/searx/settings.yml
if [ -f /var/lib/tor/hidden_service_searx/hostname ]; then
SEARX_ONION_HOSTNAME=$(echo /var/lib/tor/hidden_service_searx/hostname)
@ -164,11 +164,7 @@ function install_searx {
function_check git_clone
git_clone $SEARX_REPO searx
git checkout $SEARX_COMMIT -b $SEARX_COMMIT
if ! grep -q "Search engine commit" $COMPLETION_FILE; then
echo "Search engine commit:$SEARX_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/Search engine commit.*/Search engine commit:$SEARX_COMMIT/g" $COMPLETION_FILE
fi
set_completion_param "searx commit" "$SEARX_COMMIT"
# create an onion service
SEARX_ONION_HOSTNAME=$(add_onion_service searx 80 ${SEARX_ONION_PORT})
@ -235,12 +231,10 @@ function install_searx {
echo '}' >> /etc/nginx/sites-available/searx
# replace the secret key
if ! grep "Search engine key" $COMPLETION_FILE; then
if ! grep "searx key" $COMPLETION_FILE; then
SEARX_SECRET_KEY="$(create_password 30)"
echo "Search engine key:${SEARX_SECRET_KEY}" >> $COMPLETION_FILE
else
SEARX_SECRET_KEY=$(cat $COMPLETION_FILE | grep "Search engine key" | awk -F ':' '{print $2}')
fi
set_completion_param "searx key" "${SEARX_SECRET_KEY}"
sed -i "s|secret_key.*|secret_key : \"${SEARX_SECRET_KEY}\"|g" ${SEARX_PATH}/searx/searx/settings.yml
sed -i "s|secret_key.*|secret_key : \"${SEARX_SECRET_KEY}\"|g" ${SEARX_PATH}/searx/searx/settings_robot.yml
sed -i '0,/RE/s/base_url.*/base_url : \"http://${SEARX_ONION_HOSTNAME}\/' ${SEARX_PATH}/searx/searx/settings.yml

8
src/freedombone-app-sip

@ -183,7 +183,7 @@ function remove_sip {
}
function configure_firewall_for_turn {
if grep -Fxq "configure_firewall_for_turn" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
if [[ $ONION_ONLY != "no" ]]; then
@ -197,12 +197,12 @@ function configure_firewall_for_turn {
OPEN_PORTS+=("TURN $TURN_PORT")
OPEN_PORTS+=("TURN TLS $TURN_TLS_PORT")
echo 'configure_firewall_for_turn' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function configure_firewall_for_sip4 {
if grep -Fxq "configure_firewall_for_sip4" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
if [[ $ONION_ONLY != "no" ]]; then
@ -217,7 +217,7 @@ function configure_firewall_for_sip4 {
OPEN_PORTS+=("SIP $SIP_PORT")
OPEN_PORTS+=("SIP TLS $SIP_TLS_PORT")
echo 'configure_firewall_for_sip4' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function get_sip_server_password {

4
src/freedombone-app-syncthing

@ -476,7 +476,7 @@ function remove_syncthing {
}
function configure_firewall_for_syncthing {
if grep -Fxq "configure_firewall_for_syncthing" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
@ -486,7 +486,7 @@ function configure_firewall_for_syncthing {
save_firewall_settings
OPEN_PORTS+=("Syncthing $SYNCTHING_PORT")
echo 'configure_firewall_for_syncthing' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function install_syncthing {

4
src/freedombone-app-tahoelafs

@ -203,7 +203,7 @@ function remove_tahoelafs {
}
function configure_firewall_for_tahoelafs {
if grep -Fxq "configure_firewall_for_tahoelafs" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
iptables -A INPUT -p udp --dport $TAHOELAFS_PORT -j ACCEPT
@ -211,7 +211,7 @@ function configure_firewall_for_tahoelafs {
function_check save_firewall_settings
save_firewall_settings
OPEN_PORTS+=("Tahoe-LAFS $TAHOELAFS_PORT")
echo 'configure_firewall_for_tahoelafs' >> $COMPLETION_FILE
mark_completed $FUNCNAME
}
function tahoelafs_update_script {

10
src/freedombone-app-tox

@ -283,7 +283,7 @@ function remove_tox {
function configure_firewall_for_tox {
if [ ! $INSTALLING_MESH ]; then
if [ -f $COMPLETION_FILE ]; then
if grep -Fxq "configure_firewall_for_tox" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return
fi
fi
@ -312,13 +312,11 @@ function configure_firewall_for_tox {
save_firewall_settings
OPEN_PORTS+=("Tox $TOX_PORT")
if [ -f $COMPLETION_FILE ]; then
echo 'configure_firewall_for_tox' >> $COMPLETION_FILE
fi
mark_completed $FUNCNAME
}
function tox_avahi {
if grep -Fxq "tox_avahi" $COMPLETION_FILE; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return