From 4e68ce05ed6e0ac30d8af4a70978df70c652693d Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 25 Sep 2007 14:05:50 +0000 Subject: add newlines in die messages, not to trigger the infamous drakbug --- draklive | 58 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/draklive b/draklive index 85f90f6..6a94a6b 100755 --- a/draklive +++ b/draklive @@ -223,7 +223,7 @@ my %loop = ( 'mksquashfs', $src, $dest, '-noappend', '-no-progress', '-info', '-ef', $exclude_file, if_(-f $sort, '-sort', $sort), - ) or die "unable to run mksquashfs"; + ) or die "unable to run mksquashfs\n""; progress_end(); unlink $exclude_file; }, @@ -374,7 +374,7 @@ sub find_kernel { unless ($kernel) { my $vmlinuz = readlink(get_system_root($live) . '/boot/vmlinuz'); $vmlinuz ||= find { -e $_ && ! -l $_ } glob_(get_system_root($live) . '/boot/vmlinuz-*'); - ($kernel) = $vmlinuz =~ /\bvmlinuz-(.*)$/ or die "no kernel can be found"; + ($kernel) = $vmlinuz =~ /\bvmlinuz-(.*)$/ or die "no kernel can be found\n"; } $kernel; } @@ -404,7 +404,7 @@ sub create_initrd_for_media { last; } } - $lib_prefix or die 'unable to find system libraries in /lib or /lib64'; + $lib_prefix or die "unable to find system libraries in /lib or /lib64\n"; mkdir_p($initrd_tree . $_) foreach qw(/bin /dev /proc /sys), $lib_prefix, @@ -421,7 +421,7 @@ sub create_initrd_for_media { #- mount loopbacks read-only with losetup (useful over NFS) my $busybox = get_system_root($live) . '/usr/bin/busybox'; cp_f($busybox, $initrd_tree . '/bin') - or die 'unable to copy busybox from system chroot'; + or die "unable to copy busybox from system chroot\n"; my @l = map { /functions:/ .. /^$/ ? do { s/\s//g; split /,/ } : () } `$busybox`; shift @l; symlink('busybox', $initrd_tree . "/bin/$_") foreach @l; @@ -430,7 +430,7 @@ sub create_initrd_for_media { if ($rrpt_dev) { $need_libs = 1; cp_f(get_system_root($live) . '/sbin/blockdev', $initrd_tree . '/bin') - or die 'unable to copy blockdev from system chroot'; + or die "unable to copy blockdev from system chroot\n"; } my $fs = get_media_setting($media, 'fs'); @@ -662,7 +662,7 @@ sub install_system { my $local_drakx_in_chroot = get_builddir($live) . $live->{prefix}{build}{scripts} . '/drakx-in-chroot'; mkdir_p(dirname($local_drakx_in_chroot)); run_('curl', '--silent', '-o', $local_drakx_in_chroot, $drakx_in_chroot) - or die "unable to get drakx-in-chroot from remote repository"; + or die "unable to get drakx-in-chroot from remote repository\n"; $drakx_in_chroot = $local_drakx_in_chroot; } @@ -677,7 +677,7 @@ sub install_system { if_($live->{system}{patch_install}, '--defcfg', $live->{settings}{config_root} . '/' . $live->{system}{patch_install}), if_($live->{system}{rpmsrate}, '--rpmsrate', $live->{settings}{config_root} . '/' . $live->{system}{rpmsrate}), ($live->{system}{stage2_updates} ? (map { ('--stage2-update', $live->{settings}{config_root} . '/' . $_->[0], $_->[1]) } @{$live->{system}{stage2_updates}}) : ()), - ) or die "unable to install system chroot"; + ) or die "unable to install system chroot\n"; post_install_system($live); } @@ -726,11 +726,11 @@ sub post_install_system { foreach (@{$live->{system}{additional_media}}) { run_({ root => get_system_root($live) }, 'urpmi.addmedia', if_($_->{distrib}, '--distrib'), $_->{name}, $_->{path}) - or die "unable to add media from $_->{path}"; + or die "unable to add media from $_->{path}\n"; @{$_->{packages}} or next; run_({ root => get_system_root($live), setarch => $live->{settings}{arch} }, 'urpmi', '--auto', '--no-verify-rpm', if_(!$_->{distrib}, '--searchmedia', $_->{name}), @{$_->{packages}}) - or die "unable to install packages from $_->{path}"; + or die "unable to install packages from $_->{path}\n"; } #- additional rpms may have dependencies in additional media @@ -741,7 +741,7 @@ sub post_install_system { run_({ root => get_system_root($live), setarch => $live->{settings}{arch} }, 'urpmi', '--auto', '--no-verify-rpm', map { $rpm_tmp_dir . '/' . basename($_) } @{$live->{system}{rpms}}) - or die "unable to install additional system rpms"; + or die "unable to install additional system rpms\n"; rm_rf(get_system_root($live) . $rpm_tmp_dir); } @@ -789,7 +789,7 @@ sub post_install_system { my $patch = $live->{settings}{config_root} . '/' . $_; my @args = ('-p0', '-d', get_system_root($live), '-i', $patch); run_program::run('patch', '>', '/dev/null', '--dry-run', '-f', '-R', @args) || run_('patch', @args) - or die "unable to apply patch " . $patch; + or die "unable to apply patch " . $patch . "\n"; } copy_files_to($live, $live->{system}{files}, get_system_root($live)); @@ -934,7 +934,7 @@ sub get_media_device { return $opts->{device} if $opts->{device}; my $label = get_media_label($live->{media}) or return get_media_setting($live->{media}, 'source'); my $device = chomp_(`readlink -f /dev/disk/by-label/$label`) - or die "unable to find device for /dev/disk/by-label/$label"; + or die "unable to find device for /dev/disk/by-label/$label\n"; $device; } @@ -1004,7 +1004,7 @@ sub device_mkfs { } elsif (member($type, 'ext2', 'ext3')) { run_("mkfs.$type", "-m", 0, if_(!-b $device, '-F'), $device); } else { - die "unable to mkfs for unsupported media type $type"; + die "unable to mkfs for unsupported media type $type\n"; } } @@ -1015,7 +1015,7 @@ sub set_device_label { } elsif (member($type, 'ext2', 'ext3')) { run_('e2label', $device, $label); } else { - die "unable to set label for unsupported media type $type"; + die "unable to set label for unsupported media type $type\n"; } } @@ -1026,7 +1026,7 @@ sub get_cdrom_master_path { sub create_cdrom_master { my ($live, $opts) = @_; - my $label = get_media_label($live->{media}) or die "the source device must be described by a label"; + my $label = get_media_label($live->{media}) or die "the source device must be described by a label\n"; my $dest; unless ($opts->{onthefly}) { $dest = get_cdrom_master_path($live, $opts); @@ -1056,7 +1056,7 @@ sub create_cdrom_master { } all(get_builddir($live) . $live->{prefix}{build}{files}) ), ), - ) or die "unable to run genisoimage"; + ) or die "unable to run genisoimage\n"; run_('mkcd', '--addmd5', $dest) if $dest; } @@ -1074,7 +1074,7 @@ sub create_usb_master { directory_usage(get_builddir($live) . $live->{prefix}{build}{boot}); device_allocate_fs($dest, $size); device_mkfs($dest, get_media_setting($live->{media}, 'fs')) - or die "unable to format $dest"; + or die "unable to format $dest\n"; local $opts->{device} = $dest; record_usb_master($live, $opts); } @@ -1107,7 +1107,7 @@ sub format_usb_device { my $device = get_media_device($live, $opts); maybe_umount_device($device); device_mkfs($device, get_media_setting($live->{media}, 'fs')) - or die "unable to format device $device"; + or die "unable to format device $device\n"; } #- $opts: @@ -1115,7 +1115,7 @@ sub format_usb_device { sub format_device { my ($live, $opts) = @_; - get_media_device($live, $opts) or die "no device defined in media configuration"; + get_media_device($live, $opts) or die "no device defined in media configuration\n"; if (my $format = get_boot_setting($live->{media}, 'format', $opts)) { $format->($live, $opts); } else { @@ -1126,7 +1126,7 @@ sub format_device { sub record_cdrom_master { my ($live, $opts) = @_; my $device = get_media_device($live, $opts) - or die "no device defined in media configuration"; + or die "no device defined in media configuration\n"; my $src = $opts->{onthefly} ? '-' : get_cdrom_master_path($live, $opts); run_('wodim', '-v', 'dev=' . $device, $src); } @@ -1138,12 +1138,12 @@ sub record_usb_master { set_device_label($opts->{device}, get_media_setting($media, 'fs'), $label); } my $device = get_media_device($live, $opts) - or die "unable to find recording device (missing label? try with --device )"; + or die "unable to find recording device (missing label? try with --device )\n"; my $bootloader = get_boot_setting($media, 'bootloader', $opts); - member($bootloader, 'grub', 'syslinux') or die "no bootloader defined in media configuration"; + member($bootloader, 'grub', 'syslinux') or die "no bootloader defined in media configuration\n"; mkdir_p($live->{mnt}); run_('mount', if_(-f $device, '-o', 'loop'), $device, $live->{mnt}) - or die "unable to mount $device"; + or die "unable to mount $device\n"; rm_rf($live->{mnt} . $live->{prefix}{media}{boot}) if -e $live->{mnt} . $live->{prefix}{media}{boot}; cp_af(get_builddir($live) . $live->{prefix}{build}{boot}, $live->{mnt} . $live->{prefix}{media}{boot}); @@ -1165,7 +1165,7 @@ sub record_usb_master { if ($bootloader eq 'syslinux') { #- use syslinux -s, "safe, slow and stupid" version of SYSLINUX, unless specified otherwise run_('syslinux', if_(!$media->{fast_syslinux}, '-s'), $device) - or die "unable to run syslinux on $device"; + or die "unable to run syslinux on $device\n"; } elsif ($bootloader eq 'grub') { my $local_grub_install = get_builddir($live) . $live->{prefix}{build}{scripts} . '/grub-install'; mkdir_p(dirname($local_grub_install)); @@ -1181,7 +1181,7 @@ sub record_usb_master { $master_device =~ s/(\d+)$//; foreach ($master_device, $device) { run_($local_grub_install, '--root-directory=' . $live->{mnt}, '--no-floppy', $_) - or die "unable to run grub on $device"; + or die "unable to run grub on $device\n"; } unlink $grub_device_map; } @@ -1209,7 +1209,7 @@ sub record_usb_master { } : sub {}, 'rsync', '-vdP', '--inplace', '--files-from=' . $list_file, $loopbacks_source, $live->{mnt} . $live->{prefix}{media}{loopbacks}) - or die "unable to copy loopback files"; + or die "unable to copy loopback files\n"; unlink $list_file; cp_af(glob_(get_builddir($live) . $live->{prefix}{build}{files} . '/*'), $live->{mnt}); @@ -1420,7 +1420,7 @@ sub read_config { add2hash($live->{settings} ||= {}, { getVarsFromSh($config_root . '/' . $settings_path) }) if $settings_path; if ($config_path) { #- don't use do(), since it can't see lexicals in the enclosing scope - my $cfg = eval(cat_($config_root . '/' . $config_path)) or die "unable to load $config_path: $@"; + my $cfg = eval(cat_($config_root . '/' . $config_path)) or die "unable to load $config_path: $@\n"; put_in_hash($live, $cfg); print "loaded $config_path as config file\n"; } @@ -1434,8 +1434,8 @@ sub check_config { Pod::Usage::pod2usage(); } #- check for minimum requirements - ref $live->{media} && $live->{media}{storage} or die "no media storage definition"; - ref $live->{system} or die "no system definition"; + ref $live->{media} && $live->{media}{storage} or die "no media storage definition\n"; + ref $live->{system} or die "no system definition\n"; } sub complete_config { -- cgit v1.2.1