Monday, May 20, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 3187  / 2 Years ago, mon, september 19, 2022, 2:57:31

Let's assume that we are using Ubuntu 18.04 LTS (Bionic Beaver).



I know GUI ways to enable or disable the following repositories:




  1. Important security updates (bionic-security)

  2. Recommended updates (bionic-updates)

  3. Pre-released updates (bionic-proposed)

  4. Unsupported updates (bionic-backports)



In KDE user may want to open Software & Updates (or software-properties-kde) and navigate to Updates tab.

In GNOME, MATE, Xfce user should open Software & Updates (or software-properties-gtk) and navigate to Updates tab for -security, -updates and -backports and Developer options tab for -proposed.



But how to enable or disable -updates, -security, -backports, -proposed repositories from commandline?



Note: I need a solution without direct editing of /etc/apt/sources.list.



Update: I created discussion and poll named "Does Ubuntu need console alternative for software-properties-gtk / software-properties-kde?" on community.ubuntu.com.


More From » command-line

 Answers
7

Note: I need a solution without direct editing of /etc/apt/sources.list.




Would using find and sed to comment out the lines be considered direct editing?



To disable these lines:



find /etc/apt -type f -name '*.list' -exec sed -i 's/(^deb.*-backports.*)/#1/; s/(^deb.*-updates.*)/#1/; s/(^deb.*-proposed.*)/#1/; s/(^deb.*-security.*)/#1/' {} +


Alternatively, we can just delete them:



find /etc/apt -type f -name '*.list' -exec sed -i '/-backports/d; /-updates/d; /-proposed/d; /-security/d' {} +


To enable them again:



find /etc/apt -type f -name '*.list' -exec sed -i 's/^#(deb.*-backports.*)/1/; s/^#(deb.*-updates.*)/1/; s/^#(deb.*-proposed.*)/1/; s/^#(deb.*-security.*)/1/' {} +

[#6745] Tuesday, September 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
iriousutur

Total Points: 321
Total Questions: 112
Total Answers: 106

Location: Sweden
Member since Mon, Dec 7, 2020
4 Years ago
;