summaryrefslogtreecommitdiffstats
path: root/draklive
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2010-08-30 16:44:18 +0000
committerOlivier Blin <oblin@mandriva.com>2010-08-30 16:44:18 +0000
commit1a85388037d45ec77bd873efd3245c413c131f94 (patch)
tree17caac0144b8c49f8c3522550a55eaaa0a6d46d9 /draklive
parent71c0f098c0701b8ab3d6d4ebd1b337b1c8fd3d82 (diff)
downloaddrakiso-1a85388037d45ec77bd873efd3245c413c131f94.tar
drakiso-1a85388037d45ec77bd873efd3245c413c131f94.tar.gz
drakiso-1a85388037d45ec77bd873efd3245c413c131f94.tar.bz2
drakiso-1a85388037d45ec77bd873efd3245c413c131f94.tar.xz
drakiso-1a85388037d45ec77bd873efd3245c413c131f94.zip
handle recording CD-Rom images on both CD-Rom and disks, since they are hybrid
Diffstat (limited to 'draklive')
-rwxr-xr-xdraklive15
1 files changed, 13 insertions, 2 deletions
diff --git a/draklive b/draklive
index 0e1c55a..97e5f05 100755
--- a/draklive
+++ b/draklive
@@ -914,8 +914,19 @@ sub record_cdrom_path {
my ($live, $path, $opts) = @_;
my $device = get_media_device($live, $opts)
or die "no device defined in media configuration\n";
- my $src = $opts->{onthefly} ? '-' : $path;
- run_('wodim', '-v', 'dev=' . $device, $src);
+
+ #- CD-Rom images can be hybrid, thus handle recording on both CD-Rom and disks
+ my $_device = basename(expand_symlinks($device));
+ my $sysfs_device = "/sys/block/$_device/capability";
+ #- GENHD_FL_CD is 8 (include/linux/genhd.h)
+ my $is_cdrom = !-e $sysfs_device || hex(cat_($sysfs_device)) & 8;
+
+ if ($is_cdrom) {
+ my $src = $opts->{onthefly} ? '-' : $path;
+ run_('wodim', '-v', 'dev=' . $device, $src);
+ } else {
+ run_('dd', if_(!$opts->{onthefly}, "if=$path"), "of=$device", "bs=2M");
+ }
}
sub record_cdrom_master {