Quantcast
Viewing latest article 7
Browse Latest Browse All 7

Answer by Otto Kekäläinen for How to automatically update /etc/apt/sources.list with source URIs on Ubuntu 16.04?

You can safely run this snipped as root on any Debian/Ubuntu system:

if [ -f /etc/apt/sources.list ]then  grep '^deb ' /etc/apt/sources.list | \    sed 's/^deb /deb-src /g'> /etc/apt/sources.list.d/sources-list-with-deb-src.listfiif [ -f /etc/apt/sources.list.d/debian.sources ]then  sed 's/Types: deb/Types: deb deb-src/g' -i /etc/apt/sources.list.d/debian.sourcesfi

This will work both on old Ubuntu/Debian releases as the if clause will automatically detect if the system has the old or new apt repository configuration format. No other replies to this question were considering the possibility of the new sources file syntax (https://manpages.debian.org/unstable/apt/sources.list.5.en.html).

Code copied from https://salsa.debian.org/otto/debcraft/-/blob/e6e8a36a700b4ad46f0bc0f44c88def3dd680e9e/src/container/enable-source-repositories.sh which has a longer explanation.


Viewing latest article 7
Browse Latest Browse All 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>