mirror of
https://github.com/YunoHost-Apps/archivist_ynh.git
synced 2024-09-03 18:15:55 +02:00
Remove password from log
This commit is contained in:
parent
6ccd8ba243
commit
8f6c9a52d0
2 changed files with 23 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue