CLI alternative to software-properties-gtk
Mentioned at: Error :: You must put some 'source' URIs in your sources.list
sudo cp /etc/apt/sources.list /etc/apt/sources.list~
sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
sudo apt-get update
If you don't use either of those methods apt source
fails with error:
You must put some 'source' URIs in your sources.list
Minimal example with the hello
package
All of this and more is described at: https://www.debian.org/doc/manuals/maint-guide/build.en.html
First let's get a sample package to modify the source for:
sudo apt-get install hello
hello
outputs:
Hello, world!
Now let's hack it up. Get the source:
apt-get source hello
cd hello-*
and open:
vim src/hello.c
and modify the message to:
Hello, world hacked!
Then do the same on the test otherwise the annoying test will start failing:
vim tests/greeting-1
Then rebuild with:
sudo apt-get install devscripts
sudo apt-get build-dep hello
debuild -b -uc -us
Near the end of the output, it says:
dpkg-deb: building package 'hello' in '../hello_2.10-1build1_amd64.deb'.
so it created the .deb on the parent directory, how dare it. So finally we install and test the modified package:
sudo dpkg -i ../hello_2.10-1build1_amd64.deb
hello
and there you go, it outputs the new message:
Hello, world hacked!
Tested on Ubuntu 18.04.
Old bzr
answer
TODO: this stopped working on Ubuntu 16.04 Xenial, failing with: bzr: ERROR: Not a branch: "bzr+ssh://bazaar.launchpad.net/+branch/ubuntu/hello/".
. bzr branch lp:ubuntu/wily/hello
works and bzr branch lp:ubuntu/xenial/hello
fails again. For some reason https://code.launchpad.net/ubuntu/+source/hello does not show Xenial: https://web.archive.org/save/https://code.launchpad.net/ubuntu/+source/hello
As mentioned at https://askubuntu.com/a/81889/52975 there is also a Ubuntu-specific approach with bzr
.
Get the latest version:
bzr branch lp:ubuntu/hello
Specific version:
bzr branch lp:ubuntu/trusty/hello
You can also use pull-lp-source
:
sudo apt-get install ubuntu-dev-tools
pull-lp-source hello
Then you'll be able to edit it:
cd hello
vim some_file
Rebuild it:
dch -i
debcommit
bzr bd -- -b -us -uc
And install it:
sudo dpkg -i ../hello.deb
The Ubuntu packaging guide is a good source of information.
apt-get
does support closed-source programs as well, so your initial assumption is incorrect.