From: yujian Date: Wed, 19 Jul 2006 10:40:01 +0000 (+0000) Subject: b=9853 X-Git-Tag: v1_7_0_51~2^13~5^2~4 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=4c2377b925a36b0480f14de92c116bee967b62aa;p=fs%2Flustre-release.git b=9853 Fix parse_line() to support stripping surrounded double-quotes. --- diff --git a/lustre/scripts/lc_common.sh b/lustre/scripts/lc_common.sh index 2418778..25498d4 100644 --- a/lustre/scripts/lc_common.sh +++ b/lustre/scripts/lc_common.sh @@ -19,6 +19,10 @@ LCTL=${LCTL:-"$CMD_PATH/lctl"} EXPORT_PATH=${EXPORT_PATH:-"PATH=\$PATH:/sbin:/usr/sbin;"} +# Raid command path +RAID_CMD_PATH=${RAID_CMD_PATH:-"/sbin"} +MDADM=${MDADM:-"$RAID_CMD_PATH/mdadm"} + # Some scripts to be called SCRIPTS_PATH=${CLUSTER_SCRIPTS_PATH:-"$(cd `dirname $0`; echo $PWD)"} MODULE_CONFIG=${SCRIPTS_PATH}/lc_modprobe.sh @@ -177,12 +181,14 @@ parse_line() { # Strip the leading and trailing space-characters CONFIG_ITEM[idx]=`expr "${CONFIG_ITEM[idx]}" : '[[:space:]]*\(.*\)[[:space:]]*$'` + [ -z "${CONFIG_ITEM[idx]}" ] && continue + # Remove the surrounded double-quotes - if [ -z "`echo \"${CONFIG_ITEM[idx]}\"|sed 's/^".*"$//'`" ]; then - CONFIG_ITEM[idx]=`echo "${CONFIG_ITEM[idx]}" | sed 's/^"//' | sed 's/"$//'` - fi + while [ -z "`echo "${CONFIG_ITEM[idx]}"|sed -e 's/^".*"$//'`" ]; do + CONFIG_ITEM[idx]=`echo "${CONFIG_ITEM[idx]}" | sed -e 's/^"//' -e 's/"$//'` + done - CONFIG_ITEM[idx]=`echo "${CONFIG_ITEM[idx]}" | sed 's/""/"/g'` + CONFIG_ITEM[idx]=`echo "${CONFIG_ITEM[idx]}" | sed -e 's/""/"/g'` done return 0 diff --git a/lustre/scripts/lustre_config.sh.in b/lustre/scripts/lustre_config.sh.in index e0d3869..746368d 100644 --- a/lustre/scripts/lustre_config.sh.in +++ b/lustre/scripts/lustre_config.sh.in @@ -539,12 +539,10 @@ construct_mkfs_cmdline() { fi if [ -n "${MKFS_OPTIONS[i]}" ]; then - MKFS_OPTIONS[i]=`echo "${MKFS_OPTIONS[i]}" | sed 's/^"//' | sed 's/"$//'` MKFS_CMD=${MKFS_CMD}$"--mkfsoptions="$"\""${MKFS_OPTIONS[i]}$"\""$" " fi if [ -n "${MOUNT_OPTIONS[i]}" ]; then - MOUNT_OPTIONS[i]=`echo "${MOUNT_OPTIONS[i]}" | sed 's/^"//' | sed 's/"$//'` if ! ${MODIFY_FSTAB}; then MKFS_CMD=${MKFS_CMD}$"--mountfsoptions="$"\""${MOUNT_OPTIONS[i]}$"\""$" " fi