#!/usr/bin/perl -w use strict; use warnings; use POSIX qw/strftime/; # SOME VALUES # ISOS LIST TO BUILD my %isosToMake = ( escriptori => "/etc/lliurex-live-builder/llx1206/lliurex-live.conf.edu-gdesktop", servidor => "/etc/lliurex-live-builder/llx1206/lliurex-live.conf.edu-class-gserver", client => "/etc/lliurex-live-builder/llx1206/lliurex-live.conf.edu-class-gclient", infantil => "/etc/lliurex-live-builder/llx1206/lliurex-live.conf.edu-infantil-gdesktop", biblioteca => "/etc/lliurex-live-builder/llx1206/lliurex-live.conf.edu-biblio-gserver", pime => "/etc/lliurex-live-builder/llx1206/lliurex-live.conf.pime-gdesktop", musica => "/etc/lliurex-live-builder/llx1206/lliurex-live.conf.edu-music-gdesktop", lleuger => "/etc/lliurex-live-builder/llx1206/lliurex-live.conf.lxdesktop", ); my $workDir = "/graveyard/"; my $homeDirectory = $ENV{"HOME"}."/isoMaker/"; my $destFolder = $homeDirectory.strftime('%Y_%B_%d', localtime)."/"; my $isoDateTime = strftime('%Y%m%d', localtime); my $configFile = "lliurex-live.conf"; sub sanityChecks { unless ( -d $destFolder ) { `mkdir -p $destFolder`; } unless ( -d $workDir ) { `mkdir -p $workDir`; } } sub goToWorkDir { chdir ($workDir ) or die "No puedo ir a $workDir $!"; } sub cleanWorkDir { `echo "Y" | lliurex-live clean all`; `echo "Y" | lliurex-live clean all`; } sub prepareConfigFile { open INPUTFILE, "<", $_[0] or die $!; open OUTPUTFILE , ">", $configFile or die $!; while () { $_ =~ s/LH_INTERACTIVE=\"shell\"/LH_INTERACTIVE=\"disabled\"/g; print OUTPUTFILE $_; } close INPUTFILE; close OUTPUTFILE; } sub lliurexLiveConfigure { `lliurex-live configure`; } sub lliurexLiveBuild { `lliurex-live build`; } sub moveBinary { my $localSabor = $_[0]; goToWorkDir(); my $localIsoName = "lliurex-$localSabor"."_1206_$isoDateTime.iso\n"; `mv binary.iso $destFolder$localIsoName`; } # Main Program print "La carpeta destino es : $destFolder \n"; sanityChecks(); goToWorkDir(); foreach my $sabor(keys %isosToMake) { print "Creando ... $sabor con $isosToMake{$sabor}\n"; goToWorkDir(); cleanWorkDir(); prepareConfigFile($isosToMake{$sabor}); while ( ! -e "binary.iso") { cleanWorkDir(); lliurexLiveConfigure(); lliurexLiveBuild(); } moveBinary($sabor); }