I run RaspBMC – a distro based on Raspbian, that's a custom minimal Debian for the Raspberry Pi.
If I recall correctly, the man
utility is NOT installed by default with RaspBMC (although I may be mistaken).
The problem is, packages installed prior to installing the actual man
utility do not install their man pages. This includes the packages that come pre-installed with the system.
Example: I tried with udisks-glue (which comes pre-installed)
$ man udisks-glue
No manual entry for udisks-glue
After re-installing that package, the man page is there.
$ apt-get remove udisks-glue
$ apt-get install udisks-glue
$ man udisks-glue
[Man page gets displayed]
The question is: can I somehow install all the missing man pages easily?
From what I can see, installing the man pages is a step that's run for each apt-get install
command:
Unpacking udisks-glue (from .../udisks-glue_1.3.4-1_armhf.deb) ...
Processing triggers for man-db ...
[...]
Using divide-and-conquer, I assume this could be obtained by:
- getting a list of all installed packages (
dpkg -l | grep ??? | cut ??? | ???
) - finding a way to tell apt-get to re-install a package without messing with the config (a
remove + install
kinda fits the bill, but I don't think it plays nice with dependencies)
EDIT: this should do it:
sudo apt-get install --reinstall packagename
- run 2. over each item in 1.
Is this the (simplest) way to go?
Update
I remembered I bricked RaspBMC once doing apt-get upgrade
, so I want to make sure the packages are NOT upgraded to newer versions when reinstalling (which seems to be the case with apt-get install --reinstall
by default.
Best Answer
Starting from @derobert's answer, I worked my way to getting exactly the current version of all packages to reinstall.
Short version:
Explained:
The key is actually specifying the required version of each package.
The general command is:
Breaking down the long command line:
...gets rid of the header lines and a few packages with status '
hold
' (marked ashi
instead ofii
)... converts any number of spaces to a single TAB character, preparing the ground for
cut
.(Btw: why, oh why, doesn't
sed
supportx+
regex for "character x, one or more times"? It can be emulated withxx*
- meaning 'x' once followed by 'x' zero or more times)The output looks like this:
Next:
...gets the name and version of each package (the 2nd and 3rd fields), and replaces the tab that separates them with an '='
Finally, pipe each of the above to apt-get as a long list of arguments using
xargs
.Notice the parameter
--ignore-missing
- this command is run as 'best effort' - I don't want the updating to stop because some packages are not available to reinstall (those will stay unmodified)While testing, I also added a
--dry-run
argument to apt-get.