From 1a85388037d45ec77bd873efd3245c413c131f94 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 30 Aug 2010 16:44:18 +0000 Subject: handle recording CD-Rom images on both CD-Rom and disks, since they are hybrid --- draklive | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'draklive') 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 { -- cgit v1.2.1