#!/usr/bin/perl -w

package PVE_WHEEZY_UPDATER;

# Copyright (C) 2013 Proxmox Server Solutions GmbH

# upgrade instructions:
# see http://pve.proxmox.com/wiki/Upgrade_from_2.3_to_3.0

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

my $opt_purge;
my $opt_download_only;

$ENV{LC_ALL} = 'C';

$ENV{DEBIAN_FRONTEND} = 'noninteractive';

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

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)
}

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 = {};
my $reinstall_pkglist = [];
while (my $line = <PVE_WHEEZY_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*$/) {
        my $pkg = $1;
	push @$reinstall_pkglist, $pkg;
    } 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$/;

# 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/squeeze/wheezy/" /etc/apt/sources.list');

# fixme: we use pve for now (instead of pve2upgrade)
# later we can use special repository fo upgrades called 'pve2upgrade'
#syscmd ('sed -i -r -e \'s!download.proxmox.com/debian\s+wheezy\s+pve$!download.proxmox.com/debian wheezy pve2upgrade!\' /etc/apt/sources.list');

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


my $aptopt = "--purge -y -f --force-yes -o 'DPkg::Options::=--force-confdef' -o 'DPkg::Options::=--force-confold' dist-upgrade";

if ($opt_download_only) {
    syscmd ("apt-get --download-only $aptopt") == 0 ||
	die "downlaod failed\n";

    logmsg "download successful\n";
    exit(0);
}

syscmd("/etc/init.d/apache2 stop");

# disable old apache2 config
syscmd("rm -f /etc/apache2/sites-enabled/pve");
syscmd("rm -f /etc/apache2/sites-enabled/pve-redirect.conf");

my $pkglist = read_pkglist();

my $remove_pkglist = '';
foreach my $pkg (qw(proxmox-ve-2.6.32 pve-manager)) {
    $remove_pkglist .= " $pkg" if $pkglist->{$pkg};
}
syscmd("dpkg --remove $remove_pkglist") if !$opt_purge && $remove_pkglist;

syscmd ("apt-get $aptopt") == 0 ||
    die "dist-upgrade failed\n";

$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";

if (!$opt_purge && scalar(@$reinstall_pkglist)) {
    syscmd("apt-get --purge -y --force-yes --reinstall -o 'DPkg::Options::=--force-confdef' -o 'DPkg::Options::=--force-confold' install " . join(' ', @$reinstall_pkglist));
}

# reinstall new MBR
# syscmd("grub-install '(hd0)'") if !$opt_purge;

# remove /etc/init.d/fuse - this is no longer required
syscmd("apt-get purge fuse-utils");
 
syscmd("insserv -d");

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 - Please reboot this node.\n";
    exit (0);
}

# ./newpackages 2.3
__DATA__
-apache2
-apache2-mpm-prefork
-apache2-utils
-apache2.2-bin
-apache2.2-common
-cpp-4.4
-defoma
-doc-linux-text
-fuse-utils
-gcc-4.4-base
-libapache2-mod-apreq2
-libapache2-mod-perl2
-libapache2-request-perl
-libapr1
-libapreq2
-libaprutil1
-libaprutil1-dbd-sqlite3
-libaprutil1-ldap
-libbind9-60
-libboost-iostreams1.42.0
-libboost-thread1.42.0
-libc6-i386
-libdb4.6
-libdb4.7
-libdb4.8
-libdbi0
-libdevel-symdump-perl
-libdigest-sha1-perl
-libdns69
-libept1
-libevent-1.4-2
-libgmp3c2
-libisc62
-libisccc60
-libisccfg62
-libkadm5clnt-mit7
-libkadm5srv-mit7
-libkdb5-4
-liblwres60
-liblzma2
-libnspr4-0d
-libnss3-1d
-libpango1.0-common
-libperl5.10
-libqb
-libreadline5
-libsdl1.2debian-alsa
-libssl0.9.8
-libsvga1
-libtokyocabinet8
-libx86-1
-libxcb-render-util0
-module-init-tools
-openssh-blacklist
-perl-suid
-portmap
-pve-kernel-2.6.32-18-pve
-python-central
-python2.6
-smbfs
-tcpd
+apt-transport-https
+aptitude-common
+bootlogd
+cpp-4.7
+db5.1-util
+fuse
+gcc-4.7-base
+glusterfs-client
+glusterfs-common
+grub-pc-bin
+grub2-common
+kmod
+krb5-locales
+libanyevent-http-perl
+libanyevent-perl
+libapt-inst1.5
+libapt-pkg-perl
+libapt-pkg4.12
+libasprintf0c2
+libasyncns0
+libbind9-80
+libblas3
+libblas3gf
+libboost-iostreams1.49.0
+libboost-system1.49.0
+libboost-thread1.49.0
+libcaca0
+libclass-isa-perl
+libcrypt-ssleay-perl
+libdb5.1
+libdbi1
+libdbus-1-3
+libdevmapper-event1.02.1
+libdns88
+libencode-locale-perl
+libept1.4.12
+libevent-2.0-5
+libffi5
+libfile-listing-perl
+libflac8
+libgfortran3
+libgmp10
+libgnutls-openssl27
+libhttp-cookies-perl
+libhttp-daemon-perl
+libhttp-date-perl
+libhttp-message-perl
+libhttp-negotiate-perl
+libibverbs1
+libisc84
+libisccc80
+libisccfg82
+libjpeg8
+libjs-jquery
+libjson0
+libkadm5clnt-mit8
+libkadm5srv-mit8
+libkdb5-6
+libkmod2
+libleveldb1
+liblinear1
+liblockfile-bin
+liblvm2app2.2
+liblwp-mediatypes-perl
+liblwp-protocol-https-perl
+liblwres80
+liblzma5
+libmath-bigint-perl
+libmount1
+libmpc2
+libnet-http-perl
+libnspr4
+libnss3
+libogg0
+libp11-kit0
+libpam-modules-bin
+libperl5.14
+libpipeline1
+libprocps0
+libpulse0
+libqb0
+libquadmath0
+librdmacm1
+librtmp0
+libsemanage-common
+libsemanage1
+libsigsegv2
+libsnappy1
+libsndfile1
+libssh2-1
+libssl1.0.0
+libswitch-perl
+libtdb1
+libtinfo5
+libtirpc1
+libtokyocabinet9
+libusb-1.0-0
+libusbredirparser1
+libustr-1.0-1
+libvorbis0a
+libvorbisenc2
+libwbclient0
+libwww-robotrules-perl
+libx11-xcb1
+libxcb-shm0
+libxi6
+libxtst6
+multiarch-support
+pve-kernel-2.6.32-26-pve
+pve-libspice-server1
+python-ceph
+python-chardet
+python-debian
+python-debianbts
+python-flask
+python-fpconst
+python-jinja2
+python-markupsafe
+python-requests
+python-six
+python-soappy
+python-werkzeug
+python2.7
+python2.7-minimal
+rpcbind
+smbclient
+socat
:libcgroup1
:libpth20
:telnet
:vlan
:vzprocps
=adduser	3.113+nmu3
=apt	0.9.7.9
=apt-listchanges	2.85.11
=apt-transport-https	0.9.7.10
=apt-utils	0.9.7.9
=aptitude	0.6.8.2-1
=aptitude-common	0.6.8.2-1
=at	3.1.13-2
=attr	1:2.4.46-8
=base-files	7.1wheezy2
=base-passwd	3.5.26
=bash	4.2+dfsg-0.1
=bash-completion	1:2.0-1
=bc	1.06.95-2+b1
=bind9-host	1:9.8.4.dfsg.P1-6+nmu2+deb7u1
=bootlogd	2.88dsf-41+deb7u1
=bridge-utils	1.5-6
=bsd-mailx	8.1.2-0.20111106cvs-1
=bsdmainutils	9.0.3
=bsdutils	1:2.20.1-5.3
=busybox	1:1.20.0-7
=bzip2	1.0.6-4
=ca-certificates	20130119
=ceph-common	0.67.4-1~bpo70+1
=cifs-utils	2:5.5-1
=clvm	2.02.98-pve4
=console-common	0.7.87
=console-data	2:1.12-2
=console-tools	1:0.2.3dbs-70
=coreutils	8.13-3.5
=corosync-pve	1.4.5-1
=cpio	2.11+dfsg-0.1
=cpp	4:4.7.2-1
=cpp-4.7	4.7.2-5
=cron	3.0pl1-124
=cstream	3.0.0-1
=dash	0.5.7-3
=db5.1-util	5.1.29-5
=dc	1.06.95-2+b1
=debconf	1.5.49
=debconf-i18n	1.5.49
=debian-archive-keyring	2012.4
=debian-faq	5.0.1
=debianutils	4.3.2
=diffutils	1:3.2-6
=dmidecode	2.11-9
=dmsetup	2:1.02.77-pve4
=dnsutils	1:9.8.4.dfsg.P1-6+nmu2+deb7u1
=doc-debian	6.1
=dpkg	1.16.12
=dtach	0.8-2.1
=e2fslibs	1.42.5-1.1
=e2fsprogs	1.42.5-1.1
=eject	2.1.5+deb1+cvs20081104-13
=fdutils	5.5-20060227-6
=fence-agents-pve	4.0.0-2
=file	5.11-2
=findutils	4.4.2-4
=fontconfig	2.9.0-7.1
=fontconfig-config	2.9.0-7.1
=ftp	0.17-27
=fuse	2.9.0-2+deb7u1
=gawk	1:4.0.1+dfsg-2.1
=gcc-4.7-base	4.7.2-5
=gettext-base	0.18.1.1-9
=glusterfs-client	3.4.1-1
=glusterfs-common	3.4.1-1
=gnupg	1.4.12-7+deb7u1
=gpgv	1.4.12-7+deb7u1
=grep	2.12-2
=groff-base	1.21-9
=grub-common	1.99-27+deb7u2
=grub-pc	1.99-27+deb7u2
=grub-pc-bin	1.99-27+deb7u2
=grub2-common	1.99-27+deb7u2
=gzip	1.5-1.1
=hostname	3.11
=ifenslave-2.6	1.1.0-20
=ifupdown	0.7.8
=info	4.13a.dfsg.1-10
=initramfs-tools	0.109.1
=initscripts	2.88dsf-41+deb7u1
=insserv	1.14.0-5
=install-info	4.13a.dfsg.1-10
=iproute	20120521-3+b3
=iptables	1.4.14-3.1
=iputils-arping	3:20101006-1+b1
=iputils-ping	3:20101006-1+b1
=isc-dhcp-client	4.2.2.dfsg.1-5+deb70u6
=isc-dhcp-common	4.2.2.dfsg.1-5+deb70u6
=klibc-utils	2.0.1-3.1
=kmod	9-3
=krb5-locales	1.10.1+dfsg-5+deb7u1
=ksm-control-daemon	1.1-1
=less	444-4
=libacl1	2.2.51-8
=libaio1	0.3.109-3
=libanyevent-http-perl	2.14-1
=libanyevent-perl	7.010-1
=libapt-inst1.5	0.9.7.9
=libapt-pkg-perl	0.1.26+b1
=libapt-pkg4.12	0.9.7.9
=libasound2	1.0.25-4
=libasprintf0c2	0.18.1.1-9
=libasyncns0	0.8-4
=libattr1	1:2.4.46-8
=libauthen-pam-perl	0.16-2+b2
=libbind9-80	1:9.8.4.dfsg.P1-6+nmu2+deb7u1
=libblas3	1.2.20110419-5
=libblas3gf	1.2.20110419-5
=libblkid1	2.20.1-5.3
=libboost-iostreams1.49.0	1.49.0-3.2
=libboost-system1.49.0	1.49.0-3.2
=libboost-thread1.49.0	1.49.0-3.2
=libbsd0	0.4.2-1
=libbz2-1.0	1.0.6-4
=libc-bin	2.13-38
=libc6	2.13-38
=libcaca0	0.99.beta18-1
=libcairo2	1.12.2-3
=libcap2	1:2.22-1.2
=libcgroup1	0.38-1
=libclass-isa-perl	0.36-3
=libcomerr2	1.42.5-1.1
=libcommon-sense-perl	3.6-1
=libconsole	1:0.2.3dbs-70
=libconvert-asn1-perl	0.26-1
=libcorosync4-pve	1.4.5-1
=libcrypt-openssl-bignum-perl	0.04-3
=libcrypt-openssl-random-perl	0.04-1+b4
=libcrypt-openssl-rsa-perl	0.28-1
=libcrypt-ssleay-perl	0.58-1
=libcurl3-gnutls	7.26.0-1+wheezy4
=libcwidget3	0.5.16-3.4
=libdatrie1	0.2.5-3
=libdb5.1	5.1.29-5
=libdbi1	0.8.4-6
=libdbus-1-3	1.6.8-1+deb7u1
=libdevel-cycle-perl	1.11-2
=libdevmapper-event1.02.1	2:1.02.77-pve4
=libdevmapper1.02.1	2:1.02.77-pve4
=libdigest-hmac-perl	1.03+dfsg-1
=libdirectfb-1.2-9	1.2.10.0-5
=libdns88	1:9.8.4.dfsg.P1-6+nmu2+deb7u1
=libedit2	2.11-20080614-5
=libencode-locale-perl	1.03-1
=libept1.4.12	1.0.9
=libevent-2.0-5	2.0.19-stable-3
=libexpat1	2.1.0-1
=libffi5	3.0.10-3
=libfile-chdir-perl	0.1006-1
=libfile-listing-perl	6.04-1
=libfile-readbackwards-perl	1.05-1
=libfile-sync-perl	0.11-1
=libfilesys-df-perl	0.92-4+b1
=libflac8	1.2.1-6
=libfontconfig1	2.9.0-7.1
=libfreetype6	2.4.9-1.1
=libfuse2	2.9.0-2+deb7u1
=libgc1c2	1:7.1-9.1
=libgcc1	1:4.7.2-5
=libgcrypt11	1.5.0-5+deb7u1
=libgdbm3	1.8.3-11
=libgeoip1	1.4.8+dfsg-3
=libgfortran3	4.7.2-5
=libglib2.0-0	2.33.12+really2.32.4-5
=libgmp10	2:5.0.5+dfsg-2
=libgnutls-openssl27	2.12.20-7
=libgnutls26	2.12.20-7
=libgpg-error0	1.10-3.1
=libgpgme11	1.2.0-1.4
=libgpm2	1.20.4-6
=libgssapi-krb5-2	1.10.1+dfsg-5+deb7u1
=libgssglue1	0.4-2
=libgssrpc4	1.10.1+dfsg-5+deb7u1
=libhtml-parser-perl	3.69-2
=libhtml-tagset-perl	3.20-2
=libhtml-tree-perl	5.02-1
=libhttp-cookies-perl	6.00-2
=libhttp-daemon-perl	6.01-1
=libhttp-date-perl	6.02-1
=libhttp-message-perl	6.03-1
=libhttp-negotiate-perl	6.00-2
=libibverbs1	1.1.6-1
=libice6	2:1.0.8-2
=libidn11	1.25-2
=libintl-perl	1.20-1
=libio-multiplex-perl	1.13-1
=libio-socket-ssl-perl	1.76-2
=libio-stringy-perl	2.110-5
=libisc84	1:9.8.4.dfsg.P1-6+nmu2+deb7u1
=libisccc80	1:9.8.4.dfsg.P1-6+nmu2+deb7u1
=libisccfg82	1:9.8.4.dfsg.P1-6+nmu2+deb7u1
=libiscsi1	1.9.0-1
=libjpeg62	6b1-3
=libjpeg8	8d-1
=libjs-jquery	1.7.2+dfsg-1
=libjson-perl	2.53-1
=libjson-xs-perl	2.320-1+b1
=libjson0	0.10-1.2
=libk5crypto3	1.10.1+dfsg-5+deb7u1
=libkadm5clnt-mit8	1.10.1+dfsg-5+deb7u1
=libkadm5srv-mit8	1.10.1+dfsg-5+deb7u1
=libkdb5-6	1.10.1+dfsg-5+deb7u1
=libkeyutils1	1.5.5-3
=libklibc	2.0.1-3.1
=libkmod2	9-3
=libkrb5-3	1.10.1+dfsg-5+deb7u1
=libkrb5support0	1.10.1+dfsg-5+deb7u1
=libldap-2.4-2	2.4.31-1+nmu2
=libleveldb1	0+20120530.gitdd0d562-1
=liblinear1	1.8+dfsg-1
=liblinux-inotify2-perl	1:1.22-0.2+b1
=liblocale-gettext-perl	1.05-7+b1
=liblockfile-bin	1.09-5
=liblockfile-simple-perl	0.208-1
=liblockfile1	1.09-5
=liblog-agent-perl	0.307-2
=liblua5.1-0	5.1.5-4
=liblvm2app2.2	2.02.98-pve4
=liblwp-mediatypes-perl	6.02-1
=liblwp-protocol-https-perl	6.03-1
=liblwres80	1:9.8.4.dfsg.P1-6+nmu2+deb7u1
=liblzma5	5.1.1alpha+20120614-2
=liblzo2-2	2.06-1
=libmagic1	5.11-2
=libmath-bigint-perl	1.997-1
=libmount1	2.20.1-5.3
=libmpc2	0.9-4
=libmpfr4	3.1.0-5
=libncurses5	5.9-10
=libncursesw5	5.9-10
=libnet-dns-perl	0.66-2+b2
=libnet-http-perl	6.06-1
=libnet-ip-perl	1.25-3
=libnet-ldap-perl	1:0.4400-1
=libnet-snmp-perl	6.0.1-2
=libnet-ssleay-perl	1.48-1+b1
=libnet-telnet-perl	3.03-3
=libnewt0.52	0.52.14-11.1
=libnfnetlink0	1.0.0-1.1
=libnfsidmap2	0.25-4
=libnspr4	2:4.9.2-1
=libnss3	2:3.14.3-1
=libogg0	1.3.0-4
=libopenais3-pve	1.1.4-3
=libopenipmi0	2.0.16-1.3
=libopts25	1:5.12-0.1
=libp11-kit0	0.12-3
=libpam-modules	1.1.3-7.1
=libpam-modules-bin	1.1.3-7.1
=libpam-runtime	1.1.3-7.1
=libpam0g	1.1.3-7.1
=libpango1.0-0	1.30.0-1
=libparted0debian1	2.3-12
=libpcap0.8	1.3.0-1
=libpci3	1:3.1.9-6
=libpcre3	1:8.30-5
=libperl5.14	5.14.2-21+deb7u1
=libpipeline1	1.2.1-1
=libpixman-1-0	0.26.0-4
=libpng12-0	1.2.49-1
=libpopt0	1.16-7
=libprocps0	1:3.3.3-3
=libpth20	2.0.7-16
=libpulse0	2.0-6.1
=libpve-access-control	3.0-7
=libpve-common-perl	3.0-8
=libpve-storage-perl	3.0-17
=libqb0	0.11.1-2
=libquadmath0	4.7.2-5
=librados2	0.67.4-1~bpo70+1
=librbd1	0.67.4-1~bpo70+1
=librdmacm1	1.0.15-1+deb7u1
=libreadline6	6.2+dfsg-0.1
=librpcsecgss3	0.19-5
=librrd4	1.4.7-2
=librrds-perl	1.4.7-2
=librtmp0	2.4+20111222.git4e06e21-1
=libsasl2-2	2.1.25.dfsg1-6+deb7u1
=libsdl1.2debian	1.2.15-5
=libselinux1	2.1.9-5
=libsemanage-common	2.1.6-6
=libsemanage1	2.1.6-6
=libsensors4	1:3.3.2-2+deb7u1
=libsepol1	2.1.4-3
=libsgutils2-2	1.33-1
=libsigc++-2.0-0c2a	2.2.10-0.2
=libsigsegv2	2.9-4
=libslang2	2.2.4-15
=libsm6	2:1.2.1-2
=libsnappy1	1.0.5-2
=libsndfile1	1.0.25-5
=libsnmp-base	5.4.3~dfsg-2.7
=libsnmp15	5.4.3~dfsg-2.7
=libsqlite3-0	3.7.13-1+deb7u1
=libss2	1.42.5-1.1
=libssh2-1	1.4.2-1.1
=libssl1.0.0	1.0.1e-2
=libstdc++6	4.7.2-5
=libstring-shellquote-perl	1.03-1
=libswitch-perl	2.16-2
=libsysfs2	2.1.0+repack-2
=libtalloc2	2.0.7+git20120207-1
=libtasn1-3	2.13-2
=libtdb1	1.2.10-2
=libterm-readline-gnu-perl	1.20-2+b1
=libtext-charwidth-perl	0.04-7+b1
=libtext-iconv-perl	1.7-5
=libtext-wrapi18n-perl	0.06-7
=libthai-data	0.1.18-2
=libthai0	0.1.18-2
=libtimedate-perl	1.2000-1
=libtinfo5	5.9-10
=libtirpc1	0.2.2-5
=libtokyocabinet9	1.4.47-2
=libts-0.0-0	1.0-11
=libudev0	175-7.2
=liburi-perl	1.60-1
=libusb-0.1-4	2:0.1.12-20+nmu1
=libusb-1.0-0	2:1.0.11-1
=libusbredirparser1	0.6-2
=libustr-1.0-1	1.0.4-3
=libuuid1	2.20.1-5.3
=libvncserver0	0.9.9+dfsg-1
=libvorbis0a	1.3.2-1.3
=libvorbisenc2	1.3.2-1.3
=libwbclient0	2:3.6.6-6+deb7u1
=libwrap0	7.6.q-24
=libwww-perl	6.04-1
=libwww-robotrules-perl	6.01-1
=libx11-6	2:1.5.0-1+deb7u1
=libx11-data	2:1.5.0-1+deb7u1
=libx11-xcb1	2:1.5.0-1+deb7u1
=libxapian22	1.2.12-2
=libxau6	1:1.0.7-1
=libxaw7	2:1.0.10-2
=libxcb-render0	1.8.1-2+deb7u1
=libxcb-shm0	1.8.1-2+deb7u1
=libxcb1	1.8.1-2+deb7u1
=libxcursor1	1:1.1.13-1+deb7u1
=libxdmcp6	1:1.1.1-1
=libxext6	2:1.3.1-2+deb7u1
=libxfixes3	1:5.0-4+deb7u1
=libxft2	2.3.1-1
=libxi6	2:1.6.1-1+deb7u1
=libxkbfile1	1:1.0.8-1
=libxml-parser-perl	2.41-1+b1
=libxml2	2.8.0+dfsg1-7+nmu1
=libxml2-utils	2.8.0+dfsg1-7+nmu1
=libxmu6	2:1.1.1-1
=libxmuu1	2:1.1.1-1
=libxpm4	1:3.5.10-1
=libxrender1	1:0.9.7-1+deb7u1
=libxslt1.1	1.1.26-14.1
=libxt6	1:1.1.3-1+deb7u1
=libxtst6	2:1.2.1-1+deb7u1
=locales	2.13-38
=login	1:4.1.5.1-1
=logrotate	3.8.1-4
=lsb-base	4.1+Debian8+deb7u1
=lsof	4.86+dfsg-1
=lvm2	2.02.98-pve4
=lynx	2.8.8dev.12-2
=lynx-cur	2.8.8dev.12-2
=lzop	1.03-3
=m4	1.4.16-3
=man-db	2.6.2-1
=manpages	3.44-1
=mawk	1.3.3-17
=memtest86+	4.20-1.1
=mime-support	3.52-1
=mlocate	0.23.1-1
=mount	2.20.1-5.3
=multiarch-support	2.13-38
=mutt	1.5.21-6.2+deb7u1
=nano	2.2.6-1+b1
=ncurses-base	5.9-10
=ncurses-bin	5.9-10
=ncurses-term	5.9-10
=net-tools	1.60-24.2
=netbase	5.0
=netcat-traditional	1.10-40
=nfs-common	1:1.2.6-4
=nmap	6.00-0.3+deb7u1
=ntp	1:4.2.6.p5+dfsg-2
=omping	0.0.4-2
=open-iscsi	2.0.873-3
=openais-pve	1.1.4-3
=openipmi	2.0.16-1.3
=openssh-client	1:6.0p1-4
=openssh-server	1:6.0p1-4
=openssl	1.0.1e-2
=parted	2.3-12
=passwd	1:4.1.5.1-1
=patch	2.6.1-3
=pciutils	1:3.1.9-6
=perl	5.14.2-21+deb7u1
=perl-base	5.14.2-21+deb7u1
=perl-modules	5.14.2-21+deb7u1
=postfix	2.9.6-2
=procmail	3.22-20
=procps	1:3.3.3-3
=proxmox-ve-2.6.32	3.1-114
=psmisc	22.19-1+deb7u1
=pve-cluster	3.0-8
=pve-firmware	1.0-23
=pve-kernel-2.6.32-26-pve	2.6.32-114
=pve-libspice-server1	0.12.4-2
=pve-manager	3.1-21
=pve-qemu-kvm	1.4-17
=python	2.7.3-4+deb7u1
=python-apt	0.8.8.2
=python-apt-common	0.8.8.2
=python-ceph	0.67.4-1~bpo70+1
=python-chardet	2.0.1-2
=python-debian	0.1.21
=python-debianbts	1.11
=python-flask	0.8-1
=python-fpconst	0.7.2-5
=python-jinja2	2.6-1
=python-markupsafe	0.15-1
=python-minimal	2.7.3-4+deb7u1
=python-openssl	0.13-2+deb7u1
=python-pexpect	2.4-1
=python-pycurl	7.19.0-5
=python-reportbug	6.4.4
=python-requests	0.12.1-1
=python-six	1.1.0-2
=python-soappy	0.12.0-4
=python-support	1.0.15
=python-werkzeug	0.8.3+dfsg-1
=python2.6-minimal	2.6.8-1.1
=python2.7	2.7.3-6
=python2.7-minimal	2.7.3-6
=qemu-server	3.1-8
=readline-common	6.2+dfsg-0.1
=redhat-cluster-pve	3.2.0-2
=reportbug	6.4.4
=resource-agents-pve	3.9.2-4
=rpcbind	0.2.0-8
=rrdcached	1.4.7-2
=rsync	3.0.9-4
=rsyslog	5.8.11-3
=samba-common	2:3.6.6-6+deb7u1
=sed	4.2.1-10
=sensible-utils	0.0.7
=sg3-utils	1.33-1
=smbclient	2:3.6.6-6+deb7u1
=snmp	5.4.3~dfsg-2.7
=socat	1.7.1.3-1.4
=sqlite3	3.7.13-1+deb7u1
=ssh	1:6.0p1-4
=ssl-cert	1.0.32
=strace	4.5.20-2.3
=sysv-rc	2.88dsf-41+deb7u1
=sysvinit	2.88dsf-41+deb7u1
=sysvinit-utils	2.88dsf-41+deb7u1
=tar	1.26+dfsg-0.1
=tasksel	3.14.1
=tasksel-data	3.14.1
=tcpdump	4.3.0-1
=telnet	0.17-36
=texinfo	4.13a.dfsg.1-10
=time	1.7-24
=traceroute	1:2.0.18-3
=tsconf	1.0-11
=ttf-dejavu-core	2.33-3
=tzdata	2013d-0wheezy1
=ucf	3.0025+nmu3
=udev	175-7.2
=usbutils	1:005-3
=util-linux	2.20.1-5.3
=vim-common	2:7.3.547-7
=vim-tiny	2:7.3.547-7
=vlan	1.9-3
=vncterm	1.1-4
=vzctl	4.0-1pve4
=vzprocps	2.0.11-2
=vzquota	3.1-2
=w3m	0.5.3-8
=wamerican	7.1-1
=wget	1.13.4-3
=whiptail	0.52.14-11.1
=whois	5.0.23
=x11-apps	7.7~2
=x11-common	1:7.7+3~deb7u1
=xauth	1:1.0.7-1
=xsltproc	1.1.26-14.1
=xz-utils	5.1.1alpha+20120614-2
=zlib1g	1:1.2.7.dfsg-13
