Browse Source

add default answer and add compliance with shellcheck

master
Simon Vieille 2 months ago
parent
commit
4398347162
Signed by: Simon Vieille <simon@deblan.fr> GPG Key ID: 03383D15A1D31745
3 changed files with 6 additions and 4 deletions
  1. 1
    1
      bin/vhost-add
  2. 4
    2
      share/bin/form_yes_no
  3. 1
    1
      share/bin/template

+ 1
- 1
bin/vhost-add View File

@@ -99,7 +99,7 @@ chmod 600 "$TMP_FILE"
whiptail --textbox "$TMP_FILE" 25 80
rm "$TMP_FILE"

CONTINUE="$(form_yes_no -t "$TITLE" -l "Do you confirm?")"
CONTINUE="$(form_yes_no -t "$TITLE" -l "Do you confirm?" -n)"

if [ "$CONTINUE" = "no" ]; then
printf "Aborded!\\n"

+ 4
- 2
share/bin/form_yes_no View File

@@ -5,13 +5,15 @@ LABEL=
ERROR=0
HEIGHT=8
WIDTH=50
PARAMS=

while getopts "t:l:d:h:w:r" option; do
while getopts "t:l:d:h:w:rn" option; do
case "$option" in
l) LABEL="$OPTARG";;
t) TITLE="$OPTARG";;
h) HEIGHT="$OPTARG";;
w) WIDTH="$OPTARG";;
n) PARAMS="$PARAMS --defaultno";;
:) ERROR=1;;
?) ERROR=1;;
esac
@@ -21,7 +23,7 @@ if [ $ERROR -eq 1 ]; then
exit 1
fi

if (whiptail --title "$TITLE" --yesno "$LABEL" $HEIGHT $WIDTH 3>&1 1>&2 2>&3) then
if (whiptail --title "$TITLE" --yesno "$LABEL" $PARAMS $HEIGHT $WIDTH 3>&1 1>&2 2>&3) then
printf "yes"
else
printf "no"

+ 1
- 1
share/bin/template View File

@@ -2,4 +2,4 @@

. ./etc/config

$PHP_BIN -dvariables_order=EGPCS ./share/bin/twigc -E -d ./src/templates/ < "src/templates/${1}.twig"
"$PHP_BIN" -dvariables_order=EGPCS ./share/bin/twigc -E -d ./src/templates/ < "src/templates/${1}.twig"

Loading…
Cancel
Save