summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-10-28 21:11:25 +0000
committerOlivier Blin <oblin@mandriva.com>2008-10-28 21:11:25 +0000
commitdf2a0eb5c384a2fcef10e9cd56ef477650263d69 (patch)
tree6b4f69b352daebaffb604dfc8f55a423b7f215a0
parentd87a28c214c74a4611c61e157722dbe7e4710529 (diff)
downloaddrakiso-df2a0eb5c384a2fcef10e9cd56ef477650263d69.tar
drakiso-df2a0eb5c384a2fcef10e9cd56ef477650263d69.tar.gz
drakiso-df2a0eb5c384a2fcef10e9cd56ef477650263d69.tar.bz2
drakiso-df2a0eb5c384a2fcef10e9cd56ef477650263d69.tar.xz
drakiso-df2a0eb5c384a2fcef10e9cd56ef477650263d69.zip
move get_media_prefix as method in MDV::Draklive::Live
-rwxr-xr-xdraklive40
-rw-r--r--lib/MDV/Draklive/Live.pm6
2 files changed, 23 insertions, 23 deletions
diff --git a/draklive b/draklive
index c19c07c..90c90db 100755
--- a/draklive
+++ b/draklive
@@ -246,7 +246,7 @@ my %loop;
mount => sub {
my ($live, $dir) = @_;
$dir->{loop} = "/dev/loop" . $loop_number++;
- my $media_loopbacks = get_media_prefix($live, 'loopbacks');
+ my $media_loopbacks = $live->get_media_prefix('loopbacks');
(
"/bin/losetup $dir->{loop} $live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}${media_loopbacks}$dir->{path}$loop{squashfs}{extension}",
"nash-mount -o ro -t squashfs $dir->{loop} $live->{prefix}{live}{mnt}$dir->{mountpoint}",
@@ -258,7 +258,7 @@ my %loop;
delay_mount => 1,
mount => sub {
my ($live, $dir) = @_;
- my $media_loopbacks = get_media_prefix($live, 'loopbacks');
+ 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}'";
},
},
@@ -277,7 +277,7 @@ my %loop;
my ($live, $dir) = @_;
$dir->{loop} = "/dev/loop" . $loop_number++;
my $fsck = "chroot </dev/tty1 $live->{prefix}{live}{mnt}$dir_distrib_sqfs->{mountpoint} /sbin/fsck $dir->{loop}";
- my $media_loopbacks = get_media_prefix($live, 'loopbacks');
+ my $media_loopbacks = $live->get_media_prefix('loopbacks');
(
"losetup $dir->{loop} $live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}${media_loopbacks}$dir->{path}$loop{loopfs}{extension}",
qq(sh -c "$fsck -a || $fsck -y"),
@@ -626,7 +626,7 @@ sub build_syslinux_cfg {
my $append = get_default_append($live, $opts);
#- syslinux wants files at root (used with vfat fs)
my $to_root = $media->get_boot_setting('fs', $opts) eq 'vfat';
- my $boot = get_media_prefix($live, 'boot', $opts->{boot});
+ my $boot = $live->get_media_prefix('boot', $opts->{boot});
my ($initrd, $kernel, $bootlogo, $help) = map { $to_root ? basename($_) : $_ }
map { $boot . $_ } $media->get_initrd_path, @syslinux_boot_files;
my $has_bootlogo = $live->{system}{gfxboot} &&
@@ -661,7 +661,7 @@ sub build_grub_cfg_raw {
my ($live, $media, $initrd, $opts, $part_nb) = @_;
#- FIXME: use the bootloader module from drakx
my $grub_part = "(hd0" . (defined $part_nb ? "," . ($part_nb-1) : "") . ")";
- my $boot = get_media_prefix($live, 'boot'); #- FIXME handle boot media
+ my $boot = $live->get_media_prefix('boot'); #- FIXME handle boot media
my $title = $media->{title} || $live->{media}{title};
join("\n",
"timeout " . get_bootloader_timeout($live),
@@ -720,7 +720,7 @@ sub configure_draklive_resize {
my $resizable_loopback = find { $_->{min_size} } @{$live->{mount}{dirs} || []};
if ($resizable_loopback) {
- my $media_loopbacks = get_media_prefix($live, 'loopbacks');
+ my $media_loopbacks = $live->get_media_prefix('loopbacks');
output($live->get_system_root . '/etc/sysconfig/draklive-resize', <<EOF);
DRAKLIVE_RESIZE=yes
LOOPBACK=$live->{prefix}{live}{mnt}$live->{prefix}{media}{mnt}${media_loopbacks}$resizable_loopback->{path}
@@ -991,12 +991,6 @@ sub get_media_device {
$device;
}
-sub get_media_prefix {
- my ($live, $setting, $o_boot) = @_;
- my $hidden = $live->{system}{hide_media_dirs} && $live->{media}->get_boot_setting('can_hide', { boot => $o_boot });
- $live->{prefix}{media}{$hidden ? "hidden_$setting" : $setting};
-}
-
sub prepare_bootloader {
my ($live) = @_;
create_initrd($live);
@@ -1136,10 +1130,10 @@ sub create_cdrom_master {
'isolinux=' . $live->get_builddir . $live->{prefix}{build}{boot} . '/syslinux',
'isolinux/isolinux.bin=/usr/lib/syslinux/isolinux.bin',
'isolinux/isolinux.cfg=' . $live->get_builddir . $live->{prefix}{build}{boot} . get_syslinux_path($live->{media}, $opts),
- get_media_prefix($live, 'boot', $opts->{boot}) . '=' . $live->get_builddir . $live->{prefix}{build}{boot},
+ $live->get_media_prefix('boot', $opts->{boot}) . '=' . $live->get_builddir . $live->{prefix}{build}{boot},
if_(!$opts->{boot_only},
(map {
- get_media_prefix($live, 'loopbacks', $opts->{boot}) . $_ .
+ $live->get_media_prefix('loopbacks', $opts->{boot}) . $_ .
'=' .
$live->get_builddir . $live->{prefix}{build}{loopbacks} . $_;
} list_selected_loopbacks($live)),
@@ -1294,7 +1288,7 @@ EOF
sub install_usb_bootloader {
my ($live, $media, $opts) = @_;
- my $media_boot = get_media_prefix($live, 'boot', $opts->{boot});
+ my $media_boot = $live->get_media_prefix('boot', $opts->{boot});
my $device = get_media_device($live, $opts);
my $bootloader = $media->get_boot_setting('bootloader', $opts);
@@ -1351,8 +1345,8 @@ sub install_usb_bootloader {
sub record_usb_master {
my ($live, $opts) = @_;
my $media = $live->{media};
- my $media_boot = get_media_prefix($live, 'boot', $opts->{boot});
- my $media_loopbacks = get_media_prefix($live, 'loopbacks', $opts->{boot});
+ my $media_boot = $live->get_media_prefix('boot', $opts->{boot});
+ my $media_loopbacks = $live->get_media_prefix('loopbacks', $opts->{boot});
if (my $label = !$opts->{boot_only} && $opts->{device} && $media->get_media_label) {
set_device_label($opts->{device}, $media->get_media_setting('fs'), $label);
@@ -1415,8 +1409,8 @@ sub record_usb_master {
sub record_harddisk_master {
my ($live, $opts) = @_;
my $media = $live->{media};
- my $media_boot = get_media_prefix($live, 'boot', $opts->{boot});
- my $media_loopbacks = get_media_prefix($live, 'loopbacks', $opts->{boot});
+ my $media_boot = $live->get_media_prefix('boot', $opts->{boot});
+ my $media_loopbacks = $live->get_media_prefix('loopbacks', $opts->{boot});
if (my $label = !$opts->{boot_only} && $opts->{device} && $media->get_media_label) {
set_device_label($opts->{device}, $media->get_media_setting('fs'), $label);
@@ -1553,7 +1547,7 @@ sub get_disk_replicator_path {
sub get_disk_replicator_files {
my ($live) = @_;
- my $media_boot = get_media_prefix($live, 'boot');
+ my $media_boot = $live->get_media_prefix('boot');
my $initrd = $media_boot . $live->{replicator}{media}->get_initrd_path;
(
'/usr/lib/drakx-installer-images/isolinux/alt0/vmlinuz' => $media_boot . '/vmlinuz',
@@ -1577,7 +1571,7 @@ sub create_usb_replicator {
sub record_usb_replicator {
my ($live, $opts) = @_;
my $media = $live->{replicator}{media};
- my $media_boot = get_media_prefix($live, 'boot');
+ my $media_boot = $live->get_media_prefix('boot');
my $device = get_media_device($live, $opts)
or die "unable to find recording device (missing label? try with --device <device>)\n";
mkdir_p($live->{mnt});
@@ -1635,8 +1629,8 @@ sub copy_wizard {
file => N("Select a file"),
);
my ($source_type, $source_path);
- my $media_boot = get_media_prefix($live, 'boot');
- my $media_loopbacks = get_media_prefix($live, 'loopbacks');
+ my $media_boot = $live->get_media_prefix('boot');
+ my $media_loopbacks = $live->get_media_prefix('loopbacks');
my $source_is_mounted = sub { -d ($live->{settings}{builddir} . $media_boot) };
my $umount_source = sub {
if ($source_type ne 'live' && $source_is_mounted->()) {
diff --git a/lib/MDV/Draklive/Live.pm b/lib/MDV/Draklive/Live.pm
index 43b741e..c8839c2 100644
--- a/lib/MDV/Draklive/Live.pm
+++ b/lib/MDV/Draklive/Live.pm
@@ -22,6 +22,12 @@ sub get_system_root {
$live->{settings}{chroot} . '/' . $live->get_name;
}
+sub get_media_prefix {
+ my ($live, $setting, $o_boot) = @_;
+ my $hidden = $live->{system}{hide_media_dirs} && $live->{media}->get_boot_setting('can_hide', { boot => $o_boot });
+ $live->{prefix}{media}{$hidden ? "hidden_$setting" : $setting};
+}
+
sub find_kernel {
my ($live) = @_;
my $kernel = $live->{system}{kernel};