]> git.ipfire.org Git - ipfire-2.x.git/commit
initscript functions: add readhash
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sun, 16 Jun 2024 16:02:37 +0000 (18:02 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 24 Aug 2024 12:19:56 +0000 (12:19 +0000)
commit96bb3ba8b81eb7344213f9be58c031e15f7b7899
tree15814ac970d2145fb3a94caa58f558012c5ca36d
parentacde9c1a1307ad140f7cd80b031e191678bb4ed8
initscript functions: add readhash

To avoid the usage of eval and to store the config in an key value
array, we introduce an new function. The tests only check if we
read the correct value to the correct variable.

One comment on the implementation as this has created some headache:

>From https://www.gnu.org/software/bash/manual/bash.html#Bourne-Shell-Builtins

"When used in a function, declare makes each name local, as with the local command, unless the -g option is used."

So we need to use -g here

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/initscripts/system/functions
tests/src/initscripts/system/functions/data/1 [new file with mode: 0644]
tests/src/initscripts/system/functions/test.sh [new file with mode: 0755]