Specify internal port within template command

This commit is contained in:
Bob Mottram 2018-05-14 22:11:31 +01:00
parent 855816f05b
commit 275b915d17
2 changed files with 73 additions and 53 deletions

Binary file not shown.

View File

@ -32,7 +32,7 @@ app_name='noapp'
app_name_lower=$(echo "${app_name}" | tr '[:upper:]' '[:lower:]')
app_name=$app_name_lower
app_name_upper=$(echo "${app_name}" | tr '[:lower:]' '[:upper:]')
app_repo="TODO"
app_repo=
app_repo_commit='TODO'
app_php=
app_node=
@ -75,6 +75,7 @@ function show_help {
echo $' -d --database [mariadb|postgresql|mongodb] Type of database'
echo $' -w --web [yes|no] Whether there is a web user interface (default is yes)'
echo $' --dir [directory] Where to install to'
echo $' -i --internalport [number] Internal port number for the daemon'
echo ''
exit 0
}
@ -114,6 +115,10 @@ do
shift
database_type="$1"
;;
-i|--internal|--internalport)
shift
app_port_internal="$1"
;;
-p|--php)
shift
app_php="$1"
@ -263,8 +268,10 @@ if [ "$app_port" ]; then
echo "${app_name_upper}_PORT=$app_port"
fi
echo "${app_name_upper}_ONION_PORT=$(( ( RANDOM % 1000 ) + 9010 ))"
if [ "$app_repo" ]; then
echo "${app_name_upper}_REPO=\"${app_repo}\""
echo "${app_name_upper}_COMMIT='${app_repo_commit}'"
fi
if [ $app_daemon ]; then
if [ ! "$app_port_internal" ]; then
echo "${app_name_upper}_PORT_INTERNAL=TODO"
@ -391,6 +398,9 @@ echo ' done'
echo '}'
echo ''
echo "function upgrade_${app_name} {"
if [ ! "$app_repo" ]; then
echo "echo -n ''"
else
echo " CURR_${app_name_upper}_COMMIT=\$(get_completion_param \"${app_name} commit\")"
echo " if [[ \"\$CURR_${app_name_upper}_COMMIT\" == \"\$${app_name_upper}_COMMIT\" ]]; then"
echo ' return'
@ -413,6 +423,7 @@ fi
if [ $app_daemon ]; then
echo " systemctl restart ${app_name}"
fi
fi
echo '}'
echo ''
echo "function backup_local_${app_name} {"
@ -775,6 +786,7 @@ if [ $app_webui ]; then
echo ' fi'
fi
if [ "$app_repo" ]; then
echo " if [ -d /repos/${app_name} ]; then"
if [ $app_webui ]; then
echo " mkdir \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
@ -804,13 +816,21 @@ echo " echo \$'Unable to clone ${app_name} repo'"
echo ' exit 87525'
echo ' fi'
echo ''
else
echo " mkdir -p \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
if [ "$app_dir" ]; then
echo " mkdir \"${app_dir}\""
fi
fi
if [ ! "$app_dir" ]; then
echo " cd \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\" || exit 36587356"
else
echo " cd \"${app_dir}\" || exit 3463754637"
fi
if [ "$app_repo" ]; then
echo " git checkout \"\$${app_name_upper}_COMMIT\" -b \"\$${app_name_upper}_COMMIT\""
echo " set_completion_param \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\""
fi
if [ $app_webui ]; then
echo ''
echo " chmod g+w \"/var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs\""
@ -951,7 +971,7 @@ if [ $app_daemon ]; then
echo " echo 'Description=${app_name}';"
echo " echo 'After=syslog.target';"
echo " echo 'After=network.target';"
echo " echo 'Documentation=${app_name_upper}_REPO";
echo " echo \"Documentation=\$${app_name_upper}_REPO\";";
echo " echo '';"
echo " echo '[Service]';"
echo " echo 'Type=simple';"