aboutsummaryrefslogtreecommitdiffstats
path: root/BCD/Genisoimage.pm
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2010-10-06 07:58:18 +0000
committerAntoine Ginies <aginies@mandriva.com>2010-10-06 07:58:18 +0000
commitb364785ea90e60806aaaec56d15bcc70a74daf6d (patch)
treeda257e1277bd0218929f12fde2e318657067eb16 /BCD/Genisoimage.pm
parent46324a3fd9b86040b16dc3070b3a22438f7a616d (diff)
downloadbcd-b364785ea90e60806aaaec56d15bcc70a74daf6d.tar
bcd-b364785ea90e60806aaaec56d15bcc70a74daf6d.tar.gz
bcd-b364785ea90e60806aaaec56d15bcc70a74daf6d.tar.bz2
bcd-b364785ea90e60806aaaec56d15bcc70a74daf6d.tar.xz
bcd-b364785ea90e60806aaaec56d15bcc70a74daf6d.zip
end of the move
Diffstat (limited to 'BCD/Genisoimage.pm')
-rw-r--r--BCD/Genisoimage.pm123
1 files changed, 123 insertions, 0 deletions
diff --git a/BCD/Genisoimage.pm b/BCD/Genisoimage.pm
new file mode 100644
index 0000000..7dba9b1
--- /dev/null
+++ b/BCD/Genisoimage.pm
@@ -0,0 +1,123 @@
+package BCD::Genisoimage;
+
+use strict;
+use XML::Simple;
+use BCD::Common qw(:DEFAULT $isoconf $wd $name $arch $version $builddir $isodir $error_color $repo $based_on);
+
+our @ISA = qw(Exporter);
+our @EXPORT = qw(main_iso);
+our @EXPORT_OK = qw($isoname);
+
+my $LOG="GENISOIMAGE -";
+my $color = "green";
+
+# mandriva-linux-free-2009.1-i586
+our $isoname = $isoconf->{nameid} . '-' . $isoconf->{mediainfo}{version} . '-' . $isoconf->{arch};
+
+# genisoimage -f -sort /home/plop/tmp/build/2009.1/11.sort -r -J -hide-rr-moved -nobak -cache-inodes -A "Mandriva Linux - 2009 Spring (Free64)" -publisher "Mandriva" -sysid "Mandriva Linux" -p "Mandriva-Linux" -volset "Mandriva Linux - 2009 Spring (Free64) - DVD x86_64 [1/1]" -V "Free-20091-x86_64" -o /home/plop/iso/2009.1/11-2009.1.iso -b x86_64/isolinux/isolinux.bin -c x86_64/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "/home/plop/build/2009.1/first/11" /home/plop/build/2009.1/11
+
+
+sub create_version {
+ # create the VERSION file available on the base of the ISO
+ my $version_file = "$builddir/VERSION";
+ print_color("$LOG create the $version_file file", $color);
+ open my $VERSION, ">$version_file";
+ my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = gmtime(time());
+ $year += 1900;
+ my $tag = $isoconf->{iso}{tag};
+ my $product = $isoconf->{iso}{product};
+ my $publisher = $isoconf->{iso}{header}{publisherid};
+ printf $VERSION "$publisher $name $tag %04d%02d%02d $hour:%02d\n", $year, $mon+1, $mday, $min;
+ close $VERSION;
+}
+
+sub create_productid {
+ # vendor=Mandriva,distribution=Mandriva Linux,type=basic,version=2009.1,branch=cooker,release=0.1,arch=i586,product=maratangua
+ print_color("$LOG create the $builddir/product.id", $color);
+ my $productid_file = "$builddir/product.id";
+ open my $product_id, ">$productid_file";
+ print $product_id "vendor=$isoconf->{iso}{header}{publisherid},";
+ print $product_id "distribution=$isoconf->{iso}{header}{systemid},";
+ print $product_id "type=$isoconf->{iso}{type},";
+ print $product_id "version=$isoconf->{based_on},";
+ print $product_id "branch=$isoconf->{iso}{branch},";
+ print $product_id "release=$isoconf->{iso}{minor}.$isoconf->{iso}{subversion},";
+ print $product_id "arch=$arch,";
+ print $product_id "product=$isoconf->{iso}{product}";
+ close $product_id;
+}
+
+sub create_idx {
+ print_color("$LOG create the IDX file from $builddir/pkg-$version-$isoconf->{iso}{tag}.idx", $color);
+ # pkg-2009.1-pauillac.idx
+ system("find $builddir -name \*.rpm | awk -F 'media/' {'print \"$isoconf->{iso}{header}{volumeid} \" \$2'} | sed -e 's/\.rpm\$//g' | sort > $builddir/pkg-$version-$isoconf->{iso}{tag}.idx");
+ system("cp -v $builddir/pkg-$version-$isoconf->{iso}{tag}.idx $isodir/$isoname.idx");
+}
+
+sub create_iso {
+ # build the ISO with all args
+ print_color("$LOG Building the ISO", $color);
+ my $cmd = "genisoimage $isoconf->{iso}{genisoimage}{options} \\
+-A '$isoconf->{iso}{header}{applicationid}' \\
+-publisher '$isoconf->{iso}{header}{publisherid}' \\
+-sysid '$isoconf->{iso}{header}{systemid}' \\
+-p '$isoconf->{iso}{header}{datapreparer}' \\
+-volset '$isoconf->{iso}{header}{volumesetid}' \\
+-V '$isoconf->{iso}{header}{volumeid}' \\
+-o '$isodir/$isoname.iso' \\
+-b $arch/isolinux/isolinux.bin \\
+-boot-info-table \\
+$builddir/../
+";
+#-quiet \\
+ print_color("\n------------\n $cmd", $color);
+ system($cmd);
+ system("du -h $isodir/$isoname.iso");
+ system("du -sh $builddir/install");
+
+}
+
+sub create_md5 {
+ # create the MD5 of the ISO
+ print_color("$LOG Create the MD5 and SHA1 of the ISO", $color);
+ my $ISOFILE = "$isodir/$isoname.iso";
+ if (! -f $ISOFILE) {
+ print_color("$LOG can't find $ISOFILE", $error_color);
+ exit 1;
+ } else {
+ print_color("$LOG do a: md5sum $ISOFILE > $ISOFILE.md5", $color);
+ system("cd $isodir && md5sum $isoname.iso > $ISOFILE.md5 &");
+ print_color("$LOG do a: sha1sum $ISOFILE > $ISOFILE.sha1", $color);
+ system("cd $isodir && sha1sum $isoname.iso > $ISOFILE.sha1 &");
+ }
+}
+
+sub isohybrid {
+ print_color("$LOG isohybrid the ISO", $color);
+ my $ISOFILE = "$isodir/$isoname.iso";
+ system("isohybrid -fatfirst $ISOFILE") == 0 or die "$LOG system isohybrid failed: $?\n";
+}
+
+sub copy_textfiles {
+ map { system("cp -vf $repo/$based_on/$arch/$_ $builddir/");
+ } qw(COPYING INSTALL.txt install.htm LICENSE.txt LICENSE-APPS.txt README.txt index.htm release-notes.html release-notes.txt);
+}
+
+sub main_iso {
+ my ($option) = @_;
+ create_version;
+ create_productid;
+ copy_textfiles;
+ create_idx;
+ if ($option =~ /noiso/) {
+ print_color("$LOG skipping ISO creation", $color);
+ } else {
+ create_iso;
+ isohybrid;
+ create_md5;
+ }
+
+}
+
+1;
+