1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#!/usr/bin/perl
use Debconf::Client::ConfModule qw(:all);
use File::Temp qw/ tempfile /;
use strict;
use warnings;
use vars qw / $username $cfile $workdir $aptagent $sources $suite
$primary $noprimary $file $src @packageslist @sourcelist @ours /;
$cfile = "/etc/emsource.conf";
$sources = "/etc/apt/sources.list.d/emdebian.sources.list";
version("2.0");
my $capb=capb("backup");
die ("postinst called with unknown argument.") if !$ARGV[0];
if ($ARGV[0] eq "configure")
{
$username = get("emsource/svnusername");
$aptagent = get("emsetup/aptagent");
$primary = get("emsetup/primary");
$suite = get("emsource/targetsuite");
(my $fh,$file) = tempfile();
# despite using ucf, we can't rely on md5sums across different configurations
# because the content of the file is autogenerated, not just the file itself.
# this does make for a few more warnings from ucf than otherwise but that is
# the price of preserving user changes.
open (CFILE, ">>$file") or die "Unable to create $file: $!\n";
print CFILE "\# config file for emsource, part of emdebian-tools.\n";
print CFILE "\# /etc/emsource.conf is maintained by debconf.\n";
print CFILE "\# see emsource (1) for more information\n";
print CFILE "\# \n";
print CFILE "username: $username\n";
print CFILE "aptagent: $aptagent\n";
print CFILE "primary: $primary\n";
print CFILE "targetsuite: $suite\n";
close (CFILE);
system ("ucf --debconf-ok $file $cfile");
system ("ucfr emdebian-tools $cfile");
unlink ($file);
chmod (0644, $cfile);
open(SOURCES, ">$file") or die "Unable to create $sources: $!\n";
print SOURCES "\# The Emdebian toolchain repository\n";
print SOURCES "deb http://www.emdebian.org/debian/ $suite main\n";
print SOURCES "deb-src http://www.emdebian.org/debian/ $suite main\n";
close (SOURCES);
chmod (0644, $file);
system ("ucf --debconf-ok $file $sources");
system ("ucfr emdebian-tools $sources");
unlink ($file);
stop;
}
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
|