Gentoo Archives: gentoo-commits

From: Sebastian Pipping <sping@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/
Date: Fri, 27 Jul 2012 23:05:13
Message-Id: 1343428975.ed09edb1c061fd222c1b0e1e92a44ebe55bbc921.sping@gentoo
1 commit: ed09edb1c061fd222c1b0e1e92a44ebe55bbc921
2 Author: Sebastian Pipping <sebastian <AT> pipping <DOT> org>
3 AuthorDate: Fri Jul 27 22:42:55 2012 +0000
4 Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 27 22:42:55 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=ed09edb1
7
8 Resolve cryptic awk-based code docuplication
9
10 ---
11 defaults/initrd.scripts | 9 +++++++--
12 1 files changed, 7 insertions(+), 2 deletions(-)
13
14 diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
15 index ac32c8a..082d44d 100755
16 --- a/defaults/initrd.scripts
17 +++ b/defaults/initrd.scripts
18 @@ -298,6 +298,11 @@ run_shell() {
19 /bin/ash
20 }
21
22 +fs_type_in_use() {
23 + fs_type=$1
24 + cut -d ' ' -f 3 < /proc/mounts | fgrep -q "${fs_type}"
25 +}
26 +
27 mount_devfs () {
28 # Use devtmpfs if enabled in kernel,
29 # else tmpfs. Always run mdev just in case
30 @@ -307,13 +312,13 @@ mount_devfs () {
31 fi
32
33 # Options copied from /etc/init.d/udev-mount, should probably be kept in sync
34 - if awk 'BEGIN{m=0;} /devtmpfs/{if($3 == "devtmpfs") {m=1;} } END { exit m;}' /proc/mounts; then
35 + if ! fs_type_in_use devtmpfs; then
36 mount -t $devfs -o "exec,nosuid,mode=0755,size=10M" udev /dev \
37 || bad_msg "Failed to mount /dev as ${devfs}"
38 fi
39
40 # http://git.busybox.net/busybox/plain/docs/mdev.txt
41 - if awk 'BEGIN{m=0;} /devpts/{if($3 == "devpts") {m=1;} } END { exit m;}' /proc/mounts; then
42 + if ! fs_type_in_use devpts; then
43 mkdir -m 0755 /dev/pts
44 mount -t devpts -o gid=5,mode=0620 devpts /dev/pts || bad_msg "Failed to mount /dev/pts"
45 fi