Skip to content

Commit 8ce2e30

Browse files
hying-caritasHuang Ying
andauthored
bin/run-local-monitor.sh: Avoid to include quote in rootfs variable (#524)
From https://www.freedesktop.org/software/systemd/man/latest/os-release.html the format of /etc/os-release file is shell variable like to support sourced in a shell script. So, that is the best method to parse the file. While the original method may include quote in the result variable, for example, for $ cat /etc/os-release ... ID="mydist" ... we will get rootfs="mydist" with the original method, while we will get rootfs=mydist with shell source method. So, use the shell source method to avoid the issue. Signed-off-by: Huang Ying <[email protected]> Co-authored-by: Huang Ying <[email protected]>
1 parent a23b6fe commit 8ce2e30

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/run-local-monitor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ set_local_variables()
2929
export arch=$(get_system_arch)
3030
export compiler=$(grep -o "gcc version [0-9]*" /proc/version | awk '{print "gcc-"$NF}')
3131
export compiler=${compiler:-gcc}
32-
export rootfs=$(grep -m1 ^ID= /etc/os-release | awk -F= '{print $2}')
32+
export rootfs=$(source /etc/os-release; echo $ID)
3333
export rootfs=${rootfs:-default_rootfs}
3434

3535
export testbox=$HOSTNAME

0 commit comments

Comments
 (0)