/etc/apt/sources.list
Sometimes you can't get the right binary package of something you want to install. Here are two ways to build debian packages from (Perl) CPAN sources or debian sourcepackages.
Build and install a debian package from CPAN module:
#> dh-make-perl --build --install --cpan <modulename>
get dependencies and build the package:
#> apt-get build-dep <packagename> #> apt-get -b source <packagename>
Sometimes you want to keep an older version of a package even if you do an upgrade. This is how to do it.
#> echo "<package> hold" | dpkg --set-selections
This little script (placed in /etc/cron.weekly
) checks for new packages and sends a mail to the sysadmin to remeber him to upgrade.
#!/bin/sh HOSTNAME=`hostname` MAILTO="sysadmin@domain.com" MAILFROM="apt checker <sysadmin@domain.com>" apt-get update >/dev/null 2>&1 NEWPACKAGES=`apt-get --print-uris -qq -y upgrade 2>/dev/null |awk '{print $2}'` if [ ! -z "$NEWPACKAGES" ] then mail -a "From: $MAILFROM" -s "New Packages for $HOSTNAME" $MAILTO <<EOF There are new Packages available for $HOSTNAME: $NEWPACKAGES please run: ssh root@$HOSTNAME 'apt-get upgrade' EOF fi exit 0;
Note: the package cron-apt gives a similar functionality.
If you want to set a SUID bit on a file from a debian package with having the original permissions restored on each upgrade use dpkg-statoverride
:
#> dpkg-statoverride --update --add root root 2754 /path/to/binary
Sometimes (especially when using the unstable branch) a package is uninstallable because it contains a file which is already provided by another installed package. You can make DPKG ignore this conflict by removing the file from the file list of the installed package. This list is stored under /var/lib/dpkg/info/<package>.list
.
But you shouldn't do that, because it'll cause you problems later on. Instead, use:
dpkg-divert packagename –add /path/to/conflicting/file
What packagename should i use in that dpkg-divert call? The installed one or the one i want to install? -David
To check which files in a directory are not from an installed package you can use the following snippet:
#> for x in `find /usr/lib/`; do dpkg -S $x >/dev/null 2>&1 || echo $x; done