зеркало из https://github.com/mozilla/pjs.git
405704 Support "--format UDBZ" in pkg-dmg. r=mnyromyr a/1.9=dsicore
This commit is contained in:
Родитель
fbf5db5dc1
Коммит
1975174417
|
@ -92,6 +92,8 @@ See B<--format>.
|
|||
|
||||
The format to create the disk image in. Valid values for I<format> are:
|
||||
- UDZO - zlib-compressed, read-only; extension I<.dmg>
|
||||
- UDBZ - bzip2-compressed, read-only; extension I<.dmg>;
|
||||
create and use on 10.4 ("Tiger") and later only
|
||||
- UDRW - read-write; extension I<.dmg>
|
||||
- UDSP - read-write, sparse; extension I<.sparseimage>
|
||||
|
||||
|
@ -141,8 +143,8 @@ or to use formatted text, prepare a resource and use L<--resource>.
|
|||
|
||||
=item B<--resource> I<file>
|
||||
|
||||
A resource file to merge into I<target-image>. If I<format> is UDZO,
|
||||
the disk image will be flattened to a single-fork file that contains
|
||||
A resource file to merge into I<target-image>. If I<format> is UDZO or
|
||||
UDBZ, the disk image will be flattened to a single-fork file that contains
|
||||
the resource but may be freely transferred without any special encodings.
|
||||
I<file> must be in a format suitable for L<Rez(1)>. See L<Rez(1)> for a
|
||||
description of the format, and L<hdiutil(1)> for a discussion on flattened
|
||||
|
@ -273,6 +275,7 @@ sub commandVerbosity($@);
|
|||
sub diskImageMaker($$$$$$$$);
|
||||
sub giveExtension($$);
|
||||
sub hdidMountImage($@);
|
||||
sub isFormatCompressed($);
|
||||
sub licenseMaker($$);
|
||||
sub pathSplit($);
|
||||
sub setAttributes($@);
|
||||
|
@ -605,7 +608,7 @@ if(defined($iconFile)) {
|
|||
# It's pointless to set the attributes of the root when diskutil create
|
||||
# -srcfolder is being used. In that case, the attributes will be set
|
||||
# later, after the image is already created.
|
||||
if($outputFormat eq 'UDZO' &&
|
||||
if(isFormatCompressed($outputFormat) &&
|
||||
(command($gConfig{'cmd_SetFile'}, '-a', 'C', $tempRoot) != 0)) {
|
||||
cleanupDie('SetFile failed');
|
||||
}
|
||||
|
@ -617,7 +620,7 @@ if(command($gConfig{'cmd_chmod'}, '-R', 'a+rX,a-st,u+w,go-w',
|
|||
}
|
||||
|
||||
my($unflattenable);
|
||||
if($outputFormat eq 'UDZO') {
|
||||
if(isFormatCompressed($outputFormat)) {
|
||||
$unflattenable = 1;
|
||||
}
|
||||
else {
|
||||
|
@ -865,7 +868,7 @@ sub diskImageMaker($$$$$$$$) {
|
|||
$tempDir, $tempMount);
|
||||
($source, $destination, $format, $name, $tempDir, $tempMount,
|
||||
$baseName, $setRootIcon) = @_;
|
||||
if($format eq 'UDZO') {
|
||||
if(isFormatCompressed($format)) {
|
||||
my($uncompressedImage);
|
||||
|
||||
if($gConfig{'makehybrid'}) {
|
||||
|
@ -942,10 +945,11 @@ sub diskImageMaker($$$$$$$$) {
|
|||
}
|
||||
else {
|
||||
# makehybrid is not available, fall back to making a UDRW and
|
||||
# converting to UDZO. It ought to be possible to do a UDZO directly,
|
||||
# but those come out far too large (journaling?) and need to be
|
||||
# read-write to fix up the volume icon anyway. Luckily, we can
|
||||
# take advantage of a single call back into this function.
|
||||
# converting to a compressed image. It ought to be possible to
|
||||
# create a compressed image directly, but those come out far too
|
||||
# large (journaling?) and need to be read-write to fix up the
|
||||
# volume icon anyway. Luckily, we can take advantage of a single
|
||||
# call back into this function.
|
||||
my($udrwImage);
|
||||
$udrwImage = giveExtension($tempDir.'/udrw', '.dmg');
|
||||
|
||||
|
@ -960,8 +964,12 @@ sub diskImageMaker($$$$$$$$) {
|
|||
# The uncompressed disk image is now in its final form. Compress it.
|
||||
# Jaguar doesn't support hdiutil convert -ov, but it always allows
|
||||
# overwriting.
|
||||
if(command($gConfig{'cmd_hdiutil'}, 'convert', '-format', 'UDZO',
|
||||
'-imagekey', 'zlib-level=9',
|
||||
# bzip2-compressed UDBZ images can only be created and mounted on 10.4
|
||||
# and later. The bzip2-level imagekey is only effective when creating
|
||||
# images in 10.5. In 10.4, bzip2-level is harmlessly ignored, and the
|
||||
# default value of 1 is always used.
|
||||
if(command($gConfig{'cmd_hdiutil'}, 'convert', '-format', $format,
|
||||
'-imagekey', ($format eq 'UDBZ' ? 'bzip2-level=9' : 'zlib-level=9'),
|
||||
(defined($gDarwinMajor) && $gDarwinMajor <= 6 ? () : ('-ov')),
|
||||
$uncompressedImage, '-o', $destination) != 0) {
|
||||
cleanupDie('hdiutil convert failed');
|
||||
|
@ -976,8 +984,8 @@ sub diskImageMaker($$$$$$$$) {
|
|||
cleanupDie('unlink uncompressedImage failed: '.$!);
|
||||
}
|
||||
|
||||
# At this point, the only thing that the UDZO block has added to the
|
||||
# cleanup stack is the removal of $destination. $source has already
|
||||
# At this point, the only thing that the compressed block has added to
|
||||
# the cleanup stack is the removal of $destination. $source has already
|
||||
# been removed, and its cleanup entry has been removed as well.
|
||||
}
|
||||
elsif($format eq 'UDRW' || $format eq 'UDSP') {
|
||||
|
@ -1247,6 +1255,16 @@ sub hdidMountImage($@) {
|
|||
return undef;
|
||||
}
|
||||
|
||||
# isFormatCompressed($format)
|
||||
#
|
||||
# Returns true if $format corresponds to a compressed disk image format.
|
||||
# Returns false otherwise.
|
||||
sub isFormatCompressed($) {
|
||||
my($format);
|
||||
($format) = @_;
|
||||
return $format eq 'UDZO' || $format eq 'UDBZ';
|
||||
}
|
||||
|
||||
# licenseMaker($text, $resource)
|
||||
#
|
||||
# Takes a plain text file at path $text and creates a license agreement
|
||||
|
|
Загрузка…
Ссылка в новой задаче