diff --git a/actions/packages b/actions/packages index 3e9282762..9167fdd1f 100755 --- a/actions/packages +++ b/actions/packages @@ -38,6 +38,9 @@ def parse_arguments(): subparsers.add_parser('update', help='update the package lists') subparser = subparsers.add_parser('install', help='install packages') + subparser.add_argument( + '--skip-recommends', action='store_true', + help='whether to skip installing recommended packages') subparser.add_argument( 'module', help='name of module for which package is being installed') subparser.add_argument('packages', nargs='+', @@ -82,7 +85,11 @@ def subcommand_install(arguments): print('Access check failed:', exception, file=sys.stderr) sys.exit(99) - _run_apt_command(['install'] + arguments.packages) + if arguments.skip_recommends: + _run_apt_command( + ['install', '--no-install-recommends'] + arguments.packages) + else: + _run_apt_command(['install'] + arguments.packages) def _assert_managed_packages(module, packages): diff --git a/plinth/package.py b/plinth/package.py index de41429eb..897dcd812 100644 --- a/plinth/package.py +++ b/plinth/package.py @@ -69,7 +69,7 @@ class Transaction(object): self.percentage = 0 self.stderr = None - def install(self): + def install(self, skip_recommends=False): """Run an apt-get transaction to install given packages. FreedomBox Service (Plinth) needs to be running as root when calling @@ -79,7 +79,12 @@ class Transaction(object): """ try: self._run_apt_command(['update']) - self._run_apt_command(['install', self.module_name] + + if skip_recommends: + self._run_apt_command( + ['install', '--skip-recommends', self.module_name] + + self.package_names) + else: + self._run_apt_command(['install', self.module_name] + self.package_names) except subprocess.CalledProcessError as exception: logger.exception('Error installing package: %s', exception) diff --git a/plinth/setup.py b/plinth/setup.py index 5e9156f16..69002066c 100644 --- a/plinth/setup.py +++ b/plinth/setup.py @@ -100,7 +100,7 @@ class Helper(object): self.is_finished = True self.current_operation = None - def install(self, package_names): + def install(self, package_names, skip_recommends=False): """Install a set of packages marking progress.""" if self.allow_install is False: # Raise error if packages are not already installed. @@ -119,7 +119,7 @@ class Helper(object): 'step': 'install', 'transaction': transaction, } - transaction.install() + transaction.install(skip_recommends) def call(self, step, method, *args, **kwargs): """Call an arbitrary method during setup and note down its stage."""