Without any express or implied warranty, the following workaround worked for me. It searches for any "deb" lines for ppa sources, and adds the corresponding "deb-src" line after it. Furthermore, it makes an effort not to introduce consecutive duplicate lines, and it keeps backups.
sudo perl -lanE '
BEGIN { my $prev_line; }
print if $_ ne $prev_line;
$prev_line = $_ unless m{^\s*(#|$)};
if (m{\Qdeb http://ppa.launchpad.net}) {
s/^deb/deb-src/; print;
$prev_line = $_;
}' -iBACKUP /etc/apt/sources.list.d/*.list
Without any express or implied warranty, the following workaround worked for me. It searches for any "deb" lines for ppa sources, and adds the corresponding "deb-src" line after it. Furthermore, it makes an effort not to introduce consecutive duplicate lines, and it keeps backups.
sudo perl -lanE ' ppa.launchpad. net}) { deb/deb- src/; print; sources. list.d/ *.list
BEGIN { my $prev_line; }
print if $_ ne $prev_line;
$prev_line = $_ unless m{^\s*(#|$)};
if (m{\Qdeb http://
s/^
$prev_line = $_;
}' -iBACKUP /etc/apt/