diff --git a/scripts/_common.sh b/scripts/_common.sh index 883fe5e..522fde5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -343,6 +343,23 @@ ynh_exec_fully_quiet () { eval $@ > /dev/null 2>&1 } +# Remove any logs for all the following commands. +# +# usage: ynh_print_OFF +# WARNING: You should be careful with this helper, and never forgot to use ynh_print_ON as soon as possible to restore the logging. +ynh_print_OFF () { + set +x +} + +# Restore the logging after ynh_print_OFF +# +# usage: ynh_print_ON +ynh_print_ON () { + set -x + # Print an echo only for the log, to be able to know that ynh_print_ON has been called. + echo ynh_print_ON > /dev/null +} + #================================================= # Install or update the main directory yunohost.multimedia diff --git a/scripts/install b/scripts/install index 435d2f5..0234492 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= encrypt=$YNH_APP_ARG_ENCRYPT -encryption_pwd=$YNH_APP_ARG_ENCRYPTION_PWD +ynh_print_OFF; encryption_pwd=$YNH_APP_ARG_ENCRYPTION_PWD; ynh_print_ON core_backup=$YNH_APP_ARG_CORE_BACKUP apps_backup=$YNH_APP_ARG_APPS_BACKUP frequency=$YNH_APP_ARG_FREQUENCY @@ -36,7 +36,9 @@ final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" if [ $encrypt -eq 1 ]; then + ynh_print_OFF test -n "$encryption_pwd" || ynh_die "encryption_pwd can't be empty if you choose to enable encryption." + ynh_print_ON fi #================================================= @@ -90,7 +92,7 @@ then encrypt=true passkey="$final_path/passkey" - echo "$encryption_pwd" > "$passkey" + ynh_print_OFF; echo "$encryption_pwd" > "$passkey"; ynh_print_ON chmod 400 "$passkey" else encrypt=false @@ -174,6 +176,7 @@ $Informations" >&2 # SEND A README FOR THE ADMIN #================================================= +ynh_print_OFF if [ "$encrypt" = "true" ] then encrypt_message="Your password for encryption is '$encryption_pwd' @@ -192,3 +195,4 @@ Please read the documentation (https://github.com/maniackcrudelis/archivist/blob If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/archivist_ynh" ynh_send_readme_to_admin "$message" "root" +ynh_print_ON