Get Sources for Every Installed Package on Debian


I'm not a lawyer and I can't afford one, so I've been searching the internet for information on how to legally sell new computers that come pre-installed with a free Linux distribution. What I've found so far seems to suggest that I could charge for the service of performing the install, and for the cost of the installation media, but I couldn't make any profit from the installation disk as this would mean the distribution wasn't free when it was supposed to be. This all seems perfectly fair (assuming people in web forums are right and it's true).

There is supposedly an additional requirement imposed by the GNU General Public License, which is that you must give the end user a copy of the source code for the exact version of every GPL licensed piece of software that you put on the system. If you don't want to do that, you need to set up some means of internet distribution which your clients can log in to and download the source code at a later date. If you don't want to do either of those two things, the final option is that you could give the customer a written message with their new computer saying that they are able to request the source code for their GPL software at any time and that they will receive it free of charge. I think this is also very reasonable, but it could be a bit of a headache for some people to sort out all the packages unless they have some command line skills.

For a Debian system, it's actually quite easy to get the sources for every installed package, but I couldn't find it documented anywhere online and had to figure it out for myself, so as usual I made a tutorial page for my method.

Here's how to get the sources for every package on your Debian system:

Make a new folder somewhere to store the sources, then go into it:
mkdir debian_sources
cd debian_sources

Run this command to create a file containing all installed package names:
dpkg -l | tail -n+6 | cut -d" " -f3 | tr -s "\n" " " > installed_packages

Next, run this command:
apt-get source --download-only `cat installed_packages`

If the previous command fails because the source of a package isn't available (maybe it's non-free or third-party), remove the package in question from your installed_packages file, then run the command again and repeat until the command succeeds.

If everything went right, you now have a directory full of the sources for the exact versions of every piece of free software on your Debian system. I am going to distribute this to customers by burning the contents of the folder to DVD-R and giving it to them along with their new Linux computer.

Again, I am not a lawyer and I take no responsibility for anything if the information presented on this web page is incorrect.


Enjoy!

Was this tutorial helpful? Toss me a few bucks if you're feeling generous.


Comments

Display Name: Matt Posted On:
2011-08-16 11:26:18 EST
Subject: Caution about this
Comment:
I'm trying to download the source for everything that's on another live
CD, but I haven't been able to find a method to do so.
I believe this
only retrieves the latest source version for all installed package. This
works if you distribute the latest versions of the binary packages, but may
not work if you're distributing an install directly from a release
CD.
Debian and Ubuntu have source CD/DVDs that correspond to their
installer CDs that you should use in that case.

Display Name: Defcronyke Webmaster Posted On:
2011-08-17 00:26:21 EST
Subject: Re: Caution about this
Comment:
Thank you for pointing that out Matt. I would hope people ship software
that's up-to-date when selling Linux computers, but if that's not an
option for whatever reason, you would certainly need the sources for the
package versions from your install CD. Get the official source disk in that
case.


Post a Comment

Display Name:
Email Address:
Subject:
Comment:

NOTE: Your email address will only be seen by the webmaster, and will not be used to send you anything. Your IP address will be logged, but not displayed publicly.


Reload Image
Code:




Go back to Tutorials


This tutorial is copyright © 2011 Defcronyke Webmaster, The Eternal Void Network. It may only be linked to with permission from the original author. If you provide reference to it anywhere, please give credit to the author.



Number of Unique Hits: 00000221
Privacy Policy