From 5089c199c2aa7aa04ed1429d56cacee6ac557a3b Mon Sep 17 00:00:00 2001 From: tavo-wasd Date: Mon, 6 May 2024 21:35:27 -0600 Subject: [PATCH] pinentry --- 01-utils.sh | 24 +++++++++++------------- 02-language.sh | 9 ++++++--- 03-install.sh | 2 +- 04-main.sh | 2 +- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/01-utils.sh b/01-utils.sh index bc0fe7d..f11131a 100644 --- a/01-utils.sh +++ b/01-utils.sh @@ -1,6 +1,6 @@ #!/bin/sh # - TODO: -# - kdialog (and terminal ?) get_pass +# - kdialog and terminal get_pass urlencode() { ENCODEDURL="$(curl -Gs -w %{url_effective} --data-urlencode @- ./ ||: )" @@ -64,13 +64,8 @@ set_version() { } get_pass() { - MENU="$1" TITLE="$2" - - if [ "$MENU" = "zenity" ] ; then - zenity --title "$TITLE" --password - else - echo - fi + TITLE="$1" ; PROMPT="$2" + printf 'setprompt %s\nsetdesc %s\nGETPIN\n' "$TITLE" "$PROMPT" } term_prompt() { @@ -100,9 +95,12 @@ mkdir -p "$DIR" } check_deps() { -for cmd in curl unzip ; do - if ! command -v "$cmd" > /dev/null ; then - printf '%s ' "$cmd" - fi -done +[ "$FILE" = "ClientesMAC_rev35.dmg" ] && + echo +[ "$FILE" = "ClientesLinux_DEB64_Rev25.zip" ] && + for cmd in curl unzip ; do if ! command -v "$cmd" > /dev/null ; then printf '%s ' "$cmd" ; fi ; done +[ "$FILE" = "ClientesLinux_CentOS7_Rev6" ] && + echo +[ "$FILE" = "ClientesLinux_RPM64_Rev24" ] && + echo } diff --git a/02-language.sh b/02-language.sh index c90820c..96f2203 100644 --- a/02-language.sh +++ b/02-language.sh @@ -18,7 +18,8 @@ set_lang() { PROMPT_DIR_FILE="A continuación, deberá seleccionar la carpeta donde quiere que se descargue y se extraigan los contenidos del fichero seleccionado" PROMPT_ERR_DIR_FILE="Error al seleccionar la carpeta de descarga para el fichero, abortando." PROMPT_DOWNLOAD="Descargando desde Centro de Soporte Firma Digital..." - PROMPT_DEPS_INSTALL="Instalando dependencias y otros complementos" + PROMPT_DEPS_INSTALL="Instalando dependencias y otros complementos..." + PROMPT_PASS_DEPS_INSTALL="Ingrese la contraseña del equipo para instalar los componentes" PROMPT_ERR_DEPS_INSTALL="Error instalando dependencias." PROMPT_ERR_DOWNLOAD="Error al descargar el fichero, abortando." PROMPT_END_SUCCESS="El instalador ha concluido." @@ -35,7 +36,8 @@ set_lang() { PROMPT_DIR_FILE="Next, you must select the folder where you want the contents of the selected file to be downloaded and extracted" PROMPT_ERR_DIR_FILE="Error selecting the download folder for the file, aborting." PROMPT_DOWNLOAD="Downloading from the Digital Signature Support Center..." - PROMPT_DEPS_INSTALL="Installing dependencies and other components" + PROMPT_DEPS_INSTALL="Installing dependencies and other components..." + PROMPT_PASS_DEPS_INSTALL="Enter your computer password to install components" PROMPT_ERR_DEPS_INSTALL="Error installing dependencies." PROMPT_ERR_DOWNLOAD="Error downloading file, aborting." PROMPT_END_SUCCESS="The installer has completed." @@ -52,7 +54,8 @@ set_lang() { PROMPT_DIR_FILE="Ensuite, vous devez sélectionner le dossier dans lequel vous souhaitez que le contenu du fichier sélectionné soit téléchargé et extrait" PROMPT_ERR_DIR_FILE="Erreur lors de la sélection du dossier de téléchargement du fichier, abandon." PROMPT_DOWNLOAD="Téléchargement du fichier depuis le Centre de support des signatures numériques..." - PROMPT_DEPS_INSTALL="Installation des dépendances et d'autres composants" + PROMPT_DEPS_INSTALL="Installation des dépendances et d'autres composants..." + PROMPT_PASS_DEPS_INSTALL="Entrez le mot de passe de votre ordinateur pour installer les composants" PROMPT_ERR_DEPS_INSTALL="Erreur lors de l'installation des dépendances." PROMPT_ERR_DOWNLOAD="Erreur de téléchargement du fichier, abandon." PROMPT_END_SUCCESS="Le programme d'installation est terminé." diff --git a/03-install.sh b/03-install.sh index 6785d27..b3cb773 100644 --- a/03-install.sh +++ b/03-install.sh @@ -6,7 +6,7 @@ SAVE_FILE="$1" SAVE_DIR="${SAVE_FILE%/*}" [ -z "$SAVE_DIR" ] && return 1 -SUDO_PASSWORD="$(get_pass "$MENU" "$TITLE")" +SUDO_PASSWORD="$(get_pass "$TITLE" "$PROMPT_PASS_DEPS_INSTALL")" [ -z "$SUDO_PASSWORD" ] && return 1 printf '\033[1mInstalando y habilitando dependencias...\033[0m\n' # DEBUG diff --git a/04-main.sh b/04-main.sh index 03ae5d0..743eb1e 100644 --- a/04-main.sh +++ b/04-main.sh @@ -99,7 +99,7 @@ else # Install dependencies, components and # certificates according to OS term_prompt "$TITLE" "$PROMPT_DEPS_INSTALL" info && echo - install_certs "$SAVE_FILE" + install_certs "$SAVE_FILE" || term_prompt "$TITLE" "$PROMPT_ERR_DEPS_INSTALL" error && echo term_prompt "$TITLE" "$PROMPT_END_SUCCESS" info && echo