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