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

Re: [debian-installer] microdpkg



On Sun Aug 20, 2000 at 09:25:14PM -0700, Joey Hess wrote:
> 
> I think that just like dpkg, it should be split into two programs:
> microdpkg-deb to handles the low-level unpacking of packages, and 
> microdpkg, to do dependency checking, and so on. Maybe this will turn
> out not to make sense; some space might be saved if the two were
> combined. On the other hand, Erik Anderson might want to put
> microdpkg-deb in busybox -- Erik?
> 

I'm very open to the idea, after we agree on how to approach it.

Maybe I'm missing something though (I almost certainly am), but do we really
need a 'microdpkg-deb'?  Wouldn't just 'microdpkg' be enough?  When we go to
install the base system, we really just want to unpack the .debs and drop them
into place.  For this to take place we can do something like the following:

    #!/bin/sh
    # Lame 5 minute micro-dpkg shell script...
    # Erik Andersen <andersee@debian.org>

    if [ -z "$1" ]; then
	    echo "usage: udpkg packagename.deb"
	    exit 1;
    fi;

    FOO=`basename $1`
    PACKAGE=`echo $FOO | sed -e "s/_.*//g"`


    ROOT=/
    DPKG_INFO_DIR=/var/lib/dpkg/info/

    #For debugging only
    DPKG_INFO_DIR=/tmp/fff/info
    ROOT=/tmp/fff

    mkdir -p $DPKG_INFO_DIR
    ar -p $1 data.tar.gz | zcat | (cd $ROOT ; \
	    tar -xvf - > $DPKG_INFO_DIR/$PACKAGE.list)
    ar -p $1 control.tar.gz | zcat | (cd $DPKG_INFO_DIR ; \
	    tar -xf - )

    if [ -f $DPKG_INFO_DIR/postinst ] ; then
	mv $DPKG_INFO_DIR/postinst $DPKG_INFO_DIR/$PACKAGE.postinst
    fi
    if [ -f $DPKG_INFO_DIR/postrm ] ; then
	mv $DPKG_INFO_DIR/postrm $DPKG_INFO_DIR/$PACKAGE.postrm
    fi
    if [ -f $DPKG_INFO_DIR/preinst ] ; then
	mv $DPKG_INFO_DIR/preinst $DPKG_INFO_DIR/$PACKAGE.preinst
    fi
    if [ -f $DPKG_INFO_DIR/prerm ] ; then
	mv $DPKG_INFO_DIR/prerm $DPKG_INFO_DIR/$PACKAGE.prerm
    fi
    if [ -f $DPKG_INFO_DIR/md5sums ] ; then
	mv $DPKG_INFO_DIR/md5sums $DPKG_INFO_DIR/$PACKAGE.md5sums
    fi
    if [ -f $DPKG_INFO_DIR/control ] ; then
	mv $DPKG_INFO_DIR/control $DPKG_INFO_DIR/$PACKAGE.control
    fi

    exit 0;
     

If we really wanted to be cool, we could even use parse the control file, check
the depends and the md5sums and such.  I suspect doing that is overkill though.  

 -Erik

--
Erik B. Andersen   email:  andersee@debian.org
--This message was written using 73% post-consumer electrons--



Reply to: