mirror of
https://git.yoctoproject.org/poky
synced 2026-04-21 12:32:15 +02:00
initscripts: Sync populate-voltiles.sh performance improvements from OE.dev
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4508 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
@@ -8,6 +8,47 @@ COREDEF="00_core"
|
||||
|
||||
[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems."
|
||||
|
||||
create_file() {
|
||||
EXEC="
|
||||
touch \"$1\";
|
||||
chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
|
||||
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
|
||||
|
||||
[ -e "$1" ] && {
|
||||
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
|
||||
} || {
|
||||
eval $EXEC &
|
||||
}
|
||||
}
|
||||
|
||||
mk_dir() {
|
||||
EXEC="
|
||||
mkdir -p \"$1\";
|
||||
chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
|
||||
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
|
||||
|
||||
[ -e "$1" ] && {
|
||||
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
|
||||
} || {
|
||||
eval $EXEC &
|
||||
}
|
||||
}
|
||||
|
||||
link_file() {
|
||||
EXEC="test -e \"$2\" -o -L $2 || ln -s \"$1\" \"$2\" >/dev/tty0 2>&1"
|
||||
|
||||
test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache
|
||||
|
||||
[ -e "$2" ] && {
|
||||
echo "Cannot create link over existing -${TNAME}-." >&2
|
||||
} || {
|
||||
eval $EXEC &
|
||||
}
|
||||
}
|
||||
|
||||
check_requirements() {
|
||||
|
||||
@@ -72,21 +113,17 @@ apply_cfgfile() {
|
||||
|
||||
cat ${CFGFILE} | grep -v "^#" | \
|
||||
while read LINE; do
|
||||
TTYPE=`echo ${LINE} | cut -d " " -f 1`
|
||||
TUSER=`echo ${LINE} | cut -d " " -f 2`
|
||||
TGROUP=`echo ${LINE} | cut -d " " -f 3`
|
||||
TMODE=`echo ${LINE} | cut -d " " -f 4`
|
||||
TNAME=`echo ${LINE} | cut -d " " -f 5`
|
||||
|
||||
eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"`
|
||||
|
||||
[ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-."
|
||||
|
||||
|
||||
[ "${TTYPE}" = "l" ] && {
|
||||
[ -e "${TNAME}" ] && {
|
||||
echo "Cannot create link over existing -${TNAME}-." >&2
|
||||
} || {
|
||||
TSOURCE=`echo ${LINE} | cut -d " " -f 6`
|
||||
TSOURCE="$TLTARGET"
|
||||
[ -L "${TNAME}" ] || {
|
||||
[ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-."
|
||||
ln -s "${TSOURCE}" "${TNAME}"
|
||||
link_file "${TSOURCE}" "${TNAME}" &
|
||||
}
|
||||
continue
|
||||
}
|
||||
@@ -103,17 +140,12 @@ apply_cfgfile() {
|
||||
}
|
||||
}
|
||||
|
||||
[ -e "${TNAME}" ] && {
|
||||
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
case "${TTYPE}" in
|
||||
"f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
|
||||
touch "${TNAME}"
|
||||
create_file "${TNAME}" &
|
||||
;;
|
||||
"d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
|
||||
mkdir -p "${TNAME}"
|
||||
mk_dir "${TNAME}" &
|
||||
# Add check to see if there's an entry in fstab to mount.
|
||||
;;
|
||||
*) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-."
|
||||
@@ -121,9 +153,6 @@ apply_cfgfile() {
|
||||
;;
|
||||
esac
|
||||
|
||||
chown ${TUSER} ${TNAME} || echo "Failed to set owner -${TUSER}- for -${TNAME}-." >&2
|
||||
chgrp ${TGROUP} ${TNAME} || echo "Failed to set group -${TGROUP}- for -${TNAME}-." >&2
|
||||
chmod ${TMODE} ${TNAME} || echo "Failed to set mode -${TMODE}- for -${TNAME}-." >&2
|
||||
|
||||
done
|
||||
|
||||
@@ -131,8 +160,12 @@ apply_cfgfile() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
for file in `ls -1 "${CFGDIR}" | sort`; do
|
||||
apply_cfgfile "${CFGDIR}/${file}"
|
||||
done
|
||||
|
||||
if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate"
|
||||
then
|
||||
sh /etc/volatile.cache
|
||||
else
|
||||
rm -f /etc/volatile.cache
|
||||
for file in `ls -1 "${CFGDIR}" | sort`; do
|
||||
apply_cfgfile "${CFGDIR}/${file}"
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
#
|
||||
# Every line must either be a comment starting with #
|
||||
# or a definition of format:
|
||||
# <type> <owner> <group> <mode> <path> [<linksource>]
|
||||
# <type> <owner> <group> <mode> <path> <linksource>
|
||||
# where the items are separated by whitespace !
|
||||
#
|
||||
# <type> : d|f|l : (d)irectory|(f)ile|(l)ink
|
||||
#
|
||||
# A linking example:
|
||||
# l root root 0777 /var/test /tmp/testfile
|
||||
# f root root 0644 /var/test
|
||||
# f root root 0644 /var/test none
|
||||
#
|
||||
# Understanding links:
|
||||
# When populate-volatile is to verify/create a directory or file, it will first
|
||||
@@ -21,19 +21,19 @@
|
||||
# This explains the order of "link before object" as in the example above, where
|
||||
# a link will be created at /var/test pointing to /tmp/testfile and due to this
|
||||
# link the file defined as /var/test will actually be created as /tmp/testfile.
|
||||
d root root 0775 /var
|
||||
d root root 0755 /var/backups
|
||||
d root root 0755 /var/cache
|
||||
d root root 0755 /var/lib
|
||||
d root root 0755 /var/lib/ipkg
|
||||
d root root 0755 /var/lib/misc
|
||||
d root root 2775 /var/local
|
||||
d root root 1777 /var/lock
|
||||
d root root 0755 /var/lock/subsys
|
||||
d root root 0755 /var/log
|
||||
d root root 0755 /var/run
|
||||
d root root 0755 /var/spool
|
||||
d root root 1777 /var/tmp
|
||||
f root root 0664 /var/run/utmp
|
||||
f root root 0664 /var/log/wtmp
|
||||
f root root 0664 /var/log/lastlog
|
||||
d root root 0775 /var none
|
||||
d root root 0755 /var/backups none
|
||||
d root root 0755 /var/cache none
|
||||
d root root 0755 /var/lib none
|
||||
d root root 0755 /var/lib/ipkg none
|
||||
d root root 0755 /var/lib/misc none
|
||||
d root root 2775 /var/local none
|
||||
d root root 1777 /var/lock none
|
||||
d root root 0755 /var/lock/subsys none
|
||||
d root root 0755 /var/log none
|
||||
d root root 0755 /var/run none
|
||||
d root root 0755 /var/spool none
|
||||
d root root 1777 /var/tmp none
|
||||
f root root 0664 /var/run/utmp none
|
||||
f root root 0664 /var/log/wtmp none
|
||||
f root root 0664 /var/log/lastlog none
|
||||
|
||||
@@ -4,7 +4,7 @@ PRIORITY = "required"
|
||||
DEPENDS = "makedevs"
|
||||
RDEPENDS = "makedevs"
|
||||
LICENSE = "GPL"
|
||||
PR = "r104"
|
||||
PR = "r105"
|
||||
|
||||
SRC_URI = "file://functions \
|
||||
file://halt \
|
||||
|
||||
Reference in New Issue
Block a user