-if options.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 kernel_pkg_re.match(pkg):
- selection += '%s\tinstall\n' % pkg
-
-if subprocess.call(['which', 'dselect'], stdout=subprocess.PIPE) != 0:
- print >> sys.stderr, 'INFO: installing dselect (needed by this script)'
- assert subprocess.call(['apt-get', 'install', 'dselect']) == 0
+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