summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-10-30 19:26:45 +0000
committerOlivier Blin <oblin@mandriva.com>2008-10-30 19:26:45 +0000
commitc915dfb3fb98c5c404c70ae578e7c8f77042ba27 (patch)
treea864cf9121348b7be8b5a203bf7816c608bee785 /lib
parent1c5d3c384b1c9e07b42e50c483e50ea5016fce7a (diff)
downloaddraklive-c915dfb3fb98c5c404c70ae578e7c8f77042ba27.tar
draklive-c915dfb3fb98c5c404c70ae578e7c8f77042ba27.tar.gz
draklive-c915dfb3fb98c5c404c70ae578e7c8f77042ba27.tar.bz2
draklive-c915dfb3fb98c5c404c70ae578e7c8f77042ba27.tar.xz
draklive-c915dfb3fb98c5c404c70ae578e7c8f77042ba27.zip
extract post-pivot root modules clean in per-loop-type pivot_clean sub
Diffstat (limited to 'lib')
-rw-r--r--lib/MDV/Draklive/Initrd.pm3
-rw-r--r--lib/MDV/Draklive/Loopback.pm7
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/MDV/Draklive/Initrd.pm b/lib/MDV/Draklive/Initrd.pm
index ecd73a3..cea6829 100644
--- a/lib/MDV/Draklive/Initrd.pm
+++ b/lib/MDV/Draklive/Initrd.pm
@@ -217,8 +217,7 @@ sub create_initrd_scriptlet {
"umount /proc",
"pivot_root $target $target$initrdroot",
if_($live->{mount}{root}, "sh -c 'rmdir $initrdroot$live->{prefix}{live}{mnt}$live->{mount}{root}'"),
- "sh -c 'if [ -d $initrdroot$live->{prefix}{live}{mnt}/modules ]; then cd $initrdroot$live->{prefix}{live}{mnt}/modules; for i in `ls -1`; do mkdir -p $live->{prefix}{live}{mnt}/modules/\$i; mount -n --move \$i $live->{prefix}{live}{mnt}/modules/\$i; rmdir \$i; done; rmdir $initrdroot$live->{prefix}{live}{mnt}/modules; fi'",
- (map { "sh -c 'mv $initrdroot$live->{prefix}{live}{mnt}/$_->{list} $live->{prefix}{live}{mnt}/'" } grep { $_->{list} } @{$live->{mount}{dirs} || []}),
+ (map { $loop_types{$_->{type}}{pivot_clean}->($live, $_, $initrdroot) } grep { $loop_types{$_->{type}}{pivot_clean} } @{$live->{mount}{dirs} || []}),
"sh -c 'cd $initrdroot$live->{prefix}{live}{mnt}; for i in `ls -1`; do [ -d \$i ] || continue; mkdir -p $live->{prefix}{live}{mnt}/\$i; mount -n --move \$i $live->{prefix}{live}{mnt}/\$i; rmdir \$i; done'",
"rmdir $initrdroot$live->{prefix}{live}{mnt}",
"nash-mount -o mode=0755 -t tmpfs /dev /dev",
diff --git a/lib/MDV/Draklive/Loopback.pm b/lib/MDV/Draklive/Loopback.pm
index c9dbd9c..253a56a 100644
--- a/lib/MDV/Draklive/Loopback.pm
+++ b/lib/MDV/Draklive/Loopback.pm
@@ -61,6 +61,13 @@ our %loop_types;
my $media_loopbacks = $live->get_media_prefix('loopbacks');
"sh -c 'modules=; for m in $live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}${media_loopbacks}$dir->{path}/*; do n=\$(basename \$m); n=\${n%.sqfs}; d=$live->{prefix}{live}{mnt}$dir->{mountpoint}/\$n; mkdir -p \$d; mount -n -o loop,ro -t squashfs \$m \$d && modules=\$modules\$d=ro:; done; echo \$modules | sed -e s/:\$// > $live->{prefix}{live}{mnt}/$dir->{list}'";
},
+ pivot_clean => sub {
+ my ($live, $dir, $initrdroot) = @_;
+ (
+ "sh -c 'cd $initrdroot$live->{prefix}{live}{mnt}$dir->{mountpoint}; for i in `ls -1`; do mkdir -p $live->{prefix}{live}{mnt}$dir->{mountpoint}/\$i; mount -n --move \$i $live->{prefix}{live}{mnt}$dir->{mountpoint}/\$i; rmdir \$i; done; rmdir $initrdroot$live->{prefix}{live}{mnt}$dir->{mountpoint}'",
+ "sh -c 'mv $initrdroot$live->{prefix}{live}{mnt}/$dir->{list} $live->{prefix}{live}{mnt}/'",
+ );
+ },
},
loopfs => {
is_loopback => 1,