1 |
ramereth 09/09/29 05:17:59 |
2 |
|
3 |
Added: dracut-002-dir-symlinks.patch |
4 |
dracut-002-add-missing-functions.patch |
5 |
dracut-002-custom-paths.patch |
6 |
dracut-002-gencmdline-check-for-keyboard-i18n-files.patch |
7 |
dracut-002-unmount.patch |
8 |
Log: |
9 |
New package dracut, a generic initramfs building tool |
10 |
(Portage version: 2.1.6.13/cvs/Linux x86_64) |
11 |
|
12 |
Revision Changes Path |
13 |
1.1 sys-kernel/dracut/files/dracut-002-dir-symlinks.patch |
14 |
|
15 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-dir-symlinks.patch?rev=1.1&view=markup |
16 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-dir-symlinks.patch?rev=1.1&content-type=text/plain |
17 |
|
18 |
Index: dracut-002-dir-symlinks.patch |
19 |
=================================================================== |
20 |
From 044fbc9ed51e4df819ee5710ed519c566579ff59 Mon Sep 17 00:00:00 2001 |
21 |
From: Lance Albertson <lance@××××××.org> |
22 |
Date: Sat, 26 Sep 2009 21:33:41 -0700 |
23 |
Subject: [PATCH 3/3] dir symlinks |
24 |
|
25 |
--- |
26 |
dracut | 2 +- |
27 |
dracut-functions | 43 +++++++++++++++++++++++++++++++++++++------ |
28 |
2 files changed, 38 insertions(+), 7 deletions(-) |
29 |
|
30 |
diff --git a/dracut b/dracut |
31 |
index b96ad5e..0518969 100755 |
32 |
--- a/dracut |
33 |
+++ b/dracut |
34 |
@@ -174,7 +174,7 @@ export initdir hookdirs dsrc dracutmodules drivers \ |
35 |
if [[ $kernel_only != yes ]]; then |
36 |
# Create some directory structure first |
37 |
for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot tmp dev/pts var/run; do |
38 |
- mkdir -p "$initdir/$d"; |
39 |
+ inst_dir "/$d"; |
40 |
done |
41 |
fi |
42 |
|
43 |
diff --git a/dracut-functions b/dracut-functions |
44 |
index 2abd6f2..1f2d1e6 100755 |
45 |
--- a/dracut-functions |
46 |
+++ b/dracut-functions |
47 |
@@ -131,6 +131,36 @@ check_vol_slaves() { |
48 |
return 1 |
49 |
} |
50 |
|
51 |
+# Install a directory, keeping symlinks as on the original system. |
52 |
+# Example: if /lib64 points to /lib on the host, "inst_dir /lib/file" |
53 |
+# will create ${initdir}/lib64, ${initdir}/lib64/file, |
54 |
+# and a symlink ${initdir}/lib -> lib64. |
55 |
+inst_dir() { |
56 |
+ local dir="$1" |
57 |
+ [[ -e "${initdir}$dir" ]] && return 0 |
58 |
+ |
59 |
+ # iterate over parent directories |
60 |
+ local file="" |
61 |
+ local IFS="/" |
62 |
+ for part in $dir; do |
63 |
+ [ -z "$part" ] && continue |
64 |
+ file="$file/$part" |
65 |
+ [[ -e "${initdir}$file" ]] && continue |
66 |
+ |
67 |
+ if [ -L "$file" ]; then |
68 |
+ # create link as the original |
69 |
+ local target=$(readlink "$file") |
70 |
+ ln -sfn "$target" "${initdir}$file" || return 1 |
71 |
+ # resolve relative path and recursively install destionation |
72 |
+ [[ "$target" = "${target##*/}" ]] && target="${file%/*}/$target" |
73 |
+ inst_dir "$target" |
74 |
+ else |
75 |
+ # create directory |
76 |
+ mkdir -p "${initdir}$file" || return 1 |
77 |
+ fi |
78 |
+ done |
79 |
+} |
80 |
+ |
81 |
# $1 = file to copy to ramdisk |
82 |
# $2 (optional) Name for the file on the ramdisk |
83 |
# Location of the image dir is assumed to be $initdir |
84 |
@@ -138,11 +168,11 @@ check_vol_slaves() { |
85 |
inst_simple() { |
86 |
local src target |
87 |
[[ -f $1 ]] || return 1 |
88 |
- src=$1 target=${initdir}${2:-$1} |
89 |
- [[ -f $target ]] && return 0 |
90 |
- mkdir -p "${target%/*}" |
91 |
+ src=$1 target="${2:-$1}" |
92 |
+ [[ -f ${initdir}$target ]] && return 0 |
93 |
+ inst_dir "${target%/*}" |
94 |
dinfo "Installing $src" |
95 |
- cp -pfL "$src" "$target" |
96 |
+ cp -fL "$src" "${initdir}$target" |
97 |
} |
98 |
|
99 |
# Same as above, but specialzed to handle dynamic libraries. |
100 |
@@ -155,7 +185,7 @@ inst_library() { |
101 |
reallib=$(readlink -f "$src") |
102 |
lib=${src##*/} |
103 |
inst_simple "$reallib" "$reallib" |
104 |
- mkdir -p "${initdir}${dest%/*}" |
105 |
+ inst_dir "${dest%/*}" |
106 |
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib") |
107 |
else |
108 |
inst_simple "$src" "$dest" |
109 |
@@ -250,7 +280,8 @@ find_rule() { |
110 |
# create a function to install them to make life simpler. |
111 |
inst_rules() { |
112 |
local target=/etc/udev/rules.d |
113 |
- mkdir -p "$initdir/lib/udev/rules.d" "$initdir$target" |
114 |
+ inst_dir "/lib/udev/rules.d" |
115 |
+ inst_dir "$target" |
116 |
for rule in "$@"; do |
117 |
rule=$(find_rule "$rule") && \ |
118 |
inst_simple "$rule" "$target/${rule##*/}" |
119 |
-- |
120 |
1.6.3.3 |
121 |
|
122 |
|
123 |
|
124 |
|
125 |
1.1 sys-kernel/dracut/files/dracut-002-add-missing-functions.patch |
126 |
|
127 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-add-missing-functions.patch?rev=1.1&view=markup |
128 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-add-missing-functions.patch?rev=1.1&content-type=text/plain |
129 |
|
130 |
Index: dracut-002-add-missing-functions.patch |
131 |
=================================================================== |
132 |
From 5e5ec023bedc14d709f1d5f8e2803ba171b05daa Mon Sep 17 00:00:00 2001 |
133 |
From: Harald Hoyer <harald@××××××.com> |
134 |
Date: Fri, 18 Sep 2009 09:08:23 +0200 |
135 |
Subject: [PATCH] dracut-gencmdline: add missing functions |
136 |
|
137 |
--- |
138 |
dracut-gencmdline | 33 +++++++++++++++++++++++++++++++++ |
139 |
1 files changed, 33 insertions(+), 0 deletions(-) |
140 |
|
141 |
diff --git a/dracut-gencmdline b/dracut-gencmdline |
142 |
index bab102f..f3cbee1 100755 |
143 |
--- a/dracut-gencmdline |
144 |
+++ b/dracut-gencmdline |
145 |
@@ -19,6 +19,39 @@ |
146 |
# |
147 |
#. /usr/libexec/initrd-functions |
148 |
|
149 |
+IF_verbose="" |
150 |
+function set_verbose() { |
151 |
+ case $1 in |
152 |
+ 1|true|yes|on) |
153 |
+ IF_verbose="-v" |
154 |
+ ;; |
155 |
+ 0|false|no|off) |
156 |
+ IF_verbose="" |
157 |
+ ;; |
158 |
+ esac |
159 |
+} |
160 |
+ |
161 |
+function is_verbose() { |
162 |
+ [ -n "$IF_verbose" ] && return 0 |
163 |
+ return 1 |
164 |
+} |
165 |
+ |
166 |
+function get_verbose() { |
167 |
+ echo "$IF_verbose" |
168 |
+ is_verbose |
169 |
+} |
170 |
+ |
171 |
+ |
172 |
+function get_numeric_dev() { |
173 |
+( |
174 |
+ fmt="%d:%d" |
175 |
+ if [ "$1" == "hex" ]; then |
176 |
+ fmt="%x:%x" |
177 |
+ fi |
178 |
+ ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }' |
179 |
+) 2>/dev/null |
180 |
+} |
181 |
+ |
182 |
|
183 |
function error() { |
184 |
echo "$@" >&2 |
185 |
-- |
186 |
1.6.3.3 |
187 |
|
188 |
|
189 |
|
190 |
|
191 |
1.1 sys-kernel/dracut/files/dracut-002-custom-paths.patch |
192 |
|
193 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-custom-paths.patch?rev=1.1&view=markup |
194 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-custom-paths.patch?rev=1.1&content-type=text/plain |
195 |
|
196 |
Index: dracut-002-custom-paths.patch |
197 |
=================================================================== |
198 |
From 550fa5f9ae8c6b2fa284d78c090edc5a36991d3a Mon Sep 17 00:00:00 2001 |
199 |
From: Lance Albertson <lance@××××××.org> |
200 |
Date: Sat, 26 Sep 2009 21:26:43 -0700 |
201 |
Subject: [PATCH 2/3] custom paths |
202 |
|
203 |
--- |
204 |
Makefile | 12 ++++++------ |
205 |
1 files changed, 6 insertions(+), 6 deletions(-) |
206 |
|
207 |
diff --git a/Makefile b/Makefile |
208 |
index d9ce0f8..f6d162f 100644 |
209 |
--- a/Makefile |
210 |
+++ b/Makefile |
211 |
@@ -1,12 +1,12 @@ |
212 |
VERSION=002 |
213 |
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8) |
214 |
|
215 |
-prefix = /usr |
216 |
-datadir = ${prefix}/share |
217 |
-pkglibdir = ${datadir}/dracut |
218 |
-sysconfdir = ${prefix}/etc |
219 |
-sbindir = ${prefix}/sbin |
220 |
-mandir = ${prefix}/share/man |
221 |
+prefix ?= /usr |
222 |
+datadir ?= ${prefix}/share |
223 |
+pkglibdir ?= ${datadir}/dracut |
224 |
+sysconfdir ?= ${prefix}/etc |
225 |
+sbindir ?= ${prefix}/sbin |
226 |
+mandir ?= ${prefix}/share/man |
227 |
|
228 |
modules.d/99base/switch_root: switch_root.c |
229 |
gcc -D _GNU_SOURCE -D 'PACKAGE_STRING="dracut"' -std=gnu99 -fsigned-char -g -O2 -o modules.d/99base/switch_root switch_root.c |
230 |
-- |
231 |
1.6.3.3 |
232 |
|
233 |
|
234 |
|
235 |
|
236 |
1.1 sys-kernel/dracut/files/dracut-002-gencmdline-check-for-keyboard-i18n-files.patch |
237 |
|
238 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-gencmdline-check-for-keyboard-i18n-files.patch?rev=1.1&view=markup |
239 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-gencmdline-check-for-keyboard-i18n-files.patch?rev=1.1&content-type=text/plain |
240 |
|
241 |
Index: dracut-002-gencmdline-check-for-keyboard-i18n-files.patch |
242 |
=================================================================== |
243 |
From 6dc6649052d07a6ab0720bd4e866629cb385cb8a Mon Sep 17 00:00:00 2001 |
244 |
From: Lance Albertson <lance@××××××.org> |
245 |
Date: Mon, 28 Sep 2009 20:30:17 -0700 |
246 |
Subject: [PATCH] dracut-gencmdline: check for keyboard & i18n files |
247 |
|
248 |
--- |
249 |
dracut-gencmdline | 4 ++-- |
250 |
1 files changed, 2 insertions(+), 2 deletions(-) |
251 |
|
252 |
diff --git a/dracut-gencmdline b/dracut-gencmdline |
253 |
index f3cbee1..0f2bca1 100755 |
254 |
--- a/dracut-gencmdline |
255 |
+++ b/dracut-gencmdline |
256 |
@@ -689,8 +689,8 @@ for cryptdev in ${!cryptolv@} ; do |
257 |
done |
258 |
|
259 |
# output local keyboard/18n settings |
260 |
-. /etc/sysconfig/keyboard |
261 |
-. /etc/sysconfig/i18n |
262 |
+[ -e /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard |
263 |
+[ -e /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n |
264 |
|
265 |
for i in KEYTABLE SYSFONT SYSFONTACM UNIMAP LANG; do |
266 |
val=$(eval echo \$$i) |
267 |
-- |
268 |
1.6.3.3 |
269 |
|
270 |
|
271 |
|
272 |
|
273 |
1.1 sys-kernel/dracut/files/dracut-002-unmount.patch |
274 |
|
275 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-unmount.patch?rev=1.1&view=markup |
276 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-unmount.patch?rev=1.1&content-type=text/plain |
277 |
|
278 |
Index: dracut-002-unmount.patch |
279 |
=================================================================== |
280 |
From 7aa5f85a748dcad3567c878b8623af446f0d8c4f Mon Sep 17 00:00:00 2001 |
281 |
From: Lance Albertson <lance@××××××.org> |
282 |
Date: Sat, 26 Sep 2009 21:26:06 -0700 |
283 |
Subject: [PATCH 1/3] fix umount |
284 |
|
285 |
--- |
286 |
switch_root.c | 13 +++---------- |
287 |
1 files changed, 3 insertions(+), 10 deletions(-) |
288 |
|
289 |
diff --git a/switch_root.c b/switch_root.c |
290 |
index 8ce4aaf..1643a71 100644 |
291 |
--- a/switch_root.c |
292 |
+++ b/switch_root.c |
293 |
@@ -160,22 +160,15 @@ done: |
294 |
static int switchroot(const char *newroot) |
295 |
{ |
296 |
/* Don't try to unmount the old "/", there's no way to do it. */ |
297 |
- const char *umounts[] = { "/dev", "/proc", "/sys", NULL }; |
298 |
+ const char *umounts[] = { "/dev/pts", "/dev", "/proc", "/sys", NULL }; |
299 |
char *newroot_mnt; |
300 |
const char *chroot_path = NULL; |
301 |
int i; |
302 |
int r = -1; |
303 |
|
304 |
for (i = 0; umounts[i] != NULL; i++) { |
305 |
- char newmount[PATH_MAX]; |
306 |
- |
307 |
- snprintf(newmount, sizeof(newmount), "%s%s", newroot, umounts[i]); |
308 |
- |
309 |
- if (mount(umounts[i], newmount, NULL, MS_MOVE, NULL) < 0) { |
310 |
- warn("failed to mount moving %s to %s", |
311 |
- umounts[i], newmount); |
312 |
- warnx("forcing unmount of %s", umounts[i]); |
313 |
- umount2(umounts[i], MNT_FORCE); |
314 |
+ if (umount2(umounts[i], MNT_FORCE) < 0) { |
315 |
+ warn("failed to unmount %s", umounts[i]); |
316 |
} |
317 |
} |
318 |
|
319 |
-- |
320 |
1.6.3.3 |