mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
27 lines
689 B
Text
27 lines
689 B
Text
# Print a message to stderr and exit
|
|
# usage: ynh_die MSG [RETCODE]
|
|
ynh_die() {
|
|
echo "$1" 1>&2
|
|
exit "${2:-1}"
|
|
}
|
|
|
|
# Display a message in the 'INFO' logging category
|
|
#
|
|
# usage: ynh_info "Some message"
|
|
ynh_info()
|
|
{
|
|
echo "$1" >>"$YNH_STDINFO"
|
|
}
|
|
|
|
# Ignore the yunohost-cli log to prevent errors with conditionals commands
|
|
# usage: ynh_no_log COMMAND
|
|
# Simply duplicate the log, execute the yunohost command and replace the log without the result of this command
|
|
# It's a very badly hack...
|
|
ynh_no_log() {
|
|
ynh_cli_log=/var/log/yunohost/yunohost-cli.log
|
|
sudo cp -a ${ynh_cli_log} ${ynh_cli_log}-move
|
|
eval $@
|
|
exit_code=$?
|
|
sudo mv ${ynh_cli_log}-move ${ynh_cli_log}
|
|
return $?
|
|
}
|