diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MDV/Draklive/Initrd.pm | 3 | ||||
-rw-r--r-- | lib/MDV/Draklive/Loopback.pm | 7 |
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, |