diff options
author | Olivier Blin <oblin@mandriva.com> | 2007-05-31 15:14:40 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2007-05-31 15:14:40 +0000 |
commit | 9c12c4165bc07f3c94c95832ff1516b31c4434e2 (patch) | |
tree | 224d6d7f0f51d48c13d54cfa0cbf4550fe4c4785 /draklive | |
parent | bc48db1d8bc7d8304c287beb5f58b164c665e5c7 (diff) | |
download | drakiso-9c12c4165bc07f3c94c95832ff1516b31c4434e2.tar drakiso-9c12c4165bc07f3c94c95832ff1516b31c4434e2.tar.gz drakiso-9c12c4165bc07f3c94c95832ff1516b31c4434e2.tar.bz2 drakiso-9c12c4165bc07f3c94c95832ff1516b31c4434e2.tar.xz drakiso-9c12c4165bc07f3c94c95832ff1516b31c4434e2.zip |
revert to initrd + pivot_root (or else unionfs panicks in unionfs_file_revalidate when using unionctl in new root)
Diffstat (limited to 'draklive')
-rwxr-xr-x | draklive | 27 |
1 files changed, 17 insertions, 10 deletions
@@ -482,7 +482,6 @@ sub create_initrd_for_media { sub create_initrd_scriptlet { my ($live, $media, @modules) = @_; my $target = $live->{prefix}{live}{mnt} . ($live->{mount}{root} || $live->{prefix}{media}{mnt}); - my $sysroot = '/sysroot'; my $pre = get_media_setting($media, 'pre'); my $fs = get_media_setting($media, 'fs'); my $rrpt_dev = get_media_setting($media, 'rereadpt'); @@ -494,7 +493,7 @@ sub create_initrd_scriptlet { my ($mount_first, $mount_last) = partition { !$loop{$_->{type}}{delay_mount} } grep { exists $loop{$_->{type}}{mount} } @{$live->{mount}{dirs} || []}; - output_with_perm(get_builddir($live) . $live->{prefix}{build}{initrd} . '/' . $media->{storage} . '/init', 0755, + output_with_perm(get_builddir($live) . $live->{prefix}{build}{initrd} . '/' . $media->{storage} . '/linuxrc', 0755, join("\n", "#!/bin/nash", (map { join(" ", "insmod", "/lib/$_.ko", grep { $_ } $live->{system}{module_options}{$_}) } @modules), @@ -516,13 +515,11 @@ sub create_initrd_scriptlet { " -t $fs " . get_media_setting($media, 'source') . " $live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}", (map { $loop{$_->{type}}{mount}->($live, $_) } @$mount_first, @$mount_last), ($live->{mount}{overlay} ? $overlay{$live->{mount}{overlay}}{mount}->($live) : ()), - (map { ("/bin/mkdir -p $target$_", "/bin/mount -n --move $_ $target$_") } - if_($live->{mount}{overlay}, $live->{prefix}{live}{mnt} . $live->{prefix}{media}{mnt}), - map { $live->{prefix}{live}{mnt} . $_->{mountpoint} } grep { !$_->{fallback} } @{$live->{mount}{dirs} || []} - ), - "/bin/mkdir -p $sysroot", - "/bin/mount -n --move $target $sysroot", - "switchroot --nomovedev $sysroot", + "echo 0x0100 > /proc/sys/kernel/real-root-dev", + "umount /sys", + "umount /proc", + "pivot_root $target $target/initrd", + q(sh -c 'rmdir /initrd/live/union; cd /initrd/live; for i in `ls -1`; do mkdir -p /live/$i; mount -n --move $i /live/$i; done'), if_($live->{system}{initrd_post}, deref_array($live->{system}{initrd_post})), "")); } @@ -531,10 +528,20 @@ sub compress_initrd_tree { my ($live, $media) = @_; my $initrd_tree = get_builddir($live) . $live->{prefix}{build}{initrd} . '/' . $media->{storage}; + my $size = run_program::get_stdout("du -ks $initrd_tree | awk '{print \$1}'") + 250; + my $inodes = run_program::get_stdout("find $initrd_tree | wc -l") + 1250; + $size = int($size + $inodes / 10) + 1; #- 10 inodes needs 1K my $initrd = get_builddir($live) . $live->{prefix}{build}{boot} . get_initrd_path($media); $initrd =~ s/.gz$//; + mkdir_p(dirname($initrd)); - run_('sh', '-c', "(cd $initrd_tree; find . | cpio --quiet -c -o) >| $initrd"); + run_('dd', 'if=/dev/zero', "of=$initrd", 'bs=1k', "count=$size"); + run_('mke2fs', '-q', '-m', 0, '-F', '-N', $inodes, '-s', 1, $initrd); + mkdir_p($live->{mnt}); + run_('mount', '-o', 'loop', '-t', 'ext2', $initrd, $live->{mnt}); + cp_af(glob("$initrd_tree/*"), $live->{mnt}); + rm_rf($live->{mnt} . "/lost+found"); + run_('umount', $live->{mnt}); run_('gzip', '-f', '-9', $initrd); } |