Gentoo Archives: gentoo-commits

From: Richard Farina <zerochaos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:aufs commit in: defaults/
Date: Fri, 05 Sep 2014 16:10:04
Message-Id: 1403791417.c7ae28126edd1fcf2144e93a6c73f7b07bd79c48.zerochaos@gentoo
1 commit: c7ae28126edd1fcf2144e93a6c73f7b07bd79c48
2 Author: Fernando Reyes (likewhoa) <design <AT> missionaccomplish <DOT> com>
3 AuthorDate: Wed Jun 25 16:12:11 2014 +0000
4 Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 26 14:03:37 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=c7ae2812
7
8 More coding style changes to two of the union_* functions. LC_COLLATE=C
9 is introduced to allow globbing since we never want to parse ls.
10 Introduced a helper function for union_insert_modules as well.
11
12 ---
13 defaults/initrd.defaults | 2 ++
14 defaults/initrd.scripts | 44 +++++++++++++++++++++++++++++---------------
15 2 files changed, 31 insertions(+), 15 deletions(-)
16
17 diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
18 index 67b0d28..93a40dd 100755
19 --- a/defaults/initrd.defaults
20 +++ b/defaults/initrd.defaults
21 @@ -12,6 +12,8 @@ BAD="\033[31;1m"
22 BOLD="\033[1m"
23 GOOD="\033[32;1m"
24
25 +# Sets the default collation order
26 +LC_COLLATE=C
27 # From KNOPPIX LINUXRC
28 # Reset fb color mode
29 RESET="]R"
30
31 diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
32 index d87bb4e..3411c18 100644
33 --- a/defaults/initrd.scripts
34 +++ b/defaults/initrd.scripts
35 @@ -287,27 +287,41 @@ mount_sysfs() {
36 #
37 union_insert_dir() {
38 # Always mount it over the precedent (add:1:)
39 - mount -n -o remount,add:1:${2}=rr aufs ${1}
40 - if [ $? = '0' ]
41 - then
42 - good_msg "Addition of ${2} to ${1} successful"
43 + if mount -n -o "remount,add:1:$2=rr" aufs "$1"; then
44 + good_msg "Addition of $2 to $1 successful"
45 fi
46 }
47
48 # Insert all modules found in $1, usually ${CDROOT_PATH}
49 # added to allow users to add their own apps.
50 union_insert_modules() {
51 - for module in $(ls ${NEW_ROOT}/${1}/modules/*.mo 2>/dev/null| sort)
52 - do
53 - mkdir -p ${MEMORY}/modules/$(basename ${module} .mo)
54 - union_insert_dir $UNION ${MEMORY}/modules/$(basename ${module} .mo)
55 - done
56 - for module in $(ls ${NEW_ROOT}/${1}/modules/*.lzm 2>/dev/null| sort)
57 - do
58 - mkdir -p ${MEMORY}/modules/$(basename ${module} .lzm)
59 - mount -o loop,ro ${module} ${MEMORY}/modules/$(basename ${module} .lzm)
60 - union_insert_dir $UNION ${MEMORY}/modules/$(basename ${module} .lzm)
61 - done
62 + local module
63 +
64 + for module in "$NEW_ROOT/$1/modules/"*.mo; do
65 + union_mod "$module" || bad_msg "Unable to load module: '$module'"
66 + done
67 +
68 + for module in "$NEW_ROOT/$1/modules/"*.lzm; do
69 + union_mod "$module" lzm || bad_msg "Unable to load module: '$module'"
70 + done
71 +}
72 +
73 +# Helper function for union_insert_modules()
74 +union_mod() {
75 + [ -e "$1" ] || return 0
76 +
77 + local mod
78 +
79 + mod=${1##*/}
80 + mod=${mod%.*}
81 +
82 + mkdir -p "$MEMORY/modules/$mod" || return
83 +
84 + if [ lzm = "$2" ]; then
85 + mount -o loop,ro "$1" "$MEMORY/modules/$mod"
86 + fi
87 +
88 + union_insert_dir "$UNION" "$MEMORY/modules/$mod"
89 }
90
91 # Implements RC_NO_UMOUNTS variable into ${CHROOT}/etc/rc.conf for a cleaner shutdown process