From: Martin Pitt Date: Thu, 13 Oct 2016 11:28:36 +0000 (+0200) Subject: remove obsolete install-manifest X-Git-Url: https://piware.de/gitweb/?p=bin.git;a=commitdiff_plain;h=09cea64076c33632d41dad8f0692e959d40f9f41 remove obsolete install-manifest --- diff --git a/install-manifest b/install-manifest deleted file mode 100755 index a770d3b..0000000 --- a/install-manifest +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/python - -import urllib, sys, optparse, re, subprocess - -kernel_pkg_re = re.compile('^linux-(generic|firmware|headers|image|backports|ec2|source|virtual|preempt)') -no_remove_re = re.compile('^bcmwl-|^dkms|^grub|^xserver-xorg-video-intel|bootchart|^openssh-client') -no_install_re = re.compile('^ubiquity|^casper|debian-install|^cryptsetup|^dmsetup|^ecryptfs-utils|^parted|^redboot-tools|^tasksel|^aptitude|^os-prober|^devio') - -def parse_argv(): - '''Parse CLI options. - - Return (options, manifest) tuple. - ''' - - optparser = optparse.OptionParser('''%prog [options] - -Install/remove packages according to a CD build manifest. - can be a local file or URL.''') - optparser.add_option('-k', '--keep-kernel', - help='Do not change kernel packages', action='store_true', - dest='keep_kernel', default=False) - options, args = optparser.parse_args() - - if len(args) != 1: - optparser.error('You need to specify exactly one manifest argument, see --help') - sys.exit(1) - - return (options, args[0]) - -# -# main -# - -(options, manifest) = parse_argv() - -selection = '' -for l in urllib.urlopen(manifest): - pkg = l.split()[0] - if options.keep_kernel and kernel_pkg_re.match(pkg): - continue - if no_install_re.search(pkg): - continue - selection += '%s\tinstall\n' % pkg - -# add local kernel packages on --keep-kernel -dpkg = subprocess.Popen(['dpkg', '--get-selections'], - stdout=subprocess.PIPE) -for l in dpkg.stdout: - pkg, status = l.split() - if status != 'install': - continue - if options.keep_kernel and kernel_pkg_re.match(pkg): - selection += '%s\tinstall\n' % pkg - if no_remove_re.search(pkg): - selection += '%s\tinstall\n' % pkg - -# now apply the new selections -assert subprocess.call(['dpkg', '--clear-selections']) == 0 -dpkg = subprocess.Popen(['dpkg', '--set-selections'], stdin=subprocess.PIPE) -dpkg.communicate(selection) -assert dpkg.returncode == 0 - -# commit! -subprocess.call(['apt-get', 'dselect-upgrade'])