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

Re: Why GNU needn't worry [was: /usr --- to link or not to link]



> If we don't force the issue, people will naturally migrate from system
> #1 to system #2.
> 
> I love Marcus' suggestion of the Debian install asking you if you want
> system #1 or #2.  This is an option that isn't just useful for Hurd
> systems: Linux people with large root partitions (like me) may want it
> too!

OK - this is what the idiot's guide will do:

recommend personally #2. Explain the issues, and provide instructions for
how not to have the symlink.

Included are the scripts that are broken by the lack of link: they will
all work with or without the symlink except for cross-install which needs
to have the making the link lines commented out.

I suggest these new scripts are adopted: it won't affect those of us going
with hurd philososphy, but will help those who wan't / != /usr

Yours,

Matthew

-- Elen sila lumenn' omentielvo

Steward of the Cambridge Tolkien Society
Selwyn College Computer Support
http://www.geocities.com/Area51/Chamber/8841/
http://www.cam.ac.uk/CambUniv/Societies/tolkien/
http://pick.sel.cam.ac.uk/
#!/bin/bash
#
# Copyright (c) 1998 - This script is hereby placed in the public domain
#                      by Marcus Brinkmann.

# cross-install <path>
#
# for example: cross-install /gnu
#
#    1 Jan 1999 - v0.0 <Marcus.Brinkmann@ruhr-uni-bochum.de>
#        Original created by Marcus Brinkmann.
#                 v0.1 Added etc/login and terminal support.
#                 v0.2 Fixed typo in passwd file.
#    4 Jan 1999 - v1.0 Added logging and verbose messages.
#                      Adding checks fro certain malfunctions.
#                      Cleaned up the hacks.
#                      Only using ONE directory of base packages.
#    16 Jan 1999 - now works with or without the symlink /usr -> /

# INSTRUCTIONS:
#
# * Mount your hurd partition, created with "mke2fs -o hurd /dev/???"
# * Make a directory somewhere, and put the following files in it:
#   cross-install    - this file. Installs the base packages on the hurd partition.
#   native-install   - To be run after booting to the Hurd.
#
# ae_962-21_hurd-i386.deb@            
# base-files_2.1_i386.deb@            
# base-passwd_2.0.3.3_hurd-i386.deb@  hurd_19981204-1_hurd-i386.deb@
# bash_2.01.1-3.2_hurd-i386.deb@      less_332-4_i386.deb@
# libc0.2_2.0.106-0.2_hurd-i386.deb@
# libncurses4_4.2-3.1_hurd-i386.deb@
# libreadlineg2_2.1-10.1_hurd-i386.deb@
# locales_2.0.106-0.2_hurd-i386.deb@
# debianutils_1.9_i386.deb@           mawk_1.3.3-2_i386.deb@
# diff_2.7-16.1.deb@                  native-install*
#                                     ncurses-bin_4.2-3.1_hurd-i386.deb@
#                                     perl5_hurd-i386.tar.gz@
# dpkg_1.4.1_hurd-i386.deb@           sed_2.05-22.1_hurd-i386.deb@
# fileutils_4.0-1_hurd-i386.deb@      shellutils_1.16-6.2_hurd-i386.deb@
# findutils_4.1-28_i386.deb@          slang0.99.38_0.99.38-6_hurd-i386.deb@
# gnumach_19981118-2_hurd-i386.deb@   tar_1.12-6.1_hurd-i386.deb@
# grep_2.1-8.1.deb@                   textutils_1.22-2.4.1_hurd-i386.deb@
# gzip_1.2.4-27.1_hurd-i386.deb@      timezones_2.0.106-0.2_hurd-i386.deb@
# hostname_2.04_hurd-i386.deb@
#
# If you only want  a minimal base system, leave out locales,less,hostname,
# diff,ae,slang,timezones, debianutils. I don't recommend that, though.
# (but you can also install them natively, later)
#
# (If you can get later versions, use those. Be careful with prior versions,
#  though.)
#
# Then enter the directory ("cd path/to/repository") and run
#  ./cross-install /gnu
# where /gnu is the mount point of your hurd partition.

#
# CONFIGURATION
#
hostname="pick"
timezone="Europe/London"
dpkghurd="`pwd`/dpkg-hurd"
nativeinstall="`pwd`/native-install"
log="`pwd`/install.log"

# END OF CONFIGURATION

set -u -e

PS4='+$LINENO: '

err ()
{
    echo "$0: $1" 1>&2
    exit 1
}

[ "$#" == 1 ] || err "exactly one argument is required, the destination directory"

repository="`pwd`"

echo Determining destination directory.
expr "${1}" > /dev/null : / \
 && { echo You are using an absolute path, fine. ; \
      dest="${1}"; } \
 || { echo You are using a relative path, prepending working directory. ; \
      dest="`pwd`/${1}"; }
echo dest = ${dest}
echo log = ${log}
cat > ${log} < /dev/null

#############################
# Comply to Hurd philosophy.
#############################
# Note: this is no longer done, as it causes bugs
# Another note: it is being done again....<sigh>
# INFO: This can be done in base-files, but then you have to make sure that
#       base-files is installed very first!
if [ ! -L ${dest}/usr ] ; then
	echo
	echo Setting up link from usr to root directory to comply with Hurd philosophy.

	rm -f ${dest}/usr
	ln -s . ${dest}/usr
fi

###########################
# Prepare dpkg's database.
###########################
# INFO: This is needed so dpkg-hurd does actually work.
echo
echo Preparing dpkg\'s database.

install -d -m 755 -o root -g root ${dest}/var/lib/dpkg/{info,updates}
touch ${dest}/var/lib/dpkg/{status,available}

##########################
# cross-install packages.
##########################
# INFO: You can specify as much packages as you like, but there is a minimal
#       set.
echo
echo Installing packages, this may take some time.

cd ${dest}
for package in `/bin/ls ${repository}/*.deb`
do
	echo - ${package}
	${dpkghurd} --unpack ${package} --force-depends >> ${log} 2>&1
done

################
# Install perl.
################
#Note: no longer needed, perl packages made
# FIX: make proper perl packages.
#echo
#echo Installing Perl tar file.

#echo Ignore the errors... > ${log}
#tar -xzf ${repository}/perl5_hurd-i386.tar.gz >> ${log} 2>&1 || true

##############################
# Prepare initial translator.
##############################
# FIX: Should be done in the Hurd.
echo
echo Setting up initial translator hook.

install -d -m 755 -o root -g root ${dest}/servers/socket
touch ${dest}/servers/exec

#############################
# Copy native install script
#############################
echo
echo Copying the native install script.

cp ${nativeinstall} ${dest}

##########################
# Fake ldconfig for dpkg.
##########################
# FIX: Put this in libc packages

if [ ! -e ${dest}/sbin/ldconfig ] ; then
	echo
	echo ldconfig is not installed, let\'s fake it for dpkg.
	install -d -m 755 -o root -g root ${dest}/sbin
	cat << '_NIL_' > ${dest}/sbin/ldconfig
#!/bin/sh

# dummy ldconfig for the Hurd.
exit 0
_NIL_
	chmod +x ${dest}/sbin/ldconfig
fi

#####################
# Fake libc6 package
#####################
if [ ! -e ${dest}/var/lib/dpkg/info/libc6.list ] ; then
	echo
	echo Although we have libc0.2 packages, we need an entry for libc6 because
	echo of dpkg\'s dependency system.

cat >> ${dest}/var/lib/dpkg/status << '_NIL_'
Package: libc6
Status: install ok installed
Version: 2.0.106

_NIL_

	touch ${dest}/var/lib/dpkg/info/libc6.list
fi

########################################################
# make some essential directories for configure of dpkg
########################################################
# FIX: Later.
if [ ! -e ${dest}/etc/rc0.d ] ; then
        echo
        echo Making etc/rc\?.d directories for dpkg
        for nr in 0 1 2 3 4 5 6 S
        do
                install -d -m 755 -o root -g root ${dest}/etc/rc${nr}.d
        done
        install -d -m 755 -o root -g root ${dest}/etc/rc.boot
fi

####################
# Patch dpkg-divert
####################
echo
echo Fixing Debian scripts for the Hurd

patch -p0 << '_NIL_' 
*** sbin/dpkg-divert~   Sat Jan  2 01:40:22 1999
--- usr/sbin/dpkg-divert    Sun Jan  3 00:01:52 1999
***************
*** 1,7 ****
  #! /usr/bin/perl --

! #use POSIX; &ENOENT;
! sub ENOENT { 2; }
  # Sorry about this, but POSIX.pm isn't necessarily available

  $version="1.4.1"; # This line modified by Makefile
--- 1,7 ----
  #! /usr/bin/perl --

! use POSIX; &ENOENT;
! #sub ENOENT { 2; }
  # Sorry about this, but POSIX.pm isn't necessarily available

  $version="1.4.1"; # This line modified by Makefile
_NIL_

patch -p0 << '_NIL_'
*** sbin/update-alternatives~   Sat Jan  2 01:40:22 1999
--- usr/sbin/update-alternatives    Sat Jan  2 23:41:47 1999
***************
*** 1,7 ****
  #! /usr/bin/perl --

! #use POSIX; &ENOENT;
! sub ENOENT { 2; }
  # Sorry about this, but POSIX.pm isn't necessarily available

  $version="1.4.1"; # This line modified by Makefile
--- 1,7 ----
  #! /usr/bin/perl --

! use POSIX; &ENOENT;
! #sub ENOENT { 2; }
  # Sorry about this, but POSIX.pm isn't necessarily available

  $version="1.4.1"; # This line modified by Makefile
_NIL_

patch -p0 << '_NIL_'
*** sbin/install-info~  Sat Jan  2 01:40:22 1999
--- usr/sbin/install-info   Sun Jan  3 00:04:44 1999
***************
*** 208,217 ****
      }
  }

! if (!$nowrite && !link("$infodir/dir","$infodir/dir.lock")) {
!     die "$name: failed to lock dir for editing! $!\n".
!         ($! =~ m/exists/i ? "try deleting $infodir/dir.lock ?\n" : '');
! }

  open(OLD,"$infodir/dir") || &ulquit("$name: open $infodir/dir: $!\n");
  @work= <OLD>;
--- 208,217 ----
      }
  }

! #if (!$nowrite && !link("$infodir/dir","$infodir/dir.lock")) {
! #    die "$name: failed to lock dir for editing! $!\n".
! #        ($! =~ m/exists/i ? "try deleting $infodir/dir.lock ?\n" : '');
! #}

  open(OLD,"$infodir/dir") || &ulquit("$name: open $infodir/dir: $!\n");
  @work= <OLD>;
***************
*** 338,349 ****
          &ulquit("$name: cannot backup old $infodir/dir, giving up: $!\n");
      rename("$infodir/dir.new","$infodir/dir") ||
          &ulquit("$name: install new $infodir/dir: $!\n");
! unlink("$infodir/dir.lock") || die "$name: unlock $infodir/dir: $!\n";
  }

  sub ulquit {
!     unlink("$infodir/dir.lock") ||
!         warn "$name: warning - unable to unlock $infodir/dir: $!\n";
      die $_[0];
  }

--- 338,349 ----
          &ulquit("$name: cannot backup old $infodir/dir, giving up: $!\n");
      rename("$infodir/dir.new","$infodir/dir") ||
          &ulquit("$name: install new $infodir/dir: $!\n");
! #unlink("$infodir/dir.lock") || die "$name: unlock $infodir/dir: $!\n";
  }

  sub ulquit {
! #    unlink("$infodir/dir.lock") ||
! #        warn "$name: warning - unable to unlock $infodir/dir: $!\n";
      die $_[0];
  }
_NIL_

###################
# Setup timezone.
###################
# FIX: Upload a proper timezone package, Gordon!

if [ ! -e ${dest}/share/zoneinfo/Factory ] ; then
	echo
	echo Timezone can\'t be configured proper, because the timezone package is broken.

	if [ ! -e /usr/share/zoneinfo/${timezone} ] ; then
		echo But I can\'t find your local zoneinfo, so I can\'t fix it! 
	else
		echo I try to fix it for you.

		echo ${timezone} > ${dest}/etc/timezone
		install -d -m 755 -o root -g root `dirname ${dest}/share/zoneinfo/${timezone}`
		cp /usr/share/zoneinfo/${timezone} ${dest}/share/zoneinfo/${timezone}
		echo timezone is set to ${timezone}.
	fi
fi

##################
# Setup hostname.
##################
echo
echo Hey, ${hostname} is really a nice hostname for your machine!

echo ${hostname} > ${dest}/etc/hostname

##############
# Setup ttys.
##############
echo
echo Setting up the terminal. Activate it with \"export TERM=mach\".

cat << '_NIL_' > ${dest}/etc/ttys
console "/libexec/getty 9600"           mach    on      secure trusted console
_NIL_

##################
# Setup terminal. 
##################
# FIX: WILL BE IN NCURSES-BASE.

if [ ! -e ${dest}/share/terminfo/m ] ; then
	echo Installing terminfo directory.
	install -d -m 755 -o root -g root ${dest}/share/terminfo/m
fi

if [ ! -e ${dest}/share/terminfo/m/mach ] ; then
	echo Installing terminfo ebtry for mach.
	cd ${dest}
uudecode << '_NIL_'
begin 666 share/terminfo/m/mach
M&@$2``D``P"E`.D`;6%C:'Q-86-H($-O;G-O;&4```$````````!`%``"``9
M`/__```"`/____\$``<`"P#_____#P`@`"(`__\F`/____\H`/__+`#_____
M,`#_______\T`#D`________________/@!#`/_______T@`________30#_
M______________________]2`/__5@#_______]8`/__7`#__________V``
M9`!H`&P`<`!T`'@`?`"``(0`B`",`/__D`"4`)@`G`"@`/_______Z0`____
M____________________________________J`#_____JP"T`/____^]`,8`
MSP#__]@`_____________________________________^$`___________C
M`/__________________________________________________________
M___________________E``<`#0`;8P`;6TL`&UM*`!M;)6DE<#$E9#LE<#(E
M9$@`"@`;6T@`"``;6T,`&UM!`!M;30`;6S5M`!M;,6T`&ULW;0`;6S=M`!M;
M,&T`&ULP;0`;6TP`"``;6SD`&UM"`!M/4``;3UD`&T]1`!M/4@`;3U,`&T]4
M`!M/50`;3U8`&T]7`!M/6``;6T@`&UM``!M;1``;6T8`&UM5`!M;5@`;6T,`
M&UM!``T*`!M;)7`Q)61-`!M;)7`Q)61"`!M;)7`Q)61,`!M;)7`Q)61$`!M;
8)7`Q)61#`!M;)7`Q)61!``H`"0`;6UD`
`
end
_NIL_
fi
if [ ! -e ${dest}/share/terminfo/m/mach-bold ] ; then
        echo Installing terminfo ebtry for mach-bold.
        cd ${dest}
uudecode << '_NIL_'
begin 666 share/terminfo/m/mach-bold
M&@$V``D``P"E`.\`;6%C:"UB;VQD?$UA8V@@0V]N<V]L92!W:71H(&)O;&0@
M:6YS=&5A9"!O9B!U;F1E<FQI;F4```$````````!`%``"``9`/__```"`/__
M__\$``<`"P#_____#P`@`"(`__\F`/____\H`/__+`#_____,`#_______\T
M`#D`________________/@!#`$@`_____TT`________4@!7`/__________
M__________]<`/__8`#_______]B`/__9@#__________V@`;`!P`'0`>`!\
M`(``A`"(`(P`D`"4`/__F`":`)X`H@"F`/_______ZH`________________
M________________________K@#_____L0"Z`/_____#`,P`U0#__]X`____
M_________________________________^<`___________I`/__________
M____________________________________________________________
M_______K``<`#0`;8P`;6TL`&UM*`!M;)6DE<#$E9#LE<#(E9$@`"@`;6T@`
M"``;6T,`&UM!`!M;30`;6S5M`!M;,6T`&ULW;0`;6S=M`!M;,6T`&ULP;0`;
M6S!M`!M;,&T`&UM,``@`&ULY``H`&T]0`!M/60`;3U$`&T]2`!M/4P`;3U0`
M&T]5`!M/5@`;3U<`&T]8`!M;2``;6T``"``;6T8`&UM5`!M;5@`;6T,`&UM!
M``T*`!M;)7`Q)61-`!M;)7`Q)61"`!M;)7`Q)61,`!M;)7`Q)61$`!M;)7`Q
5)61#`!M;)7`Q)61!``H`"0`;6UD`
`
end
_NIL_
fi

##################
# Setup etc/login
##################
if [ ! -e ${dest}/etc/login ] ; then
	echo
	echo Setting up etc/login.

	install -d -m 755 -o root -g root ${dest}/etc/login
cat << '_NIL_' > ${dest}/etc/login/README
This is a hurd login shell; it is a normal user shell, but has no user
privileges.  To login as a user with a userid of USER, use the command:

  login USER

other useful commands:

  ql USER       # quick login -- just start a shell in USER's home directory
  su USER       # set the id of the current (login) shell to USER
                # (use the `unsu' command to undo this, or just exit the shell)
_NIL_

cat << '_NIL_' > ${dest}/etc/login/.bash_login
. .bashrc
. .profile
_NIL_

cat << '_NIL_' > ${dest}/etc/login/.bashrc
# login -- a normal login
alias login='exec login -p -R-p -R-aHOME -R-aMOTD -R-e_LOGIN_RETRY=yes'
alias logon=login
alias l=login

# quick login -- don't act like a login shell, but do cd to $HOME
alias ql='exec login -pSL -aMOTD -R-p -R-aHOME -R-aMOTD -R-e_LOGIN_RETRY=yes'

alias help='cat $HOME/README'
alias '?'=help
_NIL_

cat << '_NIL_' > ${dest}/etc/login/.profile
PS1='login> '
test "$_LOGIN_RETRY" || echo "Use \`login USER' to login, or \`help' for more information."
unset _LOGIN_RETRY
_NIL_

touch ${dest}/etc/login/.hushlogin
fi

echo
echo Now boot the Hurd and run
echo ./native-install
echo
 


#!/bin/bash
#
# Copyright (c) 1998 - This script is hereby placed in the public domain
#                      by Marcus Brinkmann.
# Most of this script was taken from the SETUP script in Hurd CVS.

# native-install
#
#    1 Jan 1999 - v0.0 <Marcus.Brinkmann@ruhr-uni-bochum.de>
#        Original created by Marcus Brinkmann.
#   Edited to deal with the removal of the /usr -> / symlink
#   This should work with or without the symlink
#  14 Jan 1999 Matthew Vernon <mcv21@cam.ac.uk>

# Make sure the filesystem is writable

echo I am just checking if your filesystem is really writeable.
fsysopts / --writable

# Set up standard passive translators
echo
echo Now I set up the translators. If you get Operation not supported
echo errors, you have forgotten to set the file system owner to \"hurd\"!

/bin/settrans -c /servers/socket/1 /hurd/pflocal
/bin/ln -s 1 /servers/socket/local
/bin/settrans -c /servers/socket/2 /hurd/pfinet
/bin/ln -s 2 /servers/socket/inet
/bin/settrans -c /servers/crash /hurd/crash

# We need the following so "chown root" works for MAKEDEV
echo
echo Now I will configure two essential packages, so I can chown files to root.
dpkg --configure libc0.2
#dpkg --configure base-passwd
cp usr/share/base-passwd/passwd.master /etc/passwd
cp usr/share/base-passwd/group.master /etc/group

# nsswitch does not work with compat. HURD PROBLEM?
# FIX: libc packages.
#echo
#echo Patching nsswitch.conf (FIXME)
#cd /
#patch -p0 << '_NIL_'
#*** etc/nsswitch.conf  Sun Apr 26 14:13:27 1998
#--- nsswitch.conf       Sun Jan  3 00:44:07 1999
#***************
#*** 3,11 ****
#  # Example configuration of GNU Name Service Switch functionality.
#  # Information about this file is available in the Libc6-doc' package.
#
#! passwd:         compat
#! group:          compat
#! shadow:         compat
#
#  hosts:          files dns
#  networks:       files
#--- 3,11 ----
#  # Example configuration of GNU Name Service Switch functionality.
#  # Information about this file is available in the Libc6-doc' package.
#
#! passwd:         files
#! group:          files
#! shadow:         files
#
#  hosts:          files dns
#  networks:       files
#_NIL_

# Setup crucial devices
echo
echo The next job is to setup device files.
cd /dev
/bin/sh ./MAKEDEV std ptyp ptyq

# Debian set up.
echo
echo Now I configure Debian packages. I\'ll do this twice, so all
echo packages get configured properly. You\'ll notice some warnings
echo and errors in the first run, that\'s okay.
if [ -e /etc/timezone ] ; then
echo
echo The timezone package will ask you if you want to keep the config
echo file. Just accept the default by pressing enter.
fi
echo
echo Please press enter now to start configuration.
read x

dpkg --pending --configure || true
dpkg --pending --configure || true

echo
echo All packages should be configured now. If there are errors\,
echo let me know.
echo
echo Have fun exploring the Hurd, Marcus Brinkmann \<brinkmd\@debian.org\>
echo
#!/bin/sh
#
# Make standard devices
#

PATH=/bin:/usr/bin

ECHO=:		# Change to "echo" to echo commands
EXEC=""		# Change to ":" to suppress command execution
export ECHO EXEC

while :; do
  case "$1" in
    --help|"-?")
      echo "\
Usage: $0 [OPTION...] DEVNAME...
Make filesystem nodes for accessing standard system devices

  -D, --devdir=DIR           Use DIR when a device node name must be
                             embedded in a translator; default is the cwd
  -n, --dry-run              Don't actually execute any commands
  -v, --verbose              Show what commands are executed to make the devices
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version"
      exit 0;;
    --devdir)   DEVDIR="$2"; shift 2;;
    --devdir=*) DEVDIR="`echo "$1" | sed 's/^--devdir=//'`"; shift 1;;
    -D)         DEVDIR="$2"; shift 2;;
    -D*)        DEVDIR="`echo "$1" | sed 's/^-D//'`"; shift 1;;
    --verbose|-v) ECHO=echo; shift;; 
    --dry-run|-n) EXEC=:; shift;;
    -nv|-vn)      ECHO=echo; EXEC=:; shift;;
    --usage)
      echo "Usage: $0 [-V?] [-D DIR] [--help] [--usage] [--version] [--devdir=DIR] DEVNAME..."
      exit 0;;
    --version|-V)
      echo "MAKEDEV (GNU Hurd) 0.2"; exit 0;;
    -*)
      echo 1>&2 "$0: unrecognized option \`$1'"
      echo 1>&2 "Try \`$0 --help' or \`$0 --usage' for more information";
      exit 1;;
    *)
      break;;
  esac
done

case  "$#" in 0)
  echo 1>&2 "Usage: $0 [OPTION...] DEVNAME..."
  echo 1>&2 "Try \`$0 --help' or \`$0 --usage' for more information"
  exit 1;;
esac

function cmd {
  eval $ECHO "$@"
  eval $EXEC "$@"
}

function st {
  local NODE="$1"
  local OWNER="$2"
  local PERM="$3"
  shift 3
  if cmd settrans -cg "$NODE"; then
    cmd chown "$OWNER" "$NODE"
    cmd chmod "$PERM" "$NODE"
    cmd settrans "$NODE" "$@"
  fi
}

case ${DEVDIR+set} in
  set) export DEVDIR;;
  *)   _CWD="`pwd`";;
esac

function mkdev {
  local I
  for I; do
    local B="${I##*/}"
    case "$B" in
      std)
        local dir="`dirname $I`"
	mkdev $dir/console $dir/tty $dir/null $dir/zero $dir/fd $dir/time
	;;
      console|tty[0-9][0-9a-f]|tty[0-9a-f]|com[0-9])
	local dn	# runtime device name
	case "${DEVDIR+set}" in
	  set) dn="$DEVDIR/$B";;
	  "")  case "$I" in
		 /*)  dn="$I";;
		 *)   dn="$_CWD/$I";;
	       esac;;
        esac
	st $I root 600 /hurd/term $dn device $B;;
      null)
	st $I root 666 /hurd/null;;
      zero)
	st $I root 666 /hurd/storeio -Tzero;;
      tty)
	st $I root 666 /hurd/magic tty;;
      fd)
        local dir="`dirname $I`"
	st $I root 666 /hurd/magic fd
	cmd ln -f -s fd/0 $dir/stdin
	cmd ln -f -s fd/1 $dir/stdout
	cmd ln -f -s fd/2 $dir/stderr
	;;
      time)
	st $I root 666 /hurd/storeio time ;;

      # ptys
      [pt]ty[pqrstuvwxyzPQRST]?)
	# Make one pty, both the master and slave halves
	local id="${B:3}"
        local dir="`dirname $I`"
	local dd
	case "${DEVDIR+set}" in
	  set) dd="$DEVDIR";;
	  "")  case "$I" in
		 /*)  dd="$dir";;
		 */*) dd="$_CWD/$dir";;
		 *)   dd="$_CWD";;
	       esac;;
        esac
	st $dir/pty$id root 640 /hurd/term $dd/pty$id pty-master $dd/tty$id
	st $dir/tty$id root 640 /hurd/term $dd/tty$id pty-slave $dd/pty$id
	;;
      [pt]ty[pqrstuvwxyzPQRST])
	# Make a bunch of ptys
	mkdev ${I}0 ${I}1 ${I}2 ${I}3 ${I}4 ${I}5 ${I}6 ${I}7
	mkdev ${I}8 ${I}9 ${I}a ${I}b ${I}c ${I}d ${I}e ${I}f
	;;

      fd*|mt*)
	st $I root 640 /hurd/storeio $B
	;;

      [hrsc]d*)
	case "$B" in
	[a-z][a-z][0-9][a-z] | [a-z][a-z][0-9]s[1-9] | [a-z][a-z][0-9]s[1-9][a-z] | [a-z][a-z][0-9])
	  st $I root 640 /hurd/storeio $B
	  ;;
	*)
	  echo 1>&2 $0: $B: Invalid device name: must supply a device number
	  exit 1
	  ;;
	esac
	;;

      *)
	echo >&2 $0: $B: Unknown device name
	exit 1
	;;
    esac
  done
}

mkdev "$@"
#!/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 --unpack 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.
#
# Note:    The action must be the first argument, the package the second.
#          Multiple packages can't be processed at one command line.
#
# 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>
#                  Added the possibility to add options.
#                - v0.3.2 Fixed typo in grep (Package: instead Package)
#    TODO - fix all those race conditions and use proper tmp dir!
#    Minor fix by Matthew Vernon <mcv21@cam.ac.uk>
#    No longer expects the /usr -> / symlink

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" -o "${1}" == "--unpack" ] ; then

	action="${1}"
	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 ${action} ${@-} 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


# dpkg-hurd - end of file.

Reply to: