On Sun, 30 Aug 2020, Trek wrote: > this is a chicken-egg problem: init-d-script sources /etc/default/$NAME > but $NAME is defined inside /etc/init.d/snmpd (that is $SCRIPTNAME)
It could do: eval "$(grep '^NAME=' "$__init_d_script_name")" This would cover most cases, and it could be made part of the API of init-d-script that its users must have exactly one line matching this which is a valid, context-free shell expression setting only $NAME. Possible. > init-d-script could be modified, for example to source at > first /etc/default/$(basename $SCRIPTNAME), but to retain backward > compatibility it should source also /etc/default/$NAME and it would > begin a sourcing mess with possible conflicts Erk. Also, they shan’t be sourced twice. > i think the init-d-script sourcing feature is not really useful and the > right way to include variables it is to source the environment file > inside the /etc/init.d/snmpd script, like batmand does for example: > > https://sources.debian.org/src/batmand/0.3.2-21/debian/batmand.init Yes, that too. > another possible way it could be to define DAEMON_ARGS directly > inside /etc/default/snmpd, but I don't know how well it will play with > other init systems That would only work in very simple cases. bye, //mirabilos -- Sometimes they [people] care too much: pretty printers [and syntax highligh- ting, d.A.] mechanically produce pretty output that accentuates irrelevant detail in the program, which is as sensible as putting all the prepositions in English text in bold font. -- Rob Pike in "Notes on Programming in C"