add confirmation box and final result screen
This commit is contained in:
parent
47e5b8c7e6
commit
8a2117a423
|
@ -65,6 +65,35 @@ SYSTEM_USER_PASSWORD=$(export PASSWORD="$USER_PASSWORD"; export SALT=$(date +'%S
|
||||||
|
|
||||||
exit_if_empty "$SYSTEM_USER_USERNAME" "Aborded! (SYSTEM_USERNAME_EMPTY)"
|
exit_if_empty "$SYSTEM_USER_USERNAME" "Aborded! (SYSTEM_USERNAME_EMPTY)"
|
||||||
|
|
||||||
|
################
|
||||||
|
# Confirmation #
|
||||||
|
################
|
||||||
|
|
||||||
|
export DOMAIN
|
||||||
|
export DOMAIN_ALIASES
|
||||||
|
export DOCUMENT_ROOT
|
||||||
|
export SYSTEM_USER_USERNAME
|
||||||
|
export SYSTEM_USER_GROUP
|
||||||
|
export PHP_ENABLED
|
||||||
|
export PHP_VERSION
|
||||||
|
export WEB_HTTP
|
||||||
|
export WEB_HTTPS
|
||||||
|
export WEB_HTTPS_FORCE
|
||||||
|
|
||||||
|
TMP_FILE="/tmp/vhost-add-$(tr -dc "qwertQWERTasdfgASDFGzxcvbZXCVB" < /dev/urandom | head -c 16)"
|
||||||
|
template summary > "$TMP_FILE"
|
||||||
|
chmod 600 "$TMP_FILE"
|
||||||
|
whiptail --textbox "$TMP_FILE" 20 80
|
||||||
|
rm "$TMP_FILE"
|
||||||
|
|
||||||
|
CONTINUE="$(form_yes_no -t "$TITLE" -l "Do you confirm?")"
|
||||||
|
|
||||||
|
if [ "$CONTINUE" = "no" ]; then
|
||||||
|
printf "Aborded!\n"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# User and directory creation #
|
# User and directory creation #
|
||||||
###############################
|
###############################
|
||||||
|
@ -82,15 +111,6 @@ SERVICES_TO_RELOAD="apache2"
|
||||||
SYSTEM_USER_ID="$(id -u "$SYSTEM_USER_USERNAME")"
|
SYSTEM_USER_ID="$(id -u "$SYSTEM_USER_USERNAME")"
|
||||||
PHP_FPM_PORT=$(($SYSTEM_USER_ID + 12000))
|
PHP_FPM_PORT=$(($SYSTEM_USER_ID + 12000))
|
||||||
|
|
||||||
export DOMAIN
|
|
||||||
export DOMAIN_ALIASES
|
|
||||||
export DOCUMENT_ROOT
|
|
||||||
export SYSTEM_USER_USERNAME
|
|
||||||
export SYSTEM_USER_GROUP
|
|
||||||
export PHP_ENABLED
|
|
||||||
export PHP_FPM_PORT
|
|
||||||
export WEB_HTTPS_FORCE
|
|
||||||
|
|
||||||
if [ "$WEB_HTTP" = "yes" ]; then
|
if [ "$WEB_HTTP" = "yes" ]; then
|
||||||
VHOST_FILE_SA="/etc/apache2/sites-available/${DOMAIN}.${WEB_HTTP_PORT}.conf"
|
VHOST_FILE_SA="/etc/apache2/sites-available/${DOMAIN}.${WEB_HTTP_PORT}.conf"
|
||||||
VHOST_FILE_SE="/etc/apache2/sites-enabled/${DOMAIN}.${WEB_HTTP_PORT}.conf"
|
VHOST_FILE_SE="/etc/apache2/sites-enabled/${DOMAIN}.${WEB_HTTP_PORT}.conf"
|
||||||
|
@ -117,6 +137,8 @@ if [ "$PHP_ENABLED" = "yes" ]; then
|
||||||
PHP_FPM_FILE="/etc/php/$PHP_VERSION/fpm/pool.d/${SYSTEM_USER_USERNAME}.conf"
|
PHP_FPM_FILE="/etc/php/$PHP_VERSION/fpm/pool.d/${SYSTEM_USER_USERNAME}.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export PHP_FPM_PORT
|
||||||
|
|
||||||
template php-fpm > "$PHP_FPM_FILE"
|
template php-fpm > "$PHP_FPM_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -124,7 +146,10 @@ for SERVICE in $SERVICES_TO_RELOAD; do
|
||||||
service $SERVICE reload
|
service $SERVICE reload
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "┌──────────────────────────────────────────┐\n"
|
export USER_PASSWORD
|
||||||
printf "│ Nom d'utilisateur : %-20s │\n" "$SYSTEM_USER_USERNAME"
|
|
||||||
printf "│ Mot de passe : %-25s │\n" "$USER_PASSWORD"
|
TMP_FILE="/tmp/vhost-add-$(tr -dc "qwertQWERTasdfgASDFGzxcvbZXCVB" < /dev/urandom | head -c 16)"
|
||||||
printf "└──────────────────────────────────────────┘\n"
|
template result > "$TMP_FILE"
|
||||||
|
chmod 600 "$TMP_FILE"
|
||||||
|
whiptail --textbox "$TMP_FILE" 8 0
|
||||||
|
rm "$TMP_FILE"
|
||||||
|
|
2
src/templates/result.twig
Normal file
2
src/templates/result.twig
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Username: {{ SYSTEM_USER_USERNAME }}
|
||||||
|
Password: {{ USER_PASSWORD }}
|
13
src/templates/summary.twig
Normal file
13
src/templates/summary.twig
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
DOMAIN: {{ DOMAIN }}
|
||||||
|
DOMAIN_ALIASES: {{ DOMAIN }}
|
||||||
|
DOCUMENT_ROOT: {{ DOCUMENT_ROOT }}
|
||||||
|
|
||||||
|
SYSTEM_USER_USERNAME: {{ SYSTEM_USER_USERNAME }}
|
||||||
|
SYSTEM_USER_GROUP: {{ SYSTEM_USER_GROUP }}
|
||||||
|
|
||||||
|
WEB_HTTP: {{ WEB_HTTP }}
|
||||||
|
WEB_HTTPS: {{ WEB_HTTPS }}
|
||||||
|
WEB_HTTPS_FORCE: {{ WEB_HTTPS_FORCE }}
|
||||||
|
|
||||||
|
PHP_ENABLED: {{ PHP_ENABLED }}
|
||||||
|
PHP_VERSION: {{ PHP_VERSION }}
|
Loading…
Reference in a new issue