[26614] in Source-Commits
/svn/athena r25654 - in trunk/debathena/debathena: . thirdparty-installer thirdparty-installer/debian
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Tue Jul 24 16:25:43 2012
Date: Tue, 24 Jul 2012 16:25:41 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201207242025.q6OKPftU007314@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2012-07-24 16:25:40 -0400 (Tue, 24 Jul 2012)
New Revision: 25654
Added:
trunk/debathena/debathena/thirdparty-installer/
trunk/debathena/debathena/thirdparty-installer/debian/
trunk/debathena/debathena/thirdparty-installer/debian/changelog
trunk/debathena/debathena/thirdparty-installer/debian/compat
trunk/debathena/debathena/thirdparty-installer/debian/control
trunk/debathena/debathena/thirdparty-installer/debian/copyright
trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.dirs
trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.install
trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.postinst
trunk/debathena/debathena/thirdparty-installer/debian/generate-package-list.pl
trunk/debathena/debathena/thirdparty-installer/debian/rules
trunk/debathena/debathena/thirdparty-installer/debian/thirdparty
Log:
In thirdparty-installer:
* Initial release.
Added: trunk/debathena/debathena/thirdparty-installer/debian/changelog
===================================================================
--- trunk/debathena/debathena/thirdparty-installer/debian/changelog (rev 0)
+++ trunk/debathena/debathena/thirdparty-installer/debian/changelog 2012-07-24 20:25:40 UTC (rev 25654)
@@ -0,0 +1,5 @@
+debathena-thirdparty-installer (1.0) unstable; urgency=low
+
+ * Initial release.
+
+ -- Jonathan Reed <jdreed@mit.edu> Wed, 18 Jul 2012 13:25:48 -0400
Added: trunk/debathena/debathena/thirdparty-installer/debian/compat
===================================================================
--- trunk/debathena/debathena/thirdparty-installer/debian/compat (rev 0)
+++ trunk/debathena/debathena/thirdparty-installer/debian/compat 2012-07-24 20:25:40 UTC (rev 25654)
@@ -0,0 +1 @@
+7
Added: trunk/debathena/debathena/thirdparty-installer/debian/control
===================================================================
--- trunk/debathena/debathena/thirdparty-installer/debian/control (rev 0)
+++ trunk/debathena/debathena/thirdparty-installer/debian/control 2012-07-24 20:25:40 UTC (rev 25654)
@@ -0,0 +1,14 @@
+Source: debathena-thirdparty-installer
+Section: debathena/base
+Priority: extra
+Standards-Version: 3.9.1
+Maintainer: Debathena Project <debathena@mit.edu>
+Build-Depends: cdbs, debhelper (>= 6)
+
+Package: debathena-thirdparty-installer
+Architecture: all
+Depends: libapt-pkg-perl, ${misc:Depends}
+Description: Debathena thirdparty software installer
+ This ships an installer that installs "third party software" in a
+ separate APT transaction. It is only intended for use on public,
+ IS&T-maintained workstations.
Added: trunk/debathena/debathena/thirdparty-installer/debian/copyright
===================================================================
--- trunk/debathena/debathena/thirdparty-installer/debian/copyright (rev 0)
+++ trunk/debathena/debathena/thirdparty-installer/debian/copyright 2012-07-24 20:25:40 UTC (rev 25654)
@@ -0,0 +1,31 @@
+This software and its Debian packaging are licensed as follows:
+
+Copyright (c) 2012, Massachusetts Institute of Technology
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of the Massachusetts Institute of Technology
+ nor the names of its contributors may be used to endorse or
+ promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MASSACHUSETTS
+INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
Added: trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.dirs
===================================================================
--- trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.dirs (rev 0)
+++ trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.dirs 2012-07-24 20:25:40 UTC (rev 25654)
@@ -0,0 +1 @@
+var/lib/debathena-thirdparty
Added: trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.install
===================================================================
--- trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.install (rev 0)
+++ trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.install 2012-07-24 20:25:40 UTC (rev 25654)
@@ -0,0 +1,2 @@
+debian/generate-package-list.pl usr/lib/debathena-thirdparty
+debian/thirdparty usr/sbin
Added: trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.postinst
===================================================================
--- trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.postinst (rev 0)
+++ trunk/debathena/debathena/thirdparty-installer/debian/debathena-thirdparty-installer.postinst 2012-07-24 20:25:40 UTC (rev 25654)
@@ -0,0 +1,41 @@
+#!/bin/sh
+# postinst script for debathena-thirdparty-installer
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ touch /var/lib/debathena-thirdparty/update_required
+ echo "ok|Package configured" > /var/lib/debathena-thirdparty/status
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
Added: trunk/debathena/debathena/thirdparty-installer/debian/generate-package-list.pl
===================================================================
--- trunk/debathena/debathena/thirdparty-installer/debian/generate-package-list.pl (rev 0)
+++ trunk/debathena/debathena/thirdparty-installer/debian/generate-package-list.pl 2012-07-24 20:25:40 UTC (rev 25654)
@@ -0,0 +1,143 @@
+#!/usr/bin/perl
+
+$| = 1;
+use warnings;
+use strict;
+use locale; # for sort
+
+use Getopt::Std;
+use AptPkg::Config '$_config';
+use AptPkg::Cache;
+
+our ($opt_n, $opt_d, $opt_c) = (0,
+ '/afs/athena.mit.edu/system/athena10/thirdparty',
+ '/var/lib/debathena-thirdparty');
+
+getopts('nd:c:');
+
+sub debug {
+ if ($opt_n) {
+ print join(' ', 'D:', @_, "\n");
+ }
+}
+
+
+my $codename = `/usr/bin/lsb_release -sc`;
+die "Can't determine codename" unless ($? == 0);
+chomp($codename);
+
+(-d $opt_d) || die "$opt_d is not a directory";
+(-d $opt_c) || die "$opt_c is not a directory";
+
+# Initialize the APT configuration
+$_config->init;
+my $cache = AptPkg::Cache->new;
+my $policy = $cache->policy;
+
+my %packages = ();
+my %depends = ();
+
+open(COMMON, join('/', $opt_d, 'common')) || die "Can't open $opt_d/common";
+debug("Reading 'common' file...");
+while (<COMMON>) {
+ chomp;
+ s/^\s+//;
+ s/\s+$//;
+ next if /^#/;
+ next unless /\S/;
+ if (/^-/) {
+ warn "Ignoring invalid package exclusion in the common file, line $.";
+ next;
+ }
+ if (/^(\S+) \| (\S+)$/) {
+ debug("Examining conditional line: $_");
+ foreach my $p ($1, $2) {
+ debug("Checking for $p");
+ if ($cache->{$p} && $cache->{$p}->{VersionList}) {
+ debug("Adding $p to dependencies");
+ $packages{$p} = 1;
+ last;
+ }
+ }
+ unless (exists($packages{$1}) || exists($packages{$2})) {
+ warn "Could not satisfy conditional dependency: $_!";
+ }
+ } elsif (/^(\S+)(?: (\S+))+$/) {
+ my ($pkg1, @rest) = (split(' ', $_));
+ $packages{$pkg1} = 1;
+ $depends{$pkg1} = \@rest;
+ } elsif (/^\?(\S+)$/) {
+ debug("Adding $1 to recommendations");
+ $packages{$1} = 2;
+ } else {
+ debug("Adding $_ to dependencies");
+ $packages{$_} = 1;
+ }
+}
+close(COMMON);
+
+open(DIST, join('/', $opt_d, $codename)) || die "Can't open $opt_d/$codename";
+debug("Reading distro-specific file");
+while (<DIST>) {
+ chomp;
+ s/^\s+//;
+ s/\s+$//;
+ next if /^#/;
+ next unless /\S/;
+ if (/^-(\S+)$/) {
+ if (exists($packages{$1})) {
+ debug("Deleting $1 from package list.");
+ delete($packages{$1});
+ } else {
+ warn("Package $1 is not in package list, so can't remove it.");
+ }
+ } elsif (/^\?(\S+)$/) {
+ debug("Adding $1 to recommendations");
+ $packages{$1} = 2;
+ } else {
+ debug("Adding $_ to dependencies");
+ $packages{$_} = 1;
+ }
+}
+close(DIST);
+
+foreach my $pkgname (sort(keys(%packages))) {
+ my $pkg = $cache->{$pkgname};
+ if (! $pkg) {
+ debug("Removing $pkgname as it can't be found in the APT cache.");
+ delete($packages{$pkgname});
+ if (exists($depends{$pkgname})) {
+ foreach (@{$depends{$pkgname}}) {
+ debug("Removing $_ because we removed $pkgname");
+ delete($packages{$_});
+ }
+ }
+ next;
+ }
+ if (! $pkg->{VersionList}) {
+ debug("Removing $pkgname as it has no version candidate");
+ delete($packages{$pkgname});
+ if (exists($depends{$pkgname})) {
+ foreach (@{$depends{$pkgname}}) {
+ debug("Removing $_ because we removed $pkgname");
+ delete($packages{$_});
+ }
+ }
+ next;
+ }
+}
+
+debug("Writing out lists");
+open(DEPS, '>', join('/', $opt_c, 'dependencies')) || die "Can't open $opt_c/dependencies for writing";
+open(RECS, '>', join('/', $opt_c, 'recommendations')) || die "Can't open $opt_c/dependencies for writing";
+foreach (sort(keys(%packages))) {
+ if ($packages{$_} == 2) {
+ print RECS "$_\n";
+ } else {
+ print DEPS "$_\n";
+ }
+}
+close(DEPS);
+close(RECS);
+exit 0;
+
Property changes on: trunk/debathena/debathena/thirdparty-installer/debian/generate-package-list.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/debathena/debathena/thirdparty-installer/debian/rules
===================================================================
--- trunk/debathena/debathena/thirdparty-installer/debian/rules (rev 0)
+++ trunk/debathena/debathena/thirdparty-installer/debian/rules 2012-07-24 20:25:40 UTC (rev 25654)
@@ -0,0 +1,3 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
Property changes on: trunk/debathena/debathena/thirdparty-installer/debian/rules
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/debathena/debathena/thirdparty-installer/debian/thirdparty
===================================================================
--- trunk/debathena/debathena/thirdparty-installer/debian/thirdparty (rev 0)
+++ trunk/debathena/debathena/thirdparty-installer/debian/thirdparty 2012-07-24 20:25:40 UTC (rev 25654)
@@ -0,0 +1,131 @@
+#!/bin/sh
+#
+# debathena-thirdparty-installer
+
+GENLIST=/usr/lib/debathena-thirdparty/generate-package-list.pl
+LISTDIR=/afs/athena.mit.edu/system/athena10/thirdparty
+CACHEDIR=/var/lib/debathena-thirdparty
+LOG=/var/log/athena-thirdparty
+STATFILE=/var/lib/debathena-thirdparty/status
+FLAGFILE=/var/lib/debathena-thirdparty/update_required
+
+status=ok
+statusmsg="Nothing to do"
+
+complain() {
+ status="error"
+ statusmsg="$*"
+}
+
+whine() {
+ status="warning"
+ statusmsg="$*"
+}
+
+save_state() {
+ rm -f $statfile
+ echo "$status|$statusmsg" > $STATFILE
+}
+
+save_success() {
+ status="ok"
+ statusmsg="$*"
+}
+
+finish() {
+ echo "*Ending auto-update at $(date)"
+ echo "-----"
+ echo
+ rm -f /var/run/athena-nologin
+ save_state
+ exit
+}
+
+should_install() {
+ if apt-get -s install "$@" | egrep -q '^Remv debathena-(cluster|workstation|login-graphical|login|standard) '; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+
+
+
+install() {
+ if [ 0 != "$(id -u)" ]; then
+ echo "Root privileges required for installation." >&2
+ exit 1
+ fi
+ touch /var/run/athena-nologin
+ exec 3>&1
+ exec >> $LOG 2>&1
+ trap finish EXIT
+ echo "** Beginning thirdparty installation at $(date)"
+ echo "Generating package list..."
+ if ! /usr/lib/debathena-thirdparty/generate-package-list.pl -d "$LISTDIR" -c "$CACHEDIR"; then
+ exit 1
+ fi
+ export DEBIAN_FRONTEND=noninteractive
+ echo "** Required package list:"
+ cat "${CACHEDIR}/dependencies"
+ echo "** Trying monolithic transaction..."
+ if should_install $(cat ${CACHEDIR}/dependencies) &&
+ apt-get -y install $(cat ${CACHEDIR}/dependencies); then
+ echo "**Monolithic transaction succeeded"
+ else
+ echo "** Installing required packages one by one..."
+ for pkg in $(cat "${CACHEDIR}/dependencies"); do
+ echo "** Installing $pkg..."
+ if ! should_install $pkg; then
+ echo "** Installation of $pkg is IMPOSSIBLE"
+ complain "Some required packages failed to install"
+ else
+ apt-get -y install $pkg
+ if [ $? != 0 ]; then
+ echo "** Installation of $pkg FAILED"
+ complain "Some required packages failed to install"
+ fi
+ fi
+ done
+ fi
+ echo "** Recommended package list:"
+ cat "${CACHEDIR}/recommendations"
+ echo "** Installing recommended packages..."
+ for pkg in $(cat "${CACHEDIR}/recommendations"); do
+ echo "** Installing $pkg..."
+ if ! should_install $pkg; then
+ echo "** Installation of $pkg is IMPOSSIBLE"
+ whine "Some required packages failed to install"
+ else
+ apt-get -y install $pkg
+ if [ $? != 0 ]; then
+ echo "** Installation of $pkg FAILED"
+ whine "Some recommended packages failed to install"
+ fi
+ fi
+ done
+ rm $FLAGFILE
+ save_success "Packages installed ok"
+}
+
+case "$1" in
+ install)
+ install
+ ;;
+ up-to-date)
+ if [ -e "$FLAGFILE" ]; then
+ exit 1
+ else
+ exit 0
+ fi
+ ;;
+ *)
+ echo "Usage: $0 [install | up-to-date]"
+ exit 1
+ ;;
+esac
+exit 0
+
+
+
Property changes on: trunk/debathena/debathena/thirdparty-installer/debian/thirdparty
___________________________________________________________________
Added: svn:executable
+ *