Closed grasegger closed 1 year ago
yadm.distro_family
is populated via the ID_LIKE
value in /etc/os-release.
Do you think it would help to do something like this:
yadm config local.class $(awk -F= '$1=="VARIANT_ID" {print $2}' /etc/os-release)
yadm.class
in your template?Thanks for the reply @TheLocehiliosan
While I did not use the solution you proposed it nudged me in the right direction.
After some tinkering I landed on the following solution, which also allows me to rebase my silverblue to kinonite for example. I switched to esh for templating and I think it also makes it easier to document why there is an if:
# WARNING: Do not edit this file.
# It was generated by processing <%= $YADM_SOURCE %>
<% if type rpm-ostree > /dev/null; then -%>
# On rpm-ostree based systems rewrite the npm prefix to avoid trying
# to write to a read only mount.
prefix=<%= $HOME %>/.npm-global
<% fi %>
progress=false
Ah yes. That's a good solution and does make it more clear why that system is treated differently.
The "built-in" templating is very basic and really meant to allow some templating without much need for dependencies. But if you can use a more capable template processor it will open up the possibilities. 👍
This question is about
Describe your question
Today I stumbled across a situation where I was not able to solve it using alts (even with a template):
For working on Fedora Silverblue I need to tell npm to use a different global path since it tries to write to a read only file system by default. However setting this for all machines would break my work setup with nvm. I know about contexts but this would only work as long as I don't use silverblue in any capacity at work.
My
/etc/os-release
:My (tiny) template: