summaryrefslogtreecommitdiffstats
path: root/meta
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
parentb8d979bf08cf23ddc722ccb241341d9db5be18ba (diff)
downloadpoky-c87c8e40719dbd5c863f607d3e18adce9a9b46b7.tar.gz
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')
-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"
8 8
9[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems." 9[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems."
10 10
11create_file() {
12 EXEC="
13 touch \"$1\";
14 chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
15 chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
16
17 test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache
18
19 [ -e "$1" ] && {
20 [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
21 } || {
22 eval $EXEC &
23 }
24}
25
26mk_dir() {
27 EXEC="
28 mkdir -p \"$1\";
29 chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
30 chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
31
32 test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache
33
34 [ -e "$1" ] && {
35 [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
36 } || {
37 eval $EXEC &
38 }
39}
40
41link_file() {
42 EXEC="test -e \"$2\" -o -L $2 || ln -s \"$1\" \"$2\" >/dev/tty0 2>&1"
43
44 test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache
45
46 [ -e "$2" ] && {
47 echo "Cannot create link over existing -${TNAME}-." >&2
48 } || {
49 eval $EXEC &
50 }
51}
11 52
12check_requirements() { 53check_requirements() {
13 54
@@ -72,21 +113,17 @@ apply_cfgfile() {
72 113
73 cat ${CFGFILE} | grep -v "^#" | \ 114 cat ${CFGFILE} | grep -v "^#" | \
74 while read LINE; do 115 while read LINE; do
75 TTYPE=`echo ${LINE} | cut -d " " -f 1` 116
76 TUSER=`echo ${LINE} | cut -d " " -f 2` 117 eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"`
77 TGROUP=`echo ${LINE} | cut -d " " -f 3`
78 TMODE=`echo ${LINE} | cut -d " " -f 4`
79 TNAME=`echo ${LINE} | cut -d " " -f 5`
80 118
81 [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-." 119 [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-."
82 120
121
83 [ "${TTYPE}" = "l" ] && { 122 [ "${TTYPE}" = "l" ] && {
84 [ -e "${TNAME}" ] && { 123 TSOURCE="$TLTARGET"
85 echo "Cannot create link over existing -${TNAME}-." >&2 124 [ -L "${TNAME}" ] || {
86 } || {
87 TSOURCE=`echo ${LINE} | cut -d " " -f 6`
88 [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-." 125 [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-."
89 ln -s "${TSOURCE}" "${TNAME}" 126 link_file "${TSOURCE}" "${TNAME}" &
90 } 127 }
91 continue 128 continue
92 } 129 }
@@ -103,17 +140,12 @@ apply_cfgfile() {
103 } 140 }
104 } 141 }
105 142
106 [ -e "${TNAME}" ] && {
107 [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
108 continue
109 }
110
111 case "${TTYPE}" in 143 case "${TTYPE}" in
112 "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-." 144 "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
113 touch "${TNAME}" 145 create_file "${TNAME}" &
114 ;; 146 ;;
115 "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-." 147 "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
116 mkdir -p "${TNAME}" 148 mk_dir "${TNAME}" &
117 # Add check to see if there's an entry in fstab to mount. 149 # Add check to see if there's an entry in fstab to mount.
118 ;; 150 ;;
119 *) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-." 151 *) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-."
@@ -121,9 +153,6 @@ apply_cfgfile() {
121 ;; 153 ;;
122 esac 154 esac
123 155
124 chown ${TUSER} ${TNAME} || echo "Failed to set owner -${TUSER}- for -${TNAME}-." >&2
125 chgrp ${TGROUP} ${TNAME} || echo "Failed to set group -${TGROUP}- for -${TNAME}-." >&2
126 chmod ${TMODE} ${TNAME} || echo "Failed to set mode -${TMODE}- for -${TNAME}-." >&2
127 156
128 done 157 done
129 158
@@ -131,8 +160,12 @@ apply_cfgfile() {
131 160
132 } 161 }
133 162
134 163if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate"
135for file in `ls -1 "${CFGDIR}" | sort`; do 164then
136 apply_cfgfile "${CFGDIR}/${file}" 165 sh /etc/volatile.cache
137 done 166else
138 167 rm -f /etc/volatile.cache
168 for file in `ls -1 "${CFGDIR}" | sort`; do
169 apply_cfgfile "${CFGDIR}/${file}"
170 done
171fi
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 @@
3# 3#
4# Every line must either be a comment starting with # 4# Every line must either be a comment starting with #
5# or a definition of format: 5# or a definition of format:
6# <type> <owner> <group> <mode> <path> [<linksource>] 6# <type> <owner> <group> <mode> <path> <linksource>
7# where the items are separated by whitespace ! 7# where the items are separated by whitespace !
8# 8#
9# <type> : d|f|l : (d)irectory|(f)ile|(l)ink 9# <type> : d|f|l : (d)irectory|(f)ile|(l)ink
10# 10#
11# A linking example: 11# A linking example:
12# l root root 0777 /var/test /tmp/testfile 12# l root root 0777 /var/test /tmp/testfile
13# f root root 0644 /var/test 13# f root root 0644 /var/test none
14# 14#
15# Understanding links: 15# Understanding links:
16# When populate-volatile is to verify/create a directory or file, it will first 16# When populate-volatile is to verify/create a directory or file, it will first
@@ -21,19 +21,19 @@
21# This explains the order of "link before object" as in the example above, where 21# This explains the order of "link before object" as in the example above, where
22# a link will be created at /var/test pointing to /tmp/testfile and due to this 22# a link will be created at /var/test pointing to /tmp/testfile and due to this
23# link the file defined as /var/test will actually be created as /tmp/testfile. 23# link the file defined as /var/test will actually be created as /tmp/testfile.
24d root root 0775 /var 24d root root 0775 /var none
25d root root 0755 /var/backups 25d root root 0755 /var/backups none
26d root root 0755 /var/cache 26d root root 0755 /var/cache none
27d root root 0755 /var/lib 27d root root 0755 /var/lib none
28d root root 0755 /var/lib/ipkg 28d root root 0755 /var/lib/ipkg none
29d root root 0755 /var/lib/misc 29d root root 0755 /var/lib/misc none
30d root root 2775 /var/local 30d root root 2775 /var/local none
31d root root 1777 /var/lock 31d root root 1777 /var/lock none
32d root root 0755 /var/lock/subsys 32d root root 0755 /var/lock/subsys none
33d root root 0755 /var/log 33d root root 0755 /var/log none
34d root root 0755 /var/run 34d root root 0755 /var/run none
35d root root 0755 /var/spool 35d root root 0755 /var/spool none
36d root root 1777 /var/tmp 36d root root 1777 /var/tmp none
37f root root 0664 /var/run/utmp 37f root root 0664 /var/run/utmp none
38f root root 0664 /var/log/wtmp 38f root root 0664 /var/log/wtmp none
39f root root 0664 /var/log/lastlog 39f 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"
4DEPENDS = "makedevs" 4DEPENDS = "makedevs"
5RDEPENDS = "makedevs" 5RDEPENDS = "makedevs"
6LICENSE = "GPL" 6LICENSE = "GPL"
7PR = "r104" 7PR = "r105"
8 8
9SRC_URI = "file://functions \ 9SRC_URI = "file://functions \
10 file://halt \ 10 file://halt \