diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-12-15 18:16:08 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-12-15 18:16:08 +0000 |
commit | c04b44f280c4bfd8aabbd9b371bcdedaf9473f86 (patch) | |
tree | ac933513fdcbd60606e7f2c5541d67f763621977 /tools | |
parent | fb69b71e7c46b2689bdc3730a6ee3ed35d2d0bd3 (diff) | |
download | drakx-backup-do-not-use-c04b44f280c4bfd8aabbd9b371bcdedaf9473f86.tar drakx-backup-do-not-use-c04b44f280c4bfd8aabbd9b371bcdedaf9473f86.tar.gz drakx-backup-do-not-use-c04b44f280c4bfd8aabbd9b371bcdedaf9473f86.tar.bz2 drakx-backup-do-not-use-c04b44f280c4bfd8aabbd9b371bcdedaf9473f86.tar.xz drakx-backup-do-not-use-c04b44f280c4bfd8aabbd9b371bcdedaf9473f86.zip |
make storage description more configurable
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/draklive | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/tools/draklive b/tools/draklive index a089953a7..a30f38049 100755 --- a/tools/draklive +++ b/tools/draklive @@ -117,11 +117,6 @@ my %custom = ( }, ); -my %storage_modules = ( - cdrom => "disk/cdrom|hardware_raid|sata|scsi bus/usb disk/raw", - usb => "bus/usb disk/raw|usb", -); - sub nls_modules { my ($live) = @_; if_($live->{media}{fs} eq 'vfat', 'nls_cp437'), #- default FAT codepage @@ -222,6 +217,16 @@ my %overlay = ( }, ); +my %storage = ( + cdrom => { + modules => 'disk/cdrom|hardware_raid|sata|scsi bus/usb disk/raw', + }, + usb => { + modules => 'bus/usb disk/raw|usb', + create => undef, + record => \&record_usb_master, + }, +); my %moddeps; sub load_moddeps { @@ -290,7 +295,7 @@ sub create_initrd { load_moddeps($live->{system}{root}, "/lib/modules/" . $live->{system}{kernel}); my ($modules, $skipped) = partition { exists $moddeps{$_} } - uniq(map { modules::cond_mapping_24_26($_) } category2modules($storage_modules{$live->{media}{storage}})); + uniq(map { modules::cond_mapping_24_26($_) } category2modules($storage{$live->{media}{storage}}{modules})); my ($extra_modules, $missing) = partition { exists $moddeps{$_} } nls_modules($live), $live->{media}{fs}, @@ -469,32 +474,41 @@ sub prepare_bootloader { } sub create_master { - warn "not implemented yet"; + my ($live) = @_; + if (my $create = $storage{$live->{media}{storage}}{create}) { + $create->($live, $o_refresh_boot_only); + } else { + warn "not implemented yet"; + } } -sub record_master { +sub record_usb_master { my ($live, $o_refresh_boot_only) = @_; - if ($live->{media}{storage} eq 'usb') { - my $label = get_media_label($live); - if ($live->{media}{device} && $label) { - run_('mkdosfs', '-n', $label, $live->{media}{device}) - or die "unable to format device $live->{media}{device}"; - } - my $device = get_media_device($live); - mkdir_p($live->{mnt}); - run_('mount', $device, $live->{mnt}) - or die "unable to mount $device"; - cp_f(glob($live->{boot_dir} . '/*'), $live->{mnt}); - output($live->{mnt} . '/syslinux.cfg', build_syslinux_cfg($live)); - unless ($o_refresh_boot_only) { - foreach (grep { $_->{build_from} || $_->{pre_allocate} } @{$live->{mount}{dirs} || []}) { - print "copying $_->{source}\n"; - cp_f($live->{images_dir} . '/' . $_->{source}, $live->{mnt}); - } + my $label = get_media_label($live); + if ($live->{media}{device} && $label) { + run_('mkdosfs', '-n', $label, $live->{media}{device}) + or die "unable to format device $live->{media}{device}"; + } + my $device = get_media_device($live); + mkdir_p($live->{mnt}); + run_('mount', $device, $live->{mnt}) + or die "unable to mount $device"; + cp_f(map { $live->{boot_dir} . "/$_" } qw(vmlinuz initrd.gz live.msg), $live->{mnt}); + unless ($o_refresh_boot_only) { + foreach (grep { $_->{build_from} || $_->{pre_allocate} } @{$live->{mount}{dirs} || []}) { + print "copying $_->{source}\n"; + cp_f($live->{images_dir} . '/' . $_->{source}, $live->{mnt}); } - run_('umount', $live->{mnt}); - #- use syslinux -s, "safe, slow and stupid" version of SYSLINUX - run_('syslinux', '-s', $device) or die "unable to run syslinux on $device"; + } + run_('umount', $live->{mnt}); + #- use syslinux -s, "safe, slow and stupid" version of SYSLINUX + run_('syslinux', '-s', $device) or die "unable to run syslinux on $device"; +} + +sub record_master { + my ($live, $o_refresh_boot_only) = @_; + if (my $record = $storage{$live->{media}{storage}}{record}) { + $record->($live, $o_refresh_boot_only); } else { warn "not implemented yet"; } @@ -502,7 +516,7 @@ sub record_master { sub record_boot { my ($live) = @_; - record_master($live, 1); + record_master($live, 'refresh'); } sub complete_config { |