Skip to content

Commit

Permalink
Adapt gen-config function
Browse files Browse the repository at this point in the history
  • Loading branch information
Antiz96 committed May 19, 2024
1 parent e248c74 commit 8a4c5a2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/script/arch-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,20 @@ case "${option}" in
list_news
;;
--gen-config)
example_config_file="${XDG_DATA_HOME:-${HOME}/.local/share:-${XDG_DATA_DIRS}:-/usr/local/share:-/usr/share}/doc/${name}/${name}.conf.example"
if [ -f "${XDG_DATA_HOME}/doc/${name}/${name}.conf" ]; then
example_config_file="${XDG_DATA_HOME}/doc/${name}/${name}.conf"
elif [ -f "${HOME}/.local/share/doc/${name}/${name}.conf" ]; then
example_config_file="${HOME}/.local/share/doc/${name}/${name}.conf"
elif [ -f "${XDG_DATA_DIRS}/doc/${name}/${name}.conf" ]; then
example_config_file="${XDG_DATA_DIRS}/doc/${name}/${name}.conf"
elif [ -f "/usr/local/share/doc/${name}/${name}.conf" ]; then
example_config_file="/usr/local/share/doc/${name}/${name}.conf"
elif [ -f "/usr/share/doc/${name}/${name}.conf" ]; then
example_config_file="/usr/share/doc/${name}/${name}.conf"
else
error_msg "$(eval_gettext "Example configuration file not found")"
exit 8
fi

if [ -f "${config_file}" ]; then
error_msg "$(eval_gettext "The '\${config_file}' configuration file already exists\nPlease, remove it before generating a new one")"
Expand Down

0 comments on commit 8a4c5a2

Please sign in to comment.