Schlagworte: debian


Planet Debian Space Wallpaper

Von Daniel in Fotos, Debian22.02.11 German (DE) E-Mail
Schlagworte: , , ,


Reinstall Debian init.d scripts into default runlevels

The following zsh snippet allows you to re-install any missing startup/init.d links.

This can be useful/required when e.g. installing an upstart based distribution (like Ubuntu Lucid) has removed some of those, and you want them back after downgrading to Hardy or switching to Debian testing (like I just did).
(apt-get install --reinstall won't bring back those links; you would have to purge (apt-get purge) and reinstall the package instead, removing any other configuration of the package though)

It basically looks for any init scripts that are not present in /etc/rc?.d/S* and then looks at the packages' postinstallation script for an update-rc.d command.

It will not install anything, but only output them (and allows you to pipe it into "sh" for execution).

Worked fine on my "messed up" system, but has rather odd results on my Maverick desktop.


for i in /etc/init.d/* ; do
    a=( /etc/rc?.d/S*$i:t(N) );
    ((${#a})) && continue;
    package=$(dpkg -S $i 2>/dev/null |cut -d: -f1);
    [[ -z $package ]] && continue;
    echo "# $i: $package";
    grep "update-rc\.d $i:t" /var/lib/dpkg/info/$package.postinst;

(in case you need to extract the init script altogether, the following might help for starters:
dpkg-deb --extract /var/cache/apt/archives/$PACKAGE.deb /tmp/foo.)


Useful wrappers for apt-get, apt-source and apt-file


I've finally started to manage the setup of my dotfiles (configuration files) for shell, editor etc.
It is based on the popular dotfiles repository of ryanb and my fork can be found at github:blueyed/dotfiles.

While I'm still in the process of setting this up, I've just added the apt-* helpers I wrote some years ago:

They provide neat things like asrc -g hardy hello to get the version of the "hello" package from hardy (via "apt-get source" and the version number grepped from "apt-cache madison" - so you need to have it in your apt sources list, of course).
Also, ashow -g testing hello will show the package from Debian testing.

Apart from that these are mostly aliases, like "aup" for "sudo apt-get update" and some of them support shell completion (of package names) for e.g. "ainst" ("sudo apt-get install"). Shell completion works in both zsh and bash (at least).

You can get the file (to be sourced in a shell) from:

Feedback is very welcome and I am sure some of this is in packages like debian-goodies already (actually, there's nothing like that in _that_ package, but..).

Does it make sense to add (parts of) it to some package for easy installation across Debian/Ubuntu?