The dpkg_hurd you need for hurd_install
Hello,
I am a bit stupid today. You _need_ dpkg_hurd v0.3.1 for the hurd_install
script, and it is useful anyway, so here it is.
In future, I will upload those to master.debian.org/~brinkmd/hurd/.
Marcus
--
"Rhubarb is no Egyptian god." Debian GNU/Linux finger brinkmd@
Marcus Brinkmann http://www.debian.org master.debian.org
Marcus.Brinkmann@ruhr-uni-bochum.de for public PGP Key
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/ PGP Key ID 36E7CD09
#!/bin/sh
#
# Copyright (c) 1998 - This script is hereby placed in the public domain
# by Marcus Brinkmann.
#
# dpkg_hurd - poor man's dpkg.
#
# Usage - dpkg_hurd -i|--install package_*.deb [options]
# or - dpkg_hurd -r|--remove package [options]
# or - dpkg_hurd --purge package [options]
# or - dpkg_hurd -s|-L package
# or - dpkg_hurd -l|-S [pattern]
#
# [options] are passed through to dpkp. A good example is
# "--force-depends"
#
# Warning: This script is for bootstrapping a Debian/Gnu Hurd system
# onto an empty ext2 partition. The {pre,post}{inst,rem}
# scripts are not run.
#
# Change history:
# 19 Dec 1998 - v0.0 <Marcus.Brinkmann@ruhr-uni-bochum.de>
# Original created by Marcus Brinkmann.
# 22 Dec 1998 - v0.1 Jeff Sheinberg <jeffsh@erols.com>
# Error checking, automatic update of status file.
# 24 Dec 1998 - v0.2 Jeff Sheinberg <jeffsh@erols.com>
# Remove by package name, fix bugs in name.list file creation.
# TODO - add lockfile and trap exit & int, merge with deb_remove.
# 28 Dec 1998 - v0.3 Marcus Brinkmann <brinkmd@debian.org>
# Extract package name from deb file, not from file name.
# Rebuild package w/o install scripts and use dpkg directly.
# Added -r and -p as well as -s,-S,-l,-L options.
# 1 Jan 1999 - v0.3.1 Marcus Brinkmann <brinkmd@debian.org>
# TODO - fix all those race conditions and use proper tmp dir!
set -u -e
PS4='+$LINENO: '
err ()
{
echo "$0: $1" 1>&2
exit 1
}
vld="var/lib/dpkg"
vldi="${vld}/info"
[ -d ./${vld} ] || \
err "cd is \`$PWD', must be run from a dpkg root directory"
[ -d ./lost+found ] || \
err "cd is \`$PWD', must be run from a partition root filesystem directory"
[ -L ./usr -a ./ -ef usr/ ] \
|| err "cd is \`$PWD', must be run from a hurd root filesystem directory"
# [ "$#" == 2 ] || err "exactly two arguments, an action and a *.deb file or package name is required"
if [ "${1}" == "-i" -o "${1}" == "--install" ] ; then
file="${2}"
name=`dpkg --info ${file} | grep Package - | sed -e "s/ Package: //"`
[ -f ${file} ] || err "file \`${file}' does not exist"
# Construct directory hierarchie
ctrl=temp_build/${name}/DEBIAN
mkdir -m 0755 -p ${ctrl}
# Extract the files from the .deb archive.
dpkg-deb --extract ${file} ${ctrl}/..
# Extract control info and create control files.
dpkg-deb --control ${file} ${ctrl}
# Move the package scripts out of the build dir.
for f in preinst postinst prerm postrm
do
if [ -e ${ctrl}/${f} ] ; then
mv ${ctrl}/${f} temp_build/
fi
done
# Now repack the file.
dpkg --build temp_build/${name}
# Move old prerm and postrm scripts out of the way.
for f in prerm postrm
do
if [ -e ${vldi}/${name}.${f} ] ; then
mv ${vldi}/${name}.${f} ${vldi}/${name}.${f}.backup
fi
done
shift
shift
dpkg --root=. --force-architecture --install ${@-} temp_build/${name}.deb
# Move new package scripts into dpkg's repository
for f in preinst postinst prerm postrm
do
if [ -e temp_build/${f} ] ; then
mv temp_build/${f} ${vldi}/${name}.${f}
fi
if [ -e ${vldi}/${name}.${f}.backup ] ; then
rm ${vldi}/${name}.${f}.backup
fi
done
# Clean temp directory.
rm -fR temp_build
exit 0
fi
if [ "${1}" == "-r" -o "${1}" == "--remove" -o "${1}" == "--purge" ] ; then
action="${1}"
name="${2}"
# Move old prerm and postrm scripts out of the way.
for f in prerm postrm
do
if [ -e ${vldi}/${name}.${f} ] ; then
mv ${vldi}/${name}.${f} ${vldi}/${name}.${f}.backup
fi
done
shift
shift
dpkg --root=. --force-architecture ${action} ${@-} ${name}
for f in prerm postrm
do
if [ -e ${vldi}/${name}.${f}.backup ] ; then
rm ${vldi}/${name}.${f}.backup
fi
done
exit 0
fi
if [ "${1}" == "-s" -o "${1}" == "-S" -o "${1}" == "-l" -o "${1}" == "-L" ] ; then
dpkg --root=. "${@}"
exit 0
fi
# deb_hurd - end of file.
Reply to: