summaryrefslogtreecommitdiff
path: root/meta/packages/initscripts
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-05-20 13:38:00 +0000
committerRichard Purdie <richard@openedhand.com>2008-05-20 13:38:00 +0000
commitc87c8e40719dbd5c863f607d3e18adce9a9b46b7 (patch)
tree79de92b657114f57c61f7ea1f9be91c3b89ef84a /meta/packages/initscripts
parentb8d979bf08cf23ddc722ccb241341d9db5be18ba (diff)
downloadopenembedded-core-c87c8e40719dbd5c863f607d3e18adce9a9b46b7.tar.gz
openembedded-core-c87c8e40719dbd5c863f607d3e18adce9a9b46b7.tar.bz2
openembedded-core-c87c8e40719dbd5c863f607d3e18adce9a9b46b7.zip
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
Diffstat (limited to 'meta/packages/initscripts')
-rwxr-xr-xmeta/packages/initscripts/initscripts-1.0/populate-volatile.sh83
-rw-r--r--meta/packages/initscripts/initscripts-1.0/volatiles36
-rw-r--r--meta/packages/initscripts/initscripts_1.0.bb2
3 files changed, 77 insertions, 44 deletions
diff --git a/meta/packages/initscripts/initscripts-1.0/populate-volatile.sh b/meta/packages/initscripts/initscripts-1.0/populate-volatile.sh
index 99a469d576..3bb3d94de6 100755
--- a/meta/packages/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/packages/initscripts/initscripts-1.0/populate-volatile.sh
@@ -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
diff --git a/meta/packages/initscripts/initscripts-1.0/volatiles b/meta/packages/initscripts/initscripts-1.0/volatiles
index 37ce8b529a..9fa7a46825 100644
--- a/meta/packages/initscripts/initscripts-1.0/volatiles
+++ b/meta/packages/initscripts/initscripts-1.0/volatiles
@@ -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
diff --git a/meta/packages/initscripts/initscripts_1.0.bb b/meta/packages/initscripts/initscripts_1.0.bb
index 4433d12318..55998c0a4a 100644
--- a/meta/packages/initscripts/initscripts_1.0.bb
+++ b/meta/packages/initscripts/initscripts_1.0.bb
@@ -4,7 +4,7 @@ PRIORITY = "required"
DEPENDS = "makedevs"
RDEPENDS = "makedevs"
LICENSE = "GPL"
-PR = "r104"
+PR = "r105"
SRC_URI = "file://functions \
file://halt \