[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cross-apt

(replying to myself)
On Mon, May 07, 2001 at 05:52:28PM +0000, Joseph Lunderville wrote:
> > > installation natively. I'm hoping to get apt to print out what it would 
> >do
> > > with dpkg without actually doing it, so I can generate a script to be
> > > executed in the hurd once I reboot.

I finally got around to finishing this, and it seems to have worked.
details at bottom..

> >Yes, I've been trying this myself and am realizing it's a little more 
> >complicated that I anticipated. I did find some useful information at:
> >
> >	/usr/share/doc/apt/offline.html/index.html

oop, it's always good to read the documentation that comes with the
software, isn't it? :) this confirmed most of my suspicions, anyhow.

> >I'm definitely interested in comparing with whatever you generate as well.

well, here we are:

mostly, I set apt up like you would to do a network install like in
the docs (but to my hurd partition on the same box, instead) -- with
apt downloading the files from in linux, then dpkg installing them
from in the hurd. the difference is that I don't have any network
connection in the hurd at all, so I'm forced to reboot between linux
and the hurd on the same machine.

I wanted to handle the package installation ordering automatically,
though, so I wrote a script to build a log of what apt tries to do
with dpkg in linux, then reconstruct that sequence of dpkg calls once
I rebooted into the hurd. it worked once on a dist-upgrade, but no
guarantees, because I only barely know what I'm doing :)

I made two scripts and a bunch of symlinks in /usr/local/sbin:

------ls -l /usr/local/sbin------
total 8
-rwxr-xr-x    1 root     staff          63 Apr 25 11:25 hurd-apt-get
lrwxrwxrwx    1 root     staff          16 Apr 28 13:40 \
	hurd-dpkg -> hurd-dpkg-logger
lrwxrwxrwx    1 root     staff          16 Apr 28 13:41 \
	hurd-dpkg-buildpackage -> hurd-dpkg-logger
-rwxr-xr-x    1 root     staff         988 May  7 09:28 hurd-dpkg-logger
lrwxrwxrwx    1 root     staff          16 Apr 28 13:41 \
	hurd-dpkg-source -> hurd-dpkg-logger


export APT_CONFIG=/etc/hurd-apt/apt.conf
apt-get $*

# translate the hurd-dpkg* command to a dpkg* command
# the : cannot appear in the hurd root because of the sed command
DIRECTORY="`pwd | sed -e "s:^$HURD_ROOT:/:"`"
# these commands will contain absolute filenames which must have $HURD_ROOT
# stripped: -i --install --unpack -A --record-avail
COMMAND="`echo "$0" | sed -e "s:^$HURD_DPKG:$REAL_DPKG:"`\
 `echo $* | sed -e "s:$HURD_ROOT:/:g"`"
echo "appending: execute \"$COMMAND\" (pwd \"$DIRECTORY\")"
# make sure we're in the right directory to execute the command ..?
# .. probably not necessary
# echo "cd \"$DIRECTORY\"" >> $DPKG_LOG
echo "$COMMAND || (echo "failed execution of \"$COMMAND\"! aborting." >2;\
 exit)" >> $DPKG_LOG
echo "echo \"executed $COMMAND successfully\" >> $DPKG_LOG_EXEC_LOG"\

I made a configuration directory for apt containing the hurd's apt.conf
and sources.list:

  Architecture "hurd-i386";

// Options for the downloading routines
  Retries "0";

// Things that affect the APT dselect method
  Clean "auto";

  // modify this to point to your config files (apt.conf, sources.list)
  Etc "/etc/hurd-apt/";
  // replace /mnt/hurd with your main hurd partition's mount point
  Cache "/mnt/hurd/var/local/cache/apt/";
  State "/mnt/hurd/var/local/lib/apt/"
    Status "/mnt/hurd/var/lib/dpkg/status";
    // and, of course, replace /usr/local/sbin with wherever your
    // hurd-dpkg scripts are kept
    dpkg "/usr/local/sbin/hurd-dpkg";
    dpkg-source "/usr/local/sbin/hurd-dpkg-source";
    dpkg-buildpackage "/usr/local/sbin/hurd-dpkg-buildpackage";

deb http://http.us.debian.org/debian sid main contrib non-free
deb http://non-us.debian.org/debian-non-US sid/non-US main contrib non-free

# you won't get past the start line without this source!
deb ftp://alpha.gnu.org/gnu/hurd/debian unstable main

# Uncomment if you want the apt-get source function to work
#deb-src http://http.us.debian.org/debian sid main contrib non-free
#deb-src http://non-us.debian.org/debian-non-US sid non-US

also, I made a directory /var/local/dpkg-logger in the hurd
partition. this directory is where the hurd-dpkg-logger script puts
its logs.

basically, you run:
# hurd-apt-get update
# hurd-apt-get install <packages>
# hurd-apt-get upgrade
or ...

then, reboot into the hurd, and run
# sh /var/local/dpkg-logger/dpkg-log

after every dpkg command that executes successfully, this script
appends a line to /var/local/dpkg-logger/dpkg-log-exec-log. if
there's a failure, hopefully it should abort (dpkg hasn't failed yet,
but we'll see what happens in good time, I'm sure. I think it will
involve a lot of rebooting :P ).

-apt-get in linux and dpkg in the hurd have different ideas about
 what the paths to files are
 -the wholesale sed replacement of the hurd mount point is mildly
-the dialogue between dpkg and apt is interrupted
 -too much rebooting!
-...problems I didn't see?

if this solution turns out to be not as alright as it seems, I might
try to set up a ppp or plip (is there a hurd plip driver?) connection
between my hurd box and the linux box in the other room.

Reply to: