[20/21] initscripts fkt: keep readhash compatible with older implementation
 
Commit Message
  
  
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>
---
 src/initscripts/system/functions               | 4 ++++
 tests/src/initscripts/system/functions/test.sh | 1 +
 2 files changed, 5 insertions(+)
  
 
  
@@ -932,6 +932,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_that_key_in_arry_has_value "CONFIG" "RED_DHCP_HOSTNAME" "ipfire"
 test_that_key_in_arry_has_value "CONFIG" "BLUE_MACADDR" "bc:30:7d:58:6b:e3"
+test_that_key_in_arry_has_value "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