[vox-tech] Installing subversion from sid into a sarge box

Rick Moen rick at linuxmafia.com
Tue Jan 4 18:50:34 PST 2005


Quoting Jay Strauss (me at heyjay.com):

> After reading the apt manual, I seems like I should be able to add the 
> unstable tree into my sources.list, add an entry into my 
> /etc/apt/apt.conf like:
> 
> APT::Default-Release "testing"; # to keep everything at sarge
> 
> And I'm good to go.

According to "man 5 apt_preferences", this is the _correct_ way to solve
the problem.  (Me, I'm a lamer and thus quit studying the manpage the 
moment I found a NON-standard solution to the problem that works.  More
about that near the end.)

> But, I don't have a /etc/apt/apt.conf [...]
> 
> Am I supposed just create this file myself?

Yep.

I created an /etc/apt/apt.conf file for a completely _unrelated_ reason,
to accomplish this bit of coolness:

:r! /etc/apt/apt.conf

DPkg {
        // Auto re-mounting of a readonly /usr
        Pre-Install-Pkgs {"/home/rick/aptdpkgro.sh";};
        Pre-Invoke {"mount -o remount,rw /usr";};
        Post-Invoke {"/home/rick/aptdpkgclean.sh; mount -o remount,ro /usr";};
}


/home/rick/aptdpkgro.sh is:

#!/bin/sh

pathmatch="^/usr"

while read debname; do
	pkg=$(dpkg --info $debname | sed -n 's/^ Package: *//p' | head -1)
	(dpkg -L "$pkg" 2>/dev/null || true) | grep "$pathmatch" |
	  while read file; do
		[ -f "$file" -a ! -L "$file" ] || continue
		dir=`dirname "$file"`;
		base=`basename "$file"`;
		inode=`find "$file" -printf "%i\n"`
		(cd "$dir" && ln "$base" ".${base}.dpkg-ro-used.$inode")
		echo "$dir/.${base}.dpkg-ro-used.$inode"
	  done >>/var/lib/my_ro_hack.todel
done



/home/rick/aptdpkgclean.sh is:

#!/bin/sh

pathmatch="^/usr"

cat /var/lib/my_ro_hack.todel | while read file; do
	[ -f "$file" ] || continue
	N1=`find "$file" -printf "%i\n"`

	b=`basename $file`; d=`dirname $file`
	XF="${b#.}"; XF="$d/${XF%.dpkg-ro-used.*}"
	N2=`find "$XF" -printf "%i\n"`

	if [ "$N1" != "$N2" ] && ! fuser -s "$file"; then
		rm -f "$file"
	else
		echo "$file"
	fi
done >/var/lib/my_ro_hack.todel.new
mv /var/lib/my_ro_hack.todel.new /var/lib/my_ro_hack.todel




Anyhow, my lame, slacker, non-orthodox solution to the problem is to NOT
declare a default release in /etc/apt/apt.conf, but instead put these
three lines into /etc/apt/preferences:


Package: *
Pin: release a=unstable
Pin-Priority: 50


Then, /etc/apt/sources.list gets lines for both testing and unstable,
then I do "aptitude update"[1], et voila.  Works for Me<tm>.

The full, very verbose explanation for why that works is apparently in
the apt_preferences manpage, but, being a lazy git, I've never taken the
time to properly read that. 

[1] See:  "Aptitude" on http://linuxmafia.com/kb/Debian/



More information about the vox-tech mailing list