2

I would like to enable or disable certain options in the application software-properties-gtk via command-line.

Examples of the options that I am interested to control via command-line are shown below:

a b

I suspect the command software-properties-gtk --enable-component=ENABLE_COMPONENT would allow me to implement what I want. However, manpage does not elaborate what values can be used to replace ENABLE_COMPONENT.

$ software-properties-gtk -h
Usage: software-properties-gtk [options]

Options: -h, --help show this help message and exit -d, --debug Print some debug information to the command line -m, --massive-debug Print a lot of debug information to the command line -n, --no-update No update on repository change (useful if called from an external program). -t TOPLEVEL, --toplevel=TOPLEVEL Set x-window-id of the toplevel parent for the dialog (useful for embedding) -e ENABLE_COMPONENT, --enable-component=ENABLE_COMPONENT Enable the specified component of the distro's repositories --open-tab=OPEN_TAB Open specific tab number on startup --enable-ppa=ENABLE_PPA Enable PPA with the given name -k KEYSERVER, --keyserver=KEYSERVER Legacy option, unused --data-dir=DATA_DIR Use data files (UI) from the given directory

Appreciate instruction on using this command?

Sun Bear
  • 2,302

1 Answers1

2

On my Ubuntu 18.04 LTS I see the following:

$ software-properties-gtk --enable-component=main
The --enable-component/-e command-line switch has been 
deprecated. Instead of 'software-properties-gtk -e multiverse' 
you can use 'add-apt-repository multiverse'

So really you have to use

add-apt-repository component

where component is one of the following:

  • main - Canonical-supported free and open-source software.
  • universe - Community-maintained free and open-source software.
  • restricted - Proprietary drivers for devices.
  • multiverse - Software restricted by copyright or legal issues.

So the full commands would be

  • sudo add-apt-repository main
  • sudo add-apt-repository universe
  • sudo add-apt-repository restricted
  • sudo add-apt-repository multiverse

For Canonical Partners you can use the command shown below:

sudo add-apt-repository "deb http://archive.canonical.com/ubuntu $(lsb_release -cs) partner"

where lsb_release -cs will return the codename (bionic, focal, hirsute, etc) of your Ubuntu version.


Stuff to read:

  • man sources.list locally or online;
  • man add-apt-repository locally or online.
N0rbert
  • 99,918
  • Thanks. I just came to the same findings as you in 20.04. And to disable a component I should use sudo add-apt-repository -r main as an example. There is one other part that I have found a solution to yet and your answer has not mentioned. That is, how to enable/disable Canonical Partners in the Other Software Tab. Can you elaborate? Thanks. – Sun Bear Aug 02 '21 at 14:38
  • 1
    For partners you can use sudo add-apt-repository "deb http://archive.canonical.com/ubuntu $(lsb_release -cs) partner" . – N0rbert Aug 02 '21 at 14:58