#!/usr/bin/perl -w

package PVE_SQUEEZE_UPDATER;

# Copyright (C) 2012 Proxmox Server Solutions GmbH

# upgrade instructions:
# see http://pve.proxmox.com/wiki/Upgrade_from_1.9_to_2.0

use strict;
use IO::File;
use IO::Select;
use IPC::Open3;
use Getopt::Long;
use File::Basename;

my $oldpvedir = "/etc/pve.old-1.9";
my $newpvedir = "/etc/pve";

my $oldvzdir = "/etc/vz/conf.old-1.9";
my $newvzdir = "/etc/pve/openvz";

my $oldqmdir = "/etc/qemu-server.old-1.9";
my $newqmdir = "/etc/pve/qemu-server";

my $opt_purge;
my $opt_import;

$ENV{LC_ALL} = 'C';

$ENV{DEBIAN_FRONTEND} = 'noninteractive';

if (!GetOptions("purge" => \$opt_purge, "import" => \$opt_import)) {
    print STDERR "usage: $0 [--purge] [--import]\n";
    exit -1;
}

sub read_old_qm_conf {
    my ($filename) = @_;

    my $fh = IO::File->new($filename, "r") ||
	die "can't open '$filename' - $!\n";

    my $data = '';

    my $pciId = 0;
    my $netId = 0;
    my $usbId = 0;
    my $serialId = 0;
    my $parallelId = 0;

    while (defined(my $line = <$fh>)) {
	chomp $line;
	if ($line =~ m/^vlan(\d+):\s*(\S+)\s*/) {
	    my $bridgeId = $1;
	    my $value = $2;
	    foreach my $nic (split (/,/, $value)) {
		$data .= "net$netId: $nic,bridge=vmbr$bridgeId\n";
		$netId++;
	    }
	} elsif ($line =~ m/^vlanu:\s*(\S+)\s*/) {
	    my $value = $1;
	    foreach my $nic (split (/,/, $value)) {
		$data .= "net$netId: $nic\n";
		$netId++;
	    }
	} elsif ($line =~ m/^hostusb:\s*(\S+)\s*/) {
	    my $value = $1;
	    foreach my $dev (split (/,/, $value)) {
		$data .= "usb$usbId: host=$dev\n";
		$usbId++;
	    }
	} elsif ($line =~ m/^serial:\s*(\S+)\s*/) {
	    my $value = $1;
	    foreach my $dev (split (/,/, $value)) {
		$data .= "serial$serialId: $dev\n";
		$serialId++;
	    }
	} elsif ($line =~ m/^parallel:\s*(\S+)\s*/) {
	    my $value = $1;
	    foreach my $dev (split (/,/, $value)) {
		$data .= "parallel$parallelId: $dev\n";
		$parallelId++;
	    }
	} elsif ($line =~ m/^hostpci:\s*(\S+)\s*/) {
	    my $value = $1;
	    foreach my $dev (split (/,/, $value)) {
		$data .= "hostpci$pciId: $dev\n";
		$pciId++;
	    }
	} elsif ($line =~ m/^(tablet|smp|migrate_downtime|migrate_speed):/) {
	    # remove
	} else {
	    $data .= "$line\n";
	}
    } 

    close $fh;

    return $data;
}

sub read_file {
    my ($filename, $noerr) = @_;

    local $/; # enable localized slurp mode
    
    my $fh = IO::File->new($filename, "r");

    if (!$fh) {
	die "can't open '$filename' - $!\n" if !$noerr;
	return undef;
    }

    my $content = <$fh>;

    close $fh;

    return $content;
}

sub write_file {
    my ($filename, $text) = @_;

    my $fd = IO::File->new (">$filename") ||
	die "unable to open file '$filename' - $!";
    die "unable to write '$filename' - $!\n" unless print $fd $text;
    $fd->close();
}

sub cond_write_file {
    my ($filename, $data) = @_;
    return if -f $filename;
    print "import file: $filename\n";
    write_file($filename, $data)
}

if ($opt_import) {
    print "starting import\n";

    my $tmp = read_file("/root/.forward", 1) || '';
    if ($tmp =~ m/^(\S+@\S+)\s*$/m) {
	cond_write_file("/etc/pve/user.cfg", "user:root\@pam:1:0:::$1::\n");
	write_file("/root/.forward", "|/usr/bin/pvemailforward\n");
    }

    my $dc_conf = '';
    $tmp = read_file("$oldpvedir/qemu-server.cfg", 1) || '';
    if ($tmp =~ m/^(keyboard:\s*\S+\s*)$/m) {
	my $line = $1;
	chomp $line;
	$dc_conf .= "$line\n";
    }
    $tmp = read_file("$oldpvedir/pve.cfg", 1) || '';
    if ($tmp =~ m/^(http_proxy:\s*\S.*\s*)$/m) {
	my $line = $1;
	chomp $line;
	$dc_conf .= "$line\n";
    }

    cond_write_file("/etc/pve/datacenter.cfg", $dc_conf);

    if ($tmp = read_file("$oldpvedir/storage.cfg", 1)) {
	cond_write_file("/etc/pve/storage.cfg", $tmp);
    }

    foreach my $fn (<$oldqmdir/*.conf>) {
	my $basename = basename($fn);
	if ($basename =~ m/^([1-9]\d+).conf$/) {
	    my $vmid = $1;
	    my $newfn = "$newqmdir/$basename";
	    if (-f $newfn) {
		print "VM $vmid already exists - skip import\n";
		next;
	    }
	    my $cdata = read_old_qm_conf($fn);
	    cond_write_file($newfn, $cdata);
	}
    }

    my @sext = qw(start stop mount umount premount postumount);

    foreach my $fn (<$oldvzdir/*.conf>) {
	my $basename = basename($fn);
	if ($basename =~ m/^([1-9]\d+).conf$/) {
	    my $vmid = $1;
	    my $newfn = "$newvzdir/$basename";
	    if (-f $newfn) {
		print "CT $vmid already exists - skip import\n";
		next;
	    }
	    my $cdata = read_file($fn);
	    cond_write_file($newfn, $cdata);

	    foreach my $ext (@sext) {
		if (my $tmp = read_file("$oldvzdir/${vmid}.$ext", 1)) {
		    cond_write_file("$newvzdir/${vmid}.$ext", $tmp);
		}
	    }
	}
    }

    print "import done\n";

    exit(0);
}


my $new_grub_defaults = <<__EOD;
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Proxmox Virtual Environment"
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Comment to enable generation of recovery mode menu entries
GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
__EOD

my $logfd = IO::File->new (">>pve-upgrade.log") ||
    die "unable to create file 'pve-upgrade.log' - $!\n";

my $now = localtime();
print $logfd "STARTING $0 ($now)\n\n";

sub logmsg {
    print $logfd @_;
    print @_;
    STDOUT->flush();
}

sub syscmd {
    my ($cmd, $input) = @_;

    logmsg "$cmd\n";

    my $reader = IO::File->new();
    my $writer = IO::File->new();
    my $error  = IO::File->new();

    my $orig_pid = $$;

    my $pid;
    eval {
	$pid = open3 ($writer, $reader, $error, $cmd) || die $!;
    };

    my $err = $@;

    # catch exec errors
    if ($orig_pid != $$) {
	POSIX::_exit (1); 
	kill ('KILL', $$); 
    }

    die $err if $err;

    print $writer $input if defined $input;
    close $writer;

    my $select = new IO::Select;
    $select->add ($reader);
    $select->add ($error);

    my ($ostream, $logout) = ('', '', '');

    while ($select->count) {
	my @handles = $select->can_read (0.2);

	next if !scalar (@handles); # timeout

	foreach my $h (@handles) {
	    my $buf = '';
	    my $count = sysread ($h, $buf, 4096);
	    if (!defined ($count)) {
		my $err = $!;
		kill (9, $pid);
		waitpid ($pid, 0);
		logmsg "command '$cmd' failed: $err";
		return $?;
	    }
	    $select->remove ($h) if !$count;
	    logmsg $buf;
	}
    }

    waitpid ($pid, 0);

    return $?;
}

sub read_pkglist {

    my $pkglist = {};

    open (TMP, "dpkg-query --show -f '\${PACKAGE} \${VERSION} \${STATUS}\n'|") ||
	die "cant exec dpkg-query\n";
    while (defined (my $line = <TMP>)) {
	if ($line =~ m/^(\S+)\s+(\S+)\s+install\s+ok\s+installed$/) {
	    my ($pkg, $version) = ($1, $2);
	    $pkglist->{$pkg} = $version;
	}
    }
    
    return $pkglist;
}

sub deb_version_cmp {
    my ($cur, $op, $new) = @_;

    return $cur eq $new if $op eq 'eq';

    if (system("dpkg", "--compare-versions", $cur, $op, $new) == 0) {
	return 1;
    }

    return 0;
}

my $expected = {};
while (my $line = <PVE_SQUEEZE_UPDATER::DATA>) {
    chomp $line;
    next if $line =~ m/^\s*$/;
    next if $line =~ m/^\#/;

    if ($line =~ m/^\+(\S+)\s*$/) {
        my $pkg = $1;
    } elsif ($line =~ m/^-(\S+)\s*$/) {
        my $pkg = $1;
    } elsif ($line =~ m/^=(\S+)\s+(\S+)\s*$/) {
        my ($pkg, $version) = ($1, $2);
	$expected->{$pkg} = $version;
    } else {
        die "unable to parse line: $line\n";
    }
}

sub debconfig_set {
    my ($dcdata) = @_;

    my $cfgfile = "/tmp/debconf.txt";
    write_file ($cfgfile, $dcdata);
    syscmd ("debconf-set-selections $cfgfile"); 
    unlink $cfgfile;    
}

#debconfig_set (<<_EOD);
#dictionaries-common dictionaries-common/default-ispell select american
#dictionaries-common dictionaries-common/default-wordlist select american
#_EOD

my $kver = `uname -r`;
die "unsupported kernel version '$kver' - please upgrade you kernel first\n"
    if $kver !~ m/^2.6.32-\d+-pve$/;

# try to load fuse ASAP
syscmd ("modprobe fuse") == 0 || 
    die "unable to to load 'fuse'\n";

# get latest keys
syscmd ("apt-get update");

# fix broken packages first
syscmd ("apt-get -f install");

syscmd ("apt-get install debian-archive-keyring");

syscmd ('sed -i -e "s/archive\.debian\.org/ftp\.debian\.org/" -e "s/lenny/squeeze/" /etc/apt/sources.list');

# we use special repository fo upgrades called 'pve1upgrade'
syscmd ('sed -i -r -e \'s!download.proxmox.com/debian\s+squeeze\s+pve$!download.proxmox.com/debian squeeze pve1upgrade!\' /etc/apt/sources.list');

# remove old grub defaults
my $grub_default_fn = "/etc/default/grub";
if (syscmd("grep -q -s 'alternative=' $grub_default_fn") == 0) {
    write_file($grub_default_fn, $new_grub_defaults);
}

syscmd ("apt-get update") == 0 ||
    die "update package list failed\n";

unlink "/etc/default/apache2";

my $pkglist = read_pkglist();

my @cond_rem_list = qw(
proxmox-ve-2.6.18 proxmox-ve-2.6.24 proxmox-ve-2.6.32 proxmox-ve-2.6.35 vzdump pve-manager qemu-server vzctl libpve-storage-perl pve-qemu-kvm pve-qemu-kvm-2.6.18 vzprocp
);

foreach my $pkg (@cond_rem_list) {
    if ($pkglist->{$pkg}) {
	if (!$expected->{$pkg} ||
	    deb_version_cmp($pkglist->{$pkg}, 'lt', $expected->{$pkg})) {
	    syscmd("dpkg --remove $pkg") == 0 ||
		die "removing package $pkg failed\n";
	}
    }
}

if ($pkglist->{'pve-manager'} && 
    deb_version_cmp($pkglist->{'pve-manager'}, 'lt', $expected->{'pve-manager'})) {
    unlink "/etc/apache2/sites-enabled/pve.conf";
}

# try to reload vzmon (openvz) ASAP
syscmd ("modprobe vzmon") == 0 || 
    die "unable to to load 'vzmon'\n";

if (-d "/etc/pve" && ! -d $oldpvedir && ! -f "/etc/pve/.version") {
    rename("/etc/pve", $oldpvedir) || 
	die "rename /etc/pve to $oldpvedir failed - $!"; 
}

mkdir "/etc/pve";

if (-d "/etc/vz/conf" && ! -d $oldvzdir && ! -f "/etc/pve/.version") {
    rename("/etc/vz/conf", $oldvzdir) || 
	die "rename /etc/vz/conf to $oldvzdir failed - $!"; 
}

if (-d "/etc/qemu-server" && ! -d $oldqmdir && ! -f "/etc/pve/.version") {
    rename("/etc/qemu-server", $oldqmdir) || 
	die "rename /etc/qemu-server to $oldqmdir failed - $!"; 
}

syscmd ("apt-get -y upgrade") == 0 || die "minimal upgarde failed\n";

syscmd ("apt-get --purge -y -f --force-yes -o 'DPkg::Options::=--force-confdef' -o 'DPkg::Options::=--force-confold' dist-upgrade") == 0 ||
    die "dist-upgrade failed\n";

$pkglist = read_pkglist();
if (!$pkglist->{lvm2} || 
    deb_version_cmp ($pkglist->{lvm2}, 'lt', $expected->{lvm2})) {
    syscmd ("apt-get --purge -y --force-yes install lvm2");
}

if (!$pkglist->{rsyslog} || 
    deb_version_cmp ($pkglist->{rsyslog}, 'lt', $expected->{rsyslog})) {
    syscmd ("apt-get --purge -y --force-yes install rsyslog");
}

if ($pkglist->{vzquota} && $pkglist->{vzquota} =~ m/dso/) {
    syscmd ("dpkg --purge --force-depends vzquota");
    syscmd ("apt-get -y --force-yes install vzquota");
}

if ($pkglist->{"ifenslave-2.6"} && $pkglist->{"ifenslave-2.6"} =~ m/pve/) {
    syscmd ("dpkg --purge --force-depends ifenslave-2.6");
    syscmd ("apt-get -y --force-yes install ifenslave-2.6");
}

$pkglist = read_pkglist();

my $newlist;
foreach my $pkg (keys %$expected) {
    my $ver = $expected->{$pkg};
    next if $pkglist->{$pkg};
    $newlist .= " $pkg";
}

syscmd("apt-get --purge -y --force-yes install $newlist") if $newlist;

syscmd("apt-get install proxmox-ve-2.6.32") == 0 || die "install failed",

syscmd("insserv -d");

my @rc_fixes = qw(cron ntp lvm2 pvebanner);
foreach my $pkg (@rc_fixes) {
    syscmd("insserv -r $pkg");
    syscmd("insserv $pkg");
}

syscmd("a2ensite pve-redirect.conf");
syscmd("/etc/init.d/apache2 reload");

sub find_obsolete {

    my $remove;

    my $pkglist = read_pkglist();

    foreach my $pkg (keys %$pkglist) {
	next if $pkg =~ m/^pve-kernel-/;
	next if $pkg eq "libpci2";

	if (!$expected->{$pkg}) {
	    push @$remove, $pkg;
	}
    }

    close (TMP);

    return $remove;
}


if ($opt_purge) {
    if (my $obsolete = find_obsolete()) {
	my $rmlist = join (" ", @$obsolete);
	syscmd("apt-get -y --force-yes purge $rmlist");
    }
}

if (my $obsolete = find_obsolete()) {
    logmsg "upgrade done - found additional packages: " .  
	join (" ", @$obsolete) . "\n";
    logmsg "run $0 --purge if you want to remove them\n";

}

syscmd("apt-get clean");

my $errors = 0;

$pkglist = read_pkglist();
foreach my $pkg (keys %$expected) {
    my $ver = $expected->{$pkg};
    if (!$pkglist->{$pkg} || 
	deb_version_cmp ($pkglist->{$pkg}, 'lt', $expected->{$pkg})) {
	my $oldver = $pkglist->{$pkg} || 'not installed';
	logmsg "wrong version for package '$pkg' ($oldver <= $expected->{$pkg})\n";
	$errors = 1;
    }
}

if ($errors) {
    logmsg "upgrade failed\n";
    exit (-1);
} else {
    logmsg "upgrade successful\n";
    exit (0);
}

# ./newpackages 1.1
__DATA__
-atsar
-bacula-common
-bacula-fd
-cpp-4.3
-db4.6-util
-dhcp3-client
-dhcp3-common
-dictionaries-common
-diff
-ed
-gcc-4.2-base
-gcc-4.3-base
-grub
-iamerican
-ibritish
-ispell
-libapache-authcookie-perl
-libapache-session-perl
-libapache-sessionx-perl
-libbind9-50
-libcap1
-libcompress-raw-zlib-perl
-libcompress-zlib-perl
-libconvert-binhex-perl
-libcrypt-ssleay-perl
-libdb4.5
-libdirectfb-1.0-0
-libdns58
-libembperl-perl
-libept0
-libevent1
-libfcgi-perl
-libfilesys-smbclient-perl
-libgd-gd2-noxpm-perl
-libgd-graph-perl
-libgd-text-perl
-libgd2-noxpm
-libio-compress-base-perl
-libio-compress-zlib-perl
-libisc50
-libisccc50
-libisccfg50
-libjs-prototype
-libkrb53
-liblwres50
-libmailtools-perl
-libmime-tools-perl
-libmpfr1ldbl
-libmysqlclient15off
-libossp-uuid-perl
-libossp-uuid15
-libpq5
-libsmbclient
-libsoap-lite-perl
-libsys-hostname-long-perl
-libtalloc1
-libvolume-id0
-libwbclient0
-libxapian15
-libxcb-xlib0
-lzma
-makedev
-mktemp
-mysql-common
-openbsd-inetd
-openssl-blacklist
-pve-kernel-2.6.32-6-pve
-python2.5
-python2.5-minimal
-svgalibg1
-ttf-dejavu
-ttf-dejavu-extra
-update-inetd
-vzdump
+apache2.2-bin
+apt-listchanges
+ca-certificates
+ceph-common
+cifs-utils
+clvm
+corosync-pve
+cpp-4.4
+diffutils
+fence-agents-pve
+fontconfig
+fuse-utils
+gawk
+gcc-4.4-base
+grub-pc
+insserv
+install-info
+iputils-arping
+isc-dhcp-client
+isc-dhcp-common
+libaio1
+libaprutil1-dbd-sqlite3
+libaprutil1-ldap
+libbind9-60
+libboost-iostreams1.42.0
+libbsd0
+libc-bin
+libcairo2
+libcommon-sense-perl
+libcorosync4-pve
+libcrypt-openssl-bignum-perl
+libcrypt-openssl-random-perl
+libcrypt-openssl-rsa-perl
+libcurl3-gnutls
+libdatrie1
+libdb4.7
+libdb4.8
+libdbi0
+libdevel-cycle-perl
+libdirectfb-1.2-9
+libdns69
+libept1
+libevent-1.4-2
+libfile-readbackwards-perl
+libfuse2
+libgeoip1
+libgpgme11
+libgssapi-krb5-2
+libgssrpc4
+libisc62
+libisccc60
+libisccfg62
+libiscsi1
+libjson-xs-perl
+libk5crypto3
+libkadm5clnt-mit7
+libkadm5srv-mit7
+libkdb5-4
+libkrb5-3
+libkrb5support0
+liblua5.1-0
+liblwres60
+liblzma2
+liblzo2-2
+libmpfr4
+libnet-snmp-perl
+libnet-telnet-perl
+libnfnetlink0
+libnspr4-0d
+libnss3-1d
+libopenais3-pve
+libopenipmi0
+libopts25
+libpango1.0-0
+libpango1.0-common
+libparted0debian1
+libpixman-1-0
+libpth20
+libpve-access-control
+libpve-common-perl
+libqb
+librados2
+librbd1
+libreadline6
+librrd4
+librrds-perl
+libsensors4
+libsgutils2-2
+libsnmp-base
+libsnmp15
+libstring-shellquote-perl
+libtalloc2
+libthai-data
+libthai0
+libtokyocabinet8
+libudev0
+libxapian22
+libxcb-render-util0
+libxcb-render0
+libxml2-utils
+lzop
+openais-pve
+openipmi
+parted
+pve-cluster
+pve-kernel-2.6.32-14-pve
+python-apt
+python-apt-common
+python-openssl
+python-pexpect
+python-pycurl
+python-reportbug
+python-support
+python2.6
+python2.6-minimal
+redhat-cluster-pve
+resource-agents-pve
+rrdcached
+sensible-utils
+sg3-utils
+snmp
+sqlite3
+tsconf
+xsltproc
+xz-utils
=adduser	3.112+nmu2
=apache2	2.2.16-6+squeeze4
=apache2-mpm-prefork	2.2.16-6+squeeze4
=apache2-utils	2.2.16-6+squeeze4
=apache2.2-bin	2.2.16-6+squeeze4
=apache2.2-common	2.2.16-6+squeeze4
=apt	0.8.10.3+squeeze1
=apt-listchanges	2.85.7+squeeze1
=apt-utils	0.8.10.3+squeeze1
=aptitude	0.6.3-3.2+squeeze1
=at	3.1.12-1
=base-files	6.0squeeze4
=base-passwd	3.5.22
=bash	4.1-3
=bash-completion	1:1.2-3
=bc	1.06.95-2
=bind9-host	1:9.7.3.dfsg-1~squeeze4
=bridge-utils	1.4-5
=bsd-mailx	8.1.2-0.20100314cvs-1
=bsdmainutils	8.0.13
=bsdutils	1:2.17.2-9
=busybox	1:1.17.1-8
=bzip2	1.0.5-6+squeeze1
=ca-certificates	20090814+nmu3squeeze1
=ceph-common	0.48argonaut-1~bpo60+1
=cifs-utils	2:4.5-2+squeeze1
=clvm	2.02.95-1pve2
=console-common	0.7.85
=console-data	2:1.10-9
=console-tools	1:0.2.3dbs-69.1
=coreutils	8.5-1
=corosync-pve	1.4.3-1
=cpio	2.11-4
=cpp	4:4.4.5-1
=cpp-4.4	4.4.5-8
=cron	3.0pl1-116
=cstream	2.7.6-1
=dash	0.5.5.1-7.4
=dc	1.06.95-2
=debconf	1.5.36.1
=debconf-i18n	1.5.36.1
=debian-archive-keyring	2010.08.28
=debian-faq	4.0.4+nmu1
=debianutils	3.4
=defoma	0.11.11
=diffutils	1:3.0-1
=dmidecode	2.9-1.2
=dmsetup	2:1.02.74-1pve2
=dnsutils	1:9.7.3.dfsg-1~squeeze4
=doc-debian	4.0.2
=doc-linux-text	2008.08-1
=dpkg	1.15.8.12
=e2fslibs	1.41.12-4stable1
=e2fsprogs	1.41.12-4stable1
=eject	2.1.5+deb1+cvs20081104-7.1
=fdutils	5.5-20060227-4
=fence-agents-pve	3.1.8-1
=file	5.04-5
=findutils	4.4.2-1+b1
=fontconfig	2.8.0-2.1
=fontconfig-config	2.8.0-2.1
=ftp	0.17-23
=fuse-utils	2.8.4-1.1
=gawk	1:3.1.7.dfsg-5
=gcc-4.4-base	4.4.5-8
=gettext-base	0.18.1.1-3
=gnupg	1.4.10-4
=gpgv	1.4.10-4
=grep	2.6.3-3
=groff-base	1.20.1-10
=grub-common	1.98+20100804-14+squeeze1
=grub-pc	1.98+20100804-14+squeeze1
=gzip	1.3.12-9
=hostname	3.04
=ifenslave-2.6	1.1.0-17
=ifupdown	0.6.10
=info	4.13a.dfsg.1-6
=initramfs-tools	0.98.8
=initscripts	2.88dsf-13.1
=insserv	1.14.0-2
=install-info	4.13a.dfsg.1-6
=iproute	20100519-3
=iptables	1.4.8-3
=iputils-arping	3:20100418-3
=iputils-ping	3:20100418-3
=isc-dhcp-client	4.1.1-P1-15+squeeze3
=isc-dhcp-common	4.1.1-P1-15+squeeze3
=klibc-utils	1.5.20-1+squeeze1
=ksm-control-daemon	1.1-1
=less	436-1
=libacl1	2.2.49-4
=libaio1	0.3.107-7
=libapache2-mod-apreq2	2.12-2
=libapache2-mod-perl2	2.0.4-7
=libapache2-request-perl	2.12-2
=libapr1	1.4.2-6+squeeze3
=libapreq2	2.12-2
=libaprutil1	1.3.9+dfsg-5
=libaprutil1-dbd-sqlite3	1.3.9+dfsg-5
=libaprutil1-ldap	1.3.9+dfsg-5
=libasound2	1.0.23-2.1
=libattr1	1:2.4.44-2
=libauthen-pam-perl	0.16-2
=libbind9-60	1:9.7.3.dfsg-1~squeeze4
=libblkid1	2.17.2-9
=libboost-iostreams1.42.0	1.42.0-4
=libbsd0	0.2.0-1
=libbz2-1.0	1.0.5-6+squeeze1
=libc-bin	2.11.3-2
=libc6	2.11.3-2
=libc6-i386	2.11.3-2
=libcairo2	1.8.10-6
=libcap2	1:2.19-3
=libcomerr2	1.41.12-4stable1
=libcommon-sense-perl	3.3-1
=libconsole	1:0.2.3dbs-69.1
=libconvert-asn1-perl	0.22-1
=libcorosync4-pve	1.4.3-1
=libcrypt-openssl-bignum-perl	0.04-2
=libcrypt-openssl-random-perl	0.04-1+b1
=libcrypt-openssl-rsa-perl	0.25-1+b1
=libcurl3-gnutls	7.21.0-2
=libcwidget3	0.5.16-3
=libdatrie1	0.2.4-1
=libdb4.6	4.6.21-16
=libdb4.7	4.7.25-9
=libdb4.8	4.8.30-2
=libdbi0	0.8.2-3
=libdevel-cycle-perl	1.11-1
=libdevel-symdump-perl	2.08-3
=libdevmapper1.02.1	2:1.02.74-1pve2
=libdigest-hmac-perl	1.02+dfsg-1
=libdigest-sha1-perl	2.13-1
=libdirectfb-1.2-9	1.2.10.0-4
=libdns69	1:9.7.3.dfsg-1~squeeze4
=libedit2	2.11-20080614-2
=libept1	1.0.4
=libevent-1.4-2	1.4.13-stable-1
=libexpat1	2.0.1-7
=libfile-readbackwards-perl	1.04-3
=libfile-sync-perl	0.09-4+b1
=libfilesys-df-perl	0.92-3+b1
=libfontconfig1	2.8.0-2.1
=libfreetype6	2.4.2-2.1+squeeze3
=libfuse2	2.8.4-1.1
=libgc1c2	1:6.8-1.2
=libgcc1	1:4.4.5-8
=libgcrypt11	1.4.5-2
=libgdbm3	1.8.3-9
=libgeoip1	1.4.7~beta6+dfsg-1
=libglib2.0-0	2.24.2-1
=libgmp3c2	2:4.3.2+dfsg-1
=libgnutls26	2.8.6-1+squeeze1
=libgpg-error0	1.6-1
=libgpgme11	1.2.0-1.2
=libgpm2	1.20.4-3.3
=libgssapi-krb5-2	1.8.3+dfsg-4squeeze5
=libgssglue1	0.1-4
=libgssrpc4	1.8.3+dfsg-4squeeze5
=libhtml-parser-perl	3.66-1
=libhtml-tagset-perl	3.20-2
=libhtml-tree-perl	3.23-2
=libice6	2:1.0.6-2
=libidn11	1.15-2
=libintl-perl	1.20-1
=libio-multiplex-perl	1.10-1
=libio-socket-ssl-perl	1.33-1+squeeze1
=libio-stringy-perl	2.110-4
=libisc62	1:9.7.3.dfsg-1~squeeze4
=libisccc60	1:9.7.3.dfsg-1~squeeze4
=libisccfg62	1:9.7.3.dfsg-1~squeeze4
=libiscsi1	1.5.0-1
=libjpeg62	6b1-1
=libjson-perl	2.21-1
=libjson-xs-perl	2.290-1
=libk5crypto3	1.8.3+dfsg-4squeeze5
=libkadm5clnt-mit7	1.8.3+dfsg-4squeeze5
=libkadm5srv-mit7	1.8.3+dfsg-4squeeze5
=libkdb5-4	1.8.3+dfsg-4squeeze5
=libkeyutils1	1.4-1
=libklibc	1.5.20-1+squeeze1
=libkrb5-3	1.8.3+dfsg-4squeeze5
=libkrb5support0	1.8.3+dfsg-4squeeze5
=libldap-2.4-2	2.4.23-7.2
=liblinux-inotify2-perl	1:1.2-0.1
=liblocale-gettext-perl	1.05-6
=liblockfile-simple-perl	0.207-1
=liblockfile1	1.08-4
=liblog-agent-perl	0.307-2
=liblua5.1-0	5.1.4-5
=liblwres60	1:9.7.3.dfsg-1~squeeze4
=liblzma2	5.0.0-2
=liblzo2-2	2.03-2
=libmagic1	5.04-5
=libmpfr4	3.0.0-2
=libncurses5	5.7+20100313-5
=libncursesw5	5.7+20100313-5
=libnet-dns-perl	0.66-2
=libnet-ip-perl	1.25-2
=libnet-ldap-perl	1:0.4001-2
=libnet-snmp-perl	5.2.0-4
=libnet-ssleay-perl	1.36-1
=libnet-telnet-perl	3.03-3
=libnewt0.52	0.52.11-1
=libnfnetlink0	1.0.0-1
=libnfsidmap2	0.23-2
=libnspr4-0d	4.8.6-1
=libnss3-1d	3.12.8-1+squeeze4
=libopenais3-pve	1.1.4-2
=libopenipmi0	2.0.16-1.2
=libopts25	1:5.10-1.1
=libpam-modules	1.1.1-6.1+squeeze1
=libpam-runtime	1.1.1-6.1+squeeze1
=libpam0g	1.1.1-6.1+squeeze1
=libpango1.0-0	1.28.3-1+squeeze2
=libpango1.0-common	1.28.3-1+squeeze2
=libparted0debian1	2.3-5
=libpcap0.8	1.1.1-2+squeeze1
=libpci3	1:3.1.7-6
=libpcre3	8.02-1.1
=libperl5.10	5.10.1-17squeeze3
=libpixman-1-0	0.16.4-1
=libpng12-0	1.2.44-1+squeeze1
=libpopt0	1.16-1
=libpth20	2.0.7-16
=libpve-access-control	1.0-24
=libpve-common-perl	1.0-30
=libpve-storage-perl	2.0-29
=libqb	0.10.1-2
=librados2	0.48argonaut-1~bpo60+1
=librbd1	0.48argonaut-1~bpo60+1
=libreadline5	5.2-7
=libreadline6	6.1-3
=librpcsecgss3	0.19-2
=librrd4	1.4.3-1
=librrds-perl	1.4.3-1
=libsasl2-2	2.1.23.dfsg1-7
=libsdl1.2debian	1.2.14-6.1
=libsdl1.2debian-alsa	1.2.14-6.1
=libselinux1	2.0.96-1
=libsensors4	1:3.1.2-6
=libsepol1	2.0.41-1
=libsgutils2-2	1.29-1
=libsigc++-2.0-0c2a	2.2.4.2-1
=libslang2	2.2.2-4
=libsm6	2:1.1.1-1
=libsnmp-base	5.4.3~dfsg-2
=libsnmp15	5.4.3~dfsg-2
=libsqlite3-0	3.7.3-1
=libss2	1.41.12-4stable1
=libssl0.9.8	0.9.8o-4squeeze7
=libstdc++6	4.4.5-8
=libstring-shellquote-perl	1.03-1
=libsvga1	1:1.4.3-29
=libsysfs2	2.1.0+repack-1
=libtalloc2	2.0.1-1
=libtasn1-3	2.7-1
=libterm-readline-gnu-perl	1.20-1
=libtext-charwidth-perl	0.04-6
=libtext-iconv-perl	1.7-2
=libtext-wrapi18n-perl	0.06-7
=libthai-data	0.1.14-2
=libthai0	0.1.14-2
=libtimedate-perl	1.2000-1
=libtokyocabinet8	1.4.37-6
=libts-0.0-0	1.0-7
=libudev0	164-3
=liburi-perl	1.54-2
=libusb-0.1-4	2:0.1.12-16
=libuuid1	2.17.2-9
=libvncserver0	0.9.7-2+b1
=libwrap0	7.6.q-19
=libwww-perl	5.836-1
=libx11-6	2:1.3.3-4
=libx11-data	2:1.3.3-4
=libx86-1	1.1+ds1-6
=libxapian22	1.2.3-2
=libxau6	1:1.0.6-1
=libxaw7	2:1.0.7-1
=libxcb-render-util0	0.3.6-1
=libxcb-render0	1.6-1
=libxcb1	1.6-1
=libxcursor1	1:1.1.10-2
=libxdmcp6	1:1.0.3-2
=libxext6	2:1.1.2-1
=libxfixes3	1:4.0.5-1
=libxft2	2.1.14-2
=libxkbfile1	1:1.0.6-2
=libxml-parser-perl	2.36-1.1+b1
=libxml2	2.7.8.dfsg-2+squeeze1
=libxml2-utils	2.7.8.dfsg-2+squeeze1
=libxmu6	2:1.0.5-2
=libxmuu1	2:1.0.5-2
=libxpm4	1:3.5.8-1
=libxrender1	1:0.9.6-1
=libxslt1.1	1.1.26-6
=libxt6	1:1.0.7-1
=locales	2.11.3-2
=login	1:4.1.4.2+svn3283-2+squeeze1
=logrotate	3.7.8-6
=lsb-base	3.2-23.2squeeze1
=lsof	4.81.dfsg.1-1
=lvm2	2.02.95-1pve2
=lynx	2.8.8dev.5-1
=lynx-cur	2.8.8dev.5-1
=lzop	1.02~rc1-2
=m4	1.4.14-3
=man-db	2.5.7-8
=manpages	3.27-1
=mawk	1.3.3-15
=memtest86+	4.10-1.1
=mime-support	3.48-1
=mlocate	0.22.2-1
=module-init-tools	3.12-2
=mount	2.17.2-9
=mutt	1.5.20-9+squeeze2
=nano	2.2.4-1
=ncurses-base	5.7+20100313-5
=ncurses-bin	5.7+20100313-5
=ncurses-term	5.7+20100313-5
=net-tools	1.60-23
=netbase	4.45
=netcat-traditional	1.10-38
=nfs-common	1:1.2.2-4squeeze2
=nmap	5.00-3
=ntp	1:4.2.6.p2+dfsg-1+b1
=open-iscsi	2.0.871.3-2squeeze1
=openais-pve	1.1.4-2
=openipmi	2.0.16-1.2
=openssh-blacklist	0.4.1
=openssh-client	1:5.5p1-6+squeeze1
=openssh-server	1:5.5p1-6+squeeze1
=openssl	0.9.8o-4squeeze7
=parted	2.3-5
=passwd	1:4.1.4.2+svn3283-2+squeeze1
=patch	2.6-2
=pciutils	1:3.1.7-6
=perl	5.10.1-17squeeze3
=perl-base	5.10.1-17squeeze3
=perl-modules	5.10.1-17squeeze3
=perl-suid	5.10.1-17squeeze3
=portmap	6.0.0-2
=postfix	2.7.1-1+squeeze1
=procmail	3.22-19
=procps	1:3.2.8-9
=proxmox-ve-2.6.32	2.1-73
=psmisc	22.11-1
=pve-cluster	1.0-27
=pve-firmware	1.0-18
=pve-kernel-2.6.32-14-pve	2.6.32-73
=pve-manager	2.1-14
=pve-qemu-kvm	1.1-7
=python	2.6.6-3+squeeze6
=python-apt	0.7.100.1+squeeze1
=python-apt-common	0.7.100.1+squeeze1
=python-central	0.6.16+nmu1
=python-minimal	2.6.6-3+squeeze6
=python-openssl	0.10-1
=python-pexpect	2.3-1
=python-pycurl	7.19.0-3+b1
=python-reportbug	4.12.6
=python-support	1.0.10
=python2.6	2.6.6-8+b1
=python2.6-minimal	2.6.6-8+b1
=qemu-server	2.0-48
=readline-common	6.1-3
=redhat-cluster-pve	3.1.92-3
=reportbug	4.12.6
=resource-agents-pve	3.9.2-3
=rrdcached	1.4.3-1
=rsync	3.0.7-2
=rsyslog	4.6.4-2
=samba-common	2:3.5.6~dfsg-3squeeze6
=sed	4.2.1-7
=sensible-utils	0.0.4
=sg3-utils	1.29-1
=smbfs	2:4.5-2+squeeze1
=snmp	5.4.3~dfsg-2
=sqlite3	3.7.3-1
=ssh	1:5.5p1-6+squeeze1
=ssl-cert	1.0.28
=strace	4.5.20-2
=sysv-rc	2.88dsf-13.1
=sysvinit	2.88dsf-13.1
=sysvinit-utils	2.88dsf-13.1
=tar	1.23-3
=tasksel	2.88
=tasksel-data	2.88
=tcpd	7.6.q-19
=tcpdump	4.1.1-1
=telnet	0.17-36
=texinfo	4.13a.dfsg.1-6
=time	1.7-23.1
=traceroute	1:2.0.15-1
=tsconf	1.0-7
=ttf-dejavu-core	2.31-1
=tzdata	2011n-0squeeze1
=ucf	3.0025+nmu1
=udev	164-3
=usbutils	0.87-5squeeze1
=util-linux	2.17.2-9
=vim-common	2:7.2.445+hg~cb94c42c0e1a-1
=vim-tiny	2:7.2.445+hg~cb94c42c0e1a-1
=vlan	1.9-3
=vncterm	1.0-2
=vzctl	3.0.30-2pve5
=vzprocps	2.0.11-2
=vzquota	3.0.12-3
=w3m	0.5.2-9
=wamerican	6-3
=wget	1.12-2.1
=whiptail	0.52.11-1
=whois	5.0.10
=x11-apps	7.5+5
=x11-common	1:7.5+8+squeeze1
=xauth	1:1.0.4-1
=xsltproc	1.1.26-6
=xz-utils	5.0.0-2
=zlib1g	1:1.2.3.4.dfsg-3
