diff options
author | Jonathan Liu <net147@gmail.com> | 2013-05-23 09:37:07 +1000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-24 14:07:03 +0100 |
commit | af56670f656ec0989aa7fd6cf6037cbc9cd88185 (patch) | |
tree | e4072b68296bf4f38a07e167d2093bcbedcf97c8 /meta/recipes-core/initscripts | |
parent | c11ba731fb245683148d0a8485b8c4d73bf94c28 (diff) | |
download | openembedded-core-contrib-af56670f656ec0989aa7fd6cf6037cbc9cd88185.tar.gz |
populate-volatile.sh: remove repeated leading slashes in TNAME
This avoids triple slashes in the generated /etc/volatile.cache to
reduce disk usage and in the output when verbose mode is enabled.
As all the paths for volatiles start with a slash, we can change
TNAME=${ROOT_DIR}/${TNAME} to TNAME=${ROOT_DIR}${TNAME}. To avoid
a double slash when ROOT_DIR is /, we strip the extra slash from
ROOT_DIR.
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/recipes-core/initscripts')
-rwxr-xr-x | meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh index ab092317b05..91c70efbbd3 100755 --- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh +++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh @@ -10,11 +10,11 @@ # Get ROOT_DIR DIRNAME=`dirname $0` -ROOT_DIR=`echo $DIRNAME | sed -ne 's:etc/.*::p'` +ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'` [ -e ${ROOT_DIR}/etc/default/rcS ] && . ${ROOT_DIR}/etc/default/rcS # When running populate-volatile.sh at rootfs time, disable cache. -[ "$ROOT_DIR" != "/" ] && VOLATILE_ENABLE_CACHE=no +[ -n "$ROOT_DIR" ] && VOLATILE_ENABLE_CACHE=no # If rootfs is read-only, disable cache. [ "$ROOTFS_READ_ONLY" = "yes" ] && VOLATILE_ENABLE_CACHE=no @@ -35,7 +35,7 @@ create_file() { [ -e "$1" ] && { [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." } || { - if [ "$ROOT_DIR" = "/" ]; then + if [ -z "$ROOT_DIR" ]; then eval $EXEC & else # Creating some files at rootfs time may fail and should fail, @@ -57,7 +57,7 @@ mk_dir() { [ -e "$1" ] && { [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." } || { - if [ "$ROOT_DIR" = "/" ]; then + if [ -z "$ROOT_DIR" ]; then eval $EXEC else # For the same reason with create_file(), failures should @@ -82,7 +82,7 @@ link_file() { test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build - if [ "$ROOT_DIR" = "/" ]; then + if [ -z "$ROOT_DIR" ]; then eval $EXEC & else # For the same reason with create_file(), failures should @@ -150,7 +150,7 @@ apply_cfgfile() { cat ${CFGFILE} | grep -v "^#" | \ while read LINE; do eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"` - TNAME=${ROOT_DIR}/${TNAME} + TNAME=${ROOT_DIR}${TNAME} [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-." [ "${TTYPE}" = "l" ] && { @@ -213,7 +213,7 @@ else [ -e ${ROOT_DIR}/etc/volatile.cache.build ] && sync && mv ${ROOT_DIR}/etc/volatile.cache.build ${ROOT_DIR}/etc/volatile.cache fi -if [ "${ROOT_DIR}" = "/" ] && [ -f /etc/ld.so.cache ] && [ ! -f /var/run/ld.so.cache ] +if [ -z "${ROOT_DIR}" ] && [ -f /etc/ld.so.cache ] && [ ! -f /var/run/ld.so.cache ] then ln -s /etc/ld.so.cache /var/run/ld.so.cache fi |