summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucía Andrea Illanes Albornoz <lucia@luciaillanes.de>2023-03-20 10:06:27 +0100
committerLucía Andrea Illanes Albornoz <lucia@luciaillanes.de>2023-03-20 10:06:27 +0100
commitd982c0e0a632f1dc99908a68dfa7da957d340502 (patch)
treea647fe38584d41d31b57389891d916ff7f54cb81
parent0a3e1b0b1fb35f4e4976801d8e85bdabb6ab3fa5 (diff)
downloadmidipix_build-d982c0e0a632f1dc99908a68dfa7da957d340502.tar.bz2
midipix_build-d982c0e0a632f1dc99908a68dfa7da957d340502.tar.xz
Default theme from etc/*.theme.host.<full hostname>.
-rw-r--r--.gitignore1
-rwxr-xr-xbuild.sh4
-rwxr-xr-xpkgtool.sh4
-rw-r--r--subr.ex/ex_init.subr13
4 files changed, 17 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 9c1bf0f4..f4fa9b3c 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 53225efb..99c97a1b 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 2faa0747..29a14b73 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 fcabce07..5d1035ad 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}"''\''.';