Am Dienstag, den 22.10.2019, 11:25 +0200 schrieb Johannes Schauer: > Hi, > > Quoting Benjamin Drung (2019-10-18 18:24:53) > > I like to use mmdebstrap to produce a golden live image. This > > includes > > calling several custom hooks. My current command line call for the > > proof-of-concept is already more than 1000 characters long. That > > makes > > memorizing the full command infeasible and I have to place the > > command > > call into a shell script. > > > > It would be nice if the parameters for mmdebstrap could be placed > > into a > > YAML configuration file so that running > > `mmdebstrap --config=example.yaml` is enough to produce the output. > > > > Inspiration can be taken from > > https://salsa.debian.org/raspi-team/image-specs/blob/master/raspi3.yaml > > > > What do you think about that idea? Do you like it or do you have an > > alternative suggestion? > > I'm not against this idea. > > Right now indeed the best option is to use a shell script instead of > a > configuration file. In both cases you end up having a file lying > around > somewhere and I didn't yet see sufficient advantage of making that > file a > configuration file instead of a shell script. Maybe you can convince > me about > the advantages of a configuration file over a shell script?
The advantage of a configuration file is that it is simpler to review than a shell script since it only contains configuration. Shell scripts tend to extend to do more stuff. Second benefit is that you can overwrite configuration items from the file by specifying the parameter on the command line. Having that flexibility in the shell script as well is possible, but makes it longer. Third benefit is that the configuration file is simpler to generate from a data structure in a program than to construct the command line arguments, since YAML has lists. Example: mmdebstrap: verbose: True aptopt: Dir::Etc::Trusted "/usr/share/keyrings/debian-archive-keyring.gpg" components: - main - contrib suite: buster target: example.tar.xz instead of: $ mmdebstrap -v \ "--aptopt=Dir::Etc::Trusted \"/usr/share/keyrings/debian-archive-keyring.gpg\"" \ --component=main,contrib buster example.tar.xz > Disadvantages are, that one has to learn yet another invented > configuration > file structure and/or format and that this will again increase the > amount of > necessary documentation, introduce new bugs and make an already > complex piece > of software even more complex and hard to understand. This is true, but if the configuration file just does a one-to-one mapping, just the input parsing part is longer. -- Benjamin Drung Debian & Ubuntu Developer Platform Engineering Compute (Enterprise Cloud) 1&1 IONOS SE | Greifswalder Str. 207 | 10405 Berlin | Germany E-mail: benjamin.dr...@cloud.ionos.com | Web: www.ionos.de Hauptsitz Montabaur, Amtsgericht Montabaur, HRB 24498 Vorstand: Dr. Christian Böing, Hüseyin Dogan, Hans-Henning Kettler, Matthias Steinberg, Achim Weiß Aufsichtsratsvorsitzender: Markus Kadelke Member of United Internet