zephyr-env.sh: Use $XDG_CONFIG_HOME/zephry/zephyrrc if present
According to the [XDG Base Directory Specification] there is a single base
directory in which user configuration files should be stored. This helps
users to keep their home directory uncluttered. This base directory can be
set in the environment variable $XDG_CONFIG_HOME and defaults to
${HOME}/.config if $XDG_CONFIG_HOME is not set.
This commit adjusts the zephyr-env.sh script to look for a user
configuration file in the following locations:
- $XDG_CONFIG_HOME/zephyr/zephyrrc
- $HOME/.config/zephyr/zephyrrc
- $HOME/.zephyrrc
The first one that is found will be used.
[XDG Base Directory Specification]: (https://specifications.freedesktop.org/basedir-spec/latest/)
Signed-off-by: Andreas Schuster <andreas.schuster@schuam.de>
This commit is contained in:
parent
4c14c618f6
commit
0f0497f9c5
@ -64,6 +64,14 @@ zephyr_answer_file=~/zephyr-env_install.bash
|
|||||||
. ${zephyr_answer_file}
|
. ${zephyr_answer_file}
|
||||||
}
|
}
|
||||||
unset zephyr_answer_file
|
unset zephyr_answer_file
|
||||||
|
xdg_config_home="${XDG_CONFIG_HOME:-${HOME}/.config}"
|
||||||
|
zephyr_xdg_rc="${xdg_config_home}/zephyr/zephyrrc"
|
||||||
|
if [ -f "${zephyr_xdg_rc}" ]; then
|
||||||
|
. "${zephyr_xdg_rc}"
|
||||||
|
else
|
||||||
zephyr_answer_file=~/.zephyrrc
|
zephyr_answer_file=~/.zephyrrc
|
||||||
[ -f ${zephyr_answer_file} ] && . ${zephyr_answer_file}
|
[ -f "${zephyr_answer_file}" ] && . "${zephyr_answer_file}"
|
||||||
unset zephyr_answer_file
|
unset zephyr_answer_file
|
||||||
|
fi
|
||||||
|
unset zephyr_xdg_rc
|
||||||
|
unset xdg_config_home
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user