mirror of
https://git.yoctoproject.org/poky
synced 2026-03-19 13:49:41 +01:00
initscripts: Fix populate-volatile.sh bug when file/dir exists
The blocks which test for entry exitence (file or directory) use a `A && B || C` syntax. This form is not behaving as a if-then-else block even the code logic assumes that. C may run when A is true which breaks the case where VERBOSE is 'no' but the file/directory exists. Along with fixing these specific issues, this patch fixes the other instances where blocks of form `A && B || C` are used as if-then-else. (From OE-Core rev: 471094f8afa57548e9ff3fd7a99306f58b87d478) Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 1b9ea22acb66554925720e04cf24100664234574) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
9b3ac3e898
commit
a8b8418bae
@@ -26,15 +26,15 @@ COREDEF="00_core"
|
||||
|
||||
create_file() {
|
||||
EXEC=""
|
||||
[ -z "$2" ] && {
|
||||
if [ -z "$2" ]; then
|
||||
EXEC="
|
||||
touch \"$1\";
|
||||
"
|
||||
} || {
|
||||
else
|
||||
EXEC="
|
||||
cp \"$2\" \"$1\";
|
||||
"
|
||||
}
|
||||
fi
|
||||
EXEC="
|
||||
${EXEC}
|
||||
chown ${TUSER}:${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
|
||||
@@ -42,9 +42,9 @@ create_file() {
|
||||
|
||||
test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
|
||||
|
||||
[ -e "$1" ] && {
|
||||
if [ -e "$1" ]; then
|
||||
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
|
||||
} || {
|
||||
else
|
||||
if [ -z "$ROOT_DIR" ]; then
|
||||
eval "$EXEC"
|
||||
else
|
||||
@@ -54,7 +54,7 @@ create_file() {
|
||||
# run on target to set up the correct files and directories.
|
||||
eval "$EXEC" > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
mk_dir() {
|
||||
@@ -64,9 +64,9 @@ mk_dir() {
|
||||
chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
|
||||
|
||||
test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
|
||||
[ -e "$1" ] && {
|
||||
if [ -e "$1" ]; then
|
||||
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
|
||||
} || {
|
||||
else
|
||||
if [ -z "$ROOT_DIR" ]; then
|
||||
eval "$EXEC"
|
||||
else
|
||||
@@ -74,7 +74,7 @@ mk_dir() {
|
||||
# not be logged.
|
||||
eval "$EXEC" > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
link_file() {
|
||||
@@ -188,13 +188,13 @@ apply_cfgfile() {
|
||||
[ -L "${TNAME}" ] && {
|
||||
[ "${VERBOSE}" != "no" ] && echo "Found link."
|
||||
NEWNAME=$(ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/')
|
||||
echo "${NEWNAME}" | grep -v "^/" >/dev/null && {
|
||||
if echo "${NEWNAME}" | grep -v "^/" >/dev/null; then
|
||||
TNAME="$(echo "${TNAME}" | sed -e 's@\(.*\)/.*@\1@')/${NEWNAME}"
|
||||
[ "${VERBOSE}" != "no" ] && echo "Converted relative linktarget to absolute path -${TNAME}-."
|
||||
} || {
|
||||
else
|
||||
TNAME="${NEWNAME}"
|
||||
[ "${VERBOSE}" != "no" ] && echo "Using absolute link target -${TNAME}-."
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
case "${TTYPE}" in
|
||||
|
||||
Reference in New Issue
Block a user