Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
89 lines (74 sloc) 1.71 KB
#
# This policy is designed to setup a building-host via pbuilder.
#
#
use File::Path qw(make_path);
#
# First of all install the package(s).
#
foreach my $package (qw! pbuilder debootstrap !)
{
if ( !PackageInstalled( Package => $package ) )
{
InstallPackage( Package => $package );
}
}
#
# For each distribution
#
foreach my $dist (qw! jessie squeeze wheezy !)
{
#
# We want i386 & AMD64.
#
foreach my $arch (qw! amd64 i386 !)
{
#
# The created .tar.gz file
#
my $base = "/var/cache/pbuilder/$dist-$arch.tgz";
#
# If the base is missing then create it
#
if ( !-e $base )
{
print "Creating $base - This will take a while\n";
my $cmd =
"pbuilder create --distribution $dist --architecture $arch --basetgz $base";
RunCommand( Cmd => $cmd );
}
}
}
#
# Ensure we have our build-script deployed too.
#
if ( ! -d "/root/bin-builder" )
{
#
# Make the directory
#
mkpath( "/root/bin-builder", { verbose => 0, mode => 0755 } );
}
#
# Deploy the auto-builder script.
#
FetchFile( Source => "/roles/builder/build",
Dest => "/root/bin-builder/build",
Owner => "root",
Group => "root",
Mode => "755",
Expand => "false",
);
#
# Finally deploy a script to ensure that we have current pbuilder images.
#
FetchFile( Source => "/roles/builder/pbuild-update",
Dest => "/etc/cron.monthly/pbuild-update",
Owner => "root",
Group => "root",
Mode => "755",
Expand => "false",
);
# Local Variables:
# mode: cperl
# End: