question about disk_var.sh
Thomas Neumann
blacky+fai at fluffbunny.de
Wed Aug 6 13:11:42 CEST 2014
On Friday 01 August 2014 09:42:24 andrew bezella wrote:
>> b) can someone explain what kind of bash trickery is going on here?
>
> it's returning default values for the variables if they're unset/empty.
> the ${PARAMETER:-WORD} syntax says "if PARAMETER is unset or empty,
> return WORD."
Thanks for the hint. The keywords to search for are 'bash parameter expansion'
which leads to <http://wiki.bash-hackers.org/syntax/pe>.
> note that there is a difference between ":-" and ":=", and that the
> latter might be better in this case. the shorter ${PARAMETER:=WORD}
> would assign the value of WORD to PARAMETER in the unset/empty case. in
> my head ":-" is for returning defaults, ":=" is for assigning them. but
> please correct me if i'm off-base, as i've only recently grokked the
> difference.
@Thomas L.: Can you remember why
https://github.com/faiproject/fai/commit/2887bb7d30d5b4517390fe21d3551c618053ff38
"setup-storage: Generate conditional definitions for disk_var.sh such that
variables will only be set if not previously defined by users."
was implemented? If I parse the history correctly this change has been
introduced with FAI 4.0 / setup_storage 1.4
@All: Who uses that feature and what is the usecase? (Why is it necessary to
override the generated variables?)
I'm not very fond of the current situation (unusual feature + no explanation).
Suggestion a) Keep feature, but add explanation.
Suggestion b) Remove feature / revert patch.
bye
thomas
P.S.: @Andrew: Do you know where 'grok' is coming from?
More information about the linux-fai
mailing list