From d982c0e0a632f1dc99908a68dfa7da957d340502 Mon Sep 17 00:00:00 2001 From: LucĂ­a Andrea Illanes Albornoz Date: Mar 20 2023 09:06:27 +0000 Subject: Default theme from etc/*.theme.host.. --- diff --git a/.gitignore b/.gitignore index 9c1bf0f..f4fa9b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +etc/*.theme.host.* etc/*.theme.local .gdbhistory *.sw[op] diff --git a/build.sh b/build.sh index 53225ef..99c97a1 100755 --- a/build.sh +++ b/build.sh @@ -78,7 +78,9 @@ buildp_init() { || ! ex_init_getopts \ "${_bi_rstatus}" "buildp_init_getopts_fn" \ "${_bi_optstring}" "${@}" \ - || ! ex_init_theme "${_bi_rstatus}" "${_bi_name_base}" "${ARG_THEME:-}" \ + || ! ex_init_theme \ + "${_bi_rstatus}" "${BUILD_HNAME}" \ + "${_bi_name_base}" "${ARG_THEME:-}" \ || ! ex_init_logging "${_bi_rstatus}" \$ARG_VERBOSE_TAGS "${ARG_VERBOSE}" \ || ! ex_pkg_load_vars "${_bi_rstatus}" \$ARCH \$BUILD_KIND \ || ! ex_init_prereqs "${_bi_rstatus}" "${DEFAULT_PREREQS}" \ diff --git a/pkgtool.sh b/pkgtool.sh index 2faa074..29a14b7 100755 --- a/pkgtool.sh +++ b/pkgtool.sh @@ -33,8 +33,8 @@ pkgtoolp_init() { "${_pi_rstatus}" "pkgtoolp_init_getopts_fn" \ "${_pi_optstring}" "${@}" \ || ! ex_init_theme \ - "${_pi_rstatus}" "${_pi_name_base}" \ - "${ARG_THEME:-}" \ + "${_pi_rstatus}" "${BUILD_HNAME}" \ + "${_pi_name_base}" "${ARG_THEME:-}" \ || ! ex_init_prereqs "${_pi_rstatus}" "${_pi_prereqs}" \ || ! ex_pkg_load_vars \ "${_pi_rstatus}" \$ARCH \$BUILD_KIND \ diff --git a/subr.ex/ex_init.subr b/subr.ex/ex_init.subr index fcabce0..5d1035a 100644 --- a/subr.ex/ex_init.subr +++ b/subr.ex/ex_init.subr @@ -410,16 +410,25 @@ ex_init_prereqs() { # # ex_init_theme() - initialise theme # @_rstatus: reference to out variable of status string on failure +# @_hname: build hostname # @_name_base: base name for theme file(s) # @_theme: theme name # # Return: zero (0) on success, non-zero (>0) on failure # ex_init_theme() { - local _eit_rstatus="${1#\$}" _eit_name_base="${2}" _eit_theme="${3}" \ + local _eit_rstatus="${1#\$}" _eit_hname="${2}" _eit_name_base="${3}" _eit_theme="${4}" \ _eit_rc=0 _eit_theme_fname=""; - _eit_theme_fname="etc/${_eit_name_base}${_eit_theme:+.${_eit_theme}}.theme"; + if [ "${_eit_theme:+1}" = 1 ]; then + _eit_theme_fname="etc/${_eit_name_base}.${_eit_theme}.theme"; + else + _eit_theme_fname="etc/${_eit_name_base}.theme.host.${_eit_hname}"; + if ! [ -e "${_eit_theme_fname}" ]; then + _eit_theme_fname="etc/${_eit_name_base}.theme"; + fi; + fi; + if ! [ -e "${_eit_theme_fname}" ]; then _eit_rc=1; exp_setrstatus "${_eit_rstatus}" 'failed to source \`'"${_eit_theme_fname}"''\''.';