Support for apps only on onion addresses

This commit is contained in:
Bob Mottram 2018-02-06 18:39:49 +00:00
parent 51ceb967a5
commit 190d60d448
1 changed files with 75 additions and 55 deletions

View File

@ -38,6 +38,7 @@ app_repo="TODO"
app_repo_commit='TODO'
app_php=
app_node=
app_onion_only=
app_port=''
your_name=''
your_email=''
@ -59,6 +60,7 @@ function show_help {
echo $' -c --commit [hash] Git commit'
echo $' --port [number] Port number for the app'
echo $' --node [yes|no] Is this a nodejs app?'
echo $' -o --onion [yes|no] Is this app only available on an onion address?'
echo $' -p --php [yes|no] Is this a PHP app?'
echo $' -d --database [mariadb|postgresql] Type of database'
echo ''
@ -108,6 +110,12 @@ do
shift
app_node="$1"
;;
-o|--onion)
shift
if [[ "$1" == 'yes' ]]; then
app_onion_only=1
fi
;;
--port)
shift
app_port="$1"
@ -191,6 +199,9 @@ echo "VARIANTS='full full-vim'"
echo ''
echo 'IN_DEFAULT_INSTALL=0'
echo "SHOW_ON_ABOUT=${SHOW_ON_ABOUT}"
if [ $app_onion_only ]; then
echo 'SHOW_ICANN_ADDRESS_ON_ABOUT=0'
fi
echo ''
echo "${app_name_upper}_DOMAIN_NAME="
echo "${app_name_upper}_CODE="
@ -227,6 +238,7 @@ echo " echo '0'"
echo '}'
echo ''
echo "function install_interactive_${app_name} {"
if [ ! $app_onion_only ]; then
echo ' if [ ! $ONION_ONLY ]; then'
echo " ONION_ONLY='no'"
echo ' fi'
@ -237,6 +249,9 @@ echo " write_config_param \"${app_name_upper}_DOMAIN_NAME\" \"\$${app_nam
echo ' else'
echo " interactive_site_details \"${app_name}\" \"${app_name_upper}_DOMAIN_NAME\" \"${app_name}_CODE\""
echo ' fi'
else
echo " echo -n ''"
fi
echo ' APP_INSTALLED=1'
echo '}'
echo ''
@ -541,7 +556,7 @@ echo ''
echo " chmod g+w /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
echo " chown -R www-data:www-data /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" || "$database_type" == "postgres"* ]]; then
echo ''
echo " ${app_name}_create_database"
fi
@ -551,6 +566,8 @@ echo ''
echo " ${app_name_upper}_ONION_HOSTNAME=\$(add_onion_service ${app_name} 80 \${${app_name_upper}_ONION_PORT})"
echo ''
echo " ${app_name}_nginx_site=/etc/nginx/sites-available/\$${app_name_upper}_DOMAIN_NAME"
if [ $app_onion_only ]; then
echo ' if [[ $ONION_ONLY == "no" ]]; then'
if [[ "$app_php" == 'yes' ]]; then
echo " nginx_http_redirect \$${app_name_upper}_DOMAIN_NAME \"index index.php\""
@ -598,6 +615,9 @@ echo " echo '}' >> \$${app_name}_nginx_site"
echo ' else'
echo " echo -n '' > \$${app_name}_nginx_site"
echo ' fi'
else
echo " echo -n '' > \$${app_name}_nginx_site"
fi
echo " echo 'server {' >> \$${app_name}_nginx_site"
echo " echo \" listen 127.0.0.1:\$${app_name_upper}_ONION_PORT default_server;\" >> \$${app_name}_nginx_site"
echo " echo \" server_name \$${app_name_upper}_ONION_HOSTNAME;\" >> \$${app_name}_nginx_site"