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:08
Message-Id: 1406834373.3ea3c267cd3b05c68b508f28b00efa5116850c09.zerochaos@gentoo
1 commit: 3ea3c267cd3b05c68b508f28b00efa5116850c09
2 Author: Fernando Reyes (likewhoa) <design <AT> missionaccomplish <DOT> com>
3 AuthorDate: Thu Jul 10 01:53:07 2014 +0000
4 Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 31 19:19:33 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=3ea3c267
7
8 Changed to the dd command which creates the livecd.aufs image for
9 the aufs writable branch to make the process faster we create a
10 sparse file. Added a check for a block device so that we don't try
11 mounting the aufs device & some small comestic changes.
12
13 ---
14 defaults/initrd.scripts | 33 ++++++++++++++++++++++-----------
15 defaults/linuxrc | 3 ++-
16 2 files changed, 24 insertions(+), 12 deletions(-)
17
18 diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
19 index 8a3d93e..5a01986 100644
20 --- a/defaults/initrd.scripts
21 +++ b/defaults/initrd.scripts
22 @@ -376,7 +376,7 @@ create_changefs() {
23 local size
24
25 while :; do
26 - read -p '<< Size of file (Press Enter for default 256 Mb): ' size
27 + read -p '<< Size of file (Press Enter for default 256 MB): ' size
28
29 size=${size:-256}
30
31 @@ -386,13 +386,13 @@ create_changefs() {
32 elif [ 15 -ge "$size" ]; then
33 bad_msg "Please give a size of at least 16 Megabytes"
34 else
35 - if dd if=/dev/zero "of=$aufs_dev_mnt$aufs_union_file" bs=1M count="$size" &>/dev/null; then
36 - good_msg "Creation of $aufs_union_file, ${size}Mb on $aufs_dev successful, formatting it ext2"
37 + if dd if=/dev/zero "of=$aufs_dev_mnt$aufs_union_file" bs=1 seek="$size"M count=0 &>/dev/null; then
38 + good_msg "Creation of $aufs_union_file, ${size}MB on $aufs_dev successful, formatting it ext2"
39 mke2fs -F "$aufs_dev_mnt$aufs_union_file" &>/dev/null
40 break
41 else
42 rm "$aufs_dev_mnt$aufs_union_file"
43 - bad_msg "Unable to create ${aufs_union_file#*/} on $aufs_dev of ${size}Mb"
44 + bad_msg "Unable to create ${aufs_union_file#*/} on $aufs_dev of ${size}MB"
45 bad_msg "Ensure your disk is not full or read-only"
46
47 read -p '<< Type "a" to abort, anything else to continue : ' doabort
48 @@ -410,13 +410,19 @@ create_changefs() {
49 setup_aufs() {
50 bootstrapCD
51
52 - if [ -n "$aufs_dev" ]; then
53 - good_msg "Mounting $aufs_dev to $aufs_memory for aufs support"
54 + if [ -n "$aufs_dev" ]; then
55 + if [ ! -b $aufs_dev ]; then
56 + bad_msg "$aufs_dev is not a valid block device"
57 + local invalidblk=1
58 + unset aufs_dev
59 + else
60 + good_msg "Mounting $aufs_dev to $aufs_memory for aufs support"
61
62 - if ! mount -t auto "$aufs_dev" "$aufs_dev_mnt" &>/dev/null; then
63 - bad_msg "Mount of $aufs_dev failed, falling back to ramdisk based aufs"
64 - unset aufs_dev
65 - fi
66 + if ! mount -t auto "$aufs_dev" "$aufs_dev_mnt" &>/dev/null; then
67 + bad_msg "Mount of $aufs_dev failed, falling back to ramdisk based aufs"
68 + unset aufs_dev
69 + fi
70 + fi
71
72 # Check and attempt to create the AUFS union file
73 if [ ! -e $aufs_dev_mnt$aufs_union_file ] && [ -n "$aufs_dev" ]; then
74 @@ -455,7 +461,12 @@ setup_aufs() {
75 aufs_xino=$aufs_memory
76 umount "$aufs_memory" &>/dev/null
77
78 - bad_msg "Create an extfs ${aufs_union_file#*/} file on this device"
79 + if [ 1 = "$invalidblk" ]; then
80 + bad_msg "Verify that you've entered a valid device path"
81 + else
82 + bad_msg "Create an extfs ${aufs_union_file#*/} file on this device"
83 + fi
84 +
85 bad_msg "if you wish to have aufs data persistency on reboots"
86 bad_msg "Falling back to ramdisk based aufs"
87 good_msg "Mounting ramdisk to $aufs_memory for aufs support"
88
89 diff --git a/defaults/linuxrc b/defaults/linuxrc
90 index 276f150..3098866 100644
91 --- a/defaults/linuxrc
92 +++ b/defaults/linuxrc
93 @@ -786,6 +786,7 @@ distfiles /usr/portage/distfiles tmpfs defaults 0 0
94 FSTAB
95 fi
96
97 + # When aufs.modules= is used
98 if [ 1 = "$aufs_modules" ]; then
99 warn_msg "Adding all modules in $aufs_modules_dev/modules/"
100
101 @@ -804,7 +805,7 @@ FSTAB
102 cp /etc/sysconfig/keyboard "$CHROOT/etc/sysconfig/"
103 fi
104
105 - # Create the diuectories for our new union mounts
106 + # Create the directories for our new union mounts
107 [ ! -d $CHROOT$NEW_ROOT ] && mkdir -p "$CHROOT$NEW_ROOT"
108
109 # Check to see if we successfully mounted $aufs_dev