diff options
author | Richard Purdie <richard@openedhand.com> | 2008-05-20 13:38:00 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-05-20 13:38:00 +0000 |
commit | c87c8e40719dbd5c863f607d3e18adce9a9b46b7 (patch) | |
tree | 79de92b657114f57c61f7ea1f9be91c3b89ef84a /meta | |
parent | b8d979bf08cf23ddc722ccb241341d9db5be18ba (diff) | |
download | poky-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-x | meta/packages/initscripts/initscripts-1.0/populate-volatile.sh | 83 | ||||
-rw-r--r-- | meta/packages/initscripts/initscripts-1.0/volatiles | 36 | ||||
-rw-r--r-- | meta/packages/initscripts/initscripts_1.0.bb | 2 |
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 | ||
11 | create_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 | |||
26 | mk_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 | |||
41 | link_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 | ||
12 | check_requirements() { | 53 | check_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 | 163 | if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" | |
135 | for file in `ls -1 "${CFGDIR}" | sort`; do | 164 | then |
136 | apply_cfgfile "${CFGDIR}/${file}" | 165 | sh /etc/volatile.cache |
137 | done | 166 | else |
138 | 167 | rm -f /etc/volatile.cache | |
168 | for file in `ls -1 "${CFGDIR}" | sort`; do | ||
169 | apply_cfgfile "${CFGDIR}/${file}" | ||
170 | done | ||
171 | 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 @@ | |||
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. |
24 | d root root 0775 /var | 24 | d root root 0775 /var none |
25 | d root root 0755 /var/backups | 25 | d root root 0755 /var/backups none |
26 | d root root 0755 /var/cache | 26 | d root root 0755 /var/cache none |
27 | d root root 0755 /var/lib | 27 | d root root 0755 /var/lib none |
28 | d root root 0755 /var/lib/ipkg | 28 | d root root 0755 /var/lib/ipkg none |
29 | d root root 0755 /var/lib/misc | 29 | d root root 0755 /var/lib/misc none |
30 | d root root 2775 /var/local | 30 | d root root 2775 /var/local none |
31 | d root root 1777 /var/lock | 31 | d root root 1777 /var/lock none |
32 | d root root 0755 /var/lock/subsys | 32 | d root root 0755 /var/lock/subsys none |
33 | d root root 0755 /var/log | 33 | d root root 0755 /var/log none |
34 | d root root 0755 /var/run | 34 | d root root 0755 /var/run none |
35 | d root root 0755 /var/spool | 35 | d root root 0755 /var/spool none |
36 | d root root 1777 /var/tmp | 36 | d root root 1777 /var/tmp none |
37 | f root root 0664 /var/run/utmp | 37 | f root root 0664 /var/run/utmp none |
38 | f root root 0664 /var/log/wtmp | 38 | f root root 0664 /var/log/wtmp none |
39 | f root root 0664 /var/log/lastlog | 39 | 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" | |||
4 | DEPENDS = "makedevs" | 4 | DEPENDS = "makedevs" |
5 | RDEPENDS = "makedevs" | 5 | RDEPENDS = "makedevs" |
6 | LICENSE = "GPL" | 6 | LICENSE = "GPL" |
7 | PR = "r104" | 7 | PR = "r105" |
8 | 8 | ||
9 | SRC_URI = "file://functions \ | 9 | SRC_URI = "file://functions \ |
10 | file://halt \ | 10 | file://halt \ |