mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
initscripts fkt: keep readhash compatible with older implementation
With the use of eval BLUE_DEV='blue0 net0' stored "blue0 net0" in the variable BLUE_DEV not "'blue0 net0'" Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
committed by
Michael Tremer
parent
f1d94e7457
commit
14ecdd86f1
@@ -931,6 +931,10 @@ readhash() {
|
||||
continue
|
||||
fi
|
||||
|
||||
# strip leading and trailing single quotes
|
||||
val="${val#\'}"
|
||||
val="${val%\'}"
|
||||
|
||||
printf -v "${array}[${key}]" "%s" "${val}"
|
||||
done < "${file}"
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ readhash "CONFIG" "${SCRIPT_PATH}/data/1"
|
||||
# test if we read the correct data
|
||||
test_value_in_array "CONFIG" "RED_DHCP_HOSTNAME" "ipfire"
|
||||
test_value_in_array "CONFIG" "BLUE_MACADDR" "bc:30:7d:58:6b:e3"
|
||||
test_value_in_array "CONFIG" "BLUE_DEV" "blue0 net0"
|
||||
|
||||
# Test that comments are skipped
|
||||
# apparently the way we read the file strips the whitespace, so the key does not contain any whitespace either
|
||||
|
||||
Reference in New Issue
Block a user