summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorIan Jackson <ian@chiark.chu.cam.ac.uk>1996-04-04 01:58:40 +0100
committerIan Jackson <ian@chiark.chu.cam.ac.uk>1996-04-04 01:58:40 +0100
commit1b80fb16c22db72457d7a456ffbf1f70a8dfc0a5 (patch)
treec0ee53eba4e71f4c246ee9e45fbd90e931bbd1f9 /methods
downloaddpkg-1b80fb16c22db72457d7a456ffbf1f70a8dfc0a5.tar.gz
dpkg (1.1.4); priority=MEDIUM
* Allow overwriting of conflicting packages being removed. (Bug#2614.) * a.out control file says Pre-Depends: libc4 | libc. (Bug#2640.) * ELF control file and libc dependencies changed to use finalised scheme. * ELF control file and libc dependencies for i386 only. (Bug#2617.) * Guidelines say use only released libraries and compilers. * Install wishlist as /usr/doc/dpkg/WISHLIST. * Remove spurious entries for Guidelines in info dir file. * dpkg-deb --build checks permissions on control (DEBIAN) directory. * Spaces in control file fields not copied by dpkg-split. (Bug#2633.) * Spaces in split file part control data ignore. (Bug#2633.) * Portability fixes, including patch from Richard Kettlewell. * Fixed minor configure.in bug causing mangled GCC -W options. -- Ian Jackson <ian@chiark.chu.cam.ac.uk> Thu, 4 Apr 1996 01:58:40 +0100
Diffstat (limited to 'methods')
-rw-r--r--methods/Makefile.in60
-rw-r--r--methods/disk.desc.cdrom3
-rw-r--r--methods/disk.desc.harddisk9
-rw-r--r--methods/disk.desc.mounted12
-rw-r--r--methods/disk.desc.nfs9
-rw-r--r--methods/disk.install127
-rw-r--r--methods/disk.names4
-rw-r--r--methods/disk.setup562
-rw-r--r--methods/disk.update71
-rw-r--r--methods/floppy.desc.floppy9
-rw-r--r--methods/floppy.install100
-rw-r--r--methods/floppy.names1
-rw-r--r--methods/floppy.setup76
-rw-r--r--methods/floppy.update76
-rwxr-xr-xmethods/hd.setup90
-rwxr-xr-xmethods/hd.unpack36
-rwxr-xr-xmethods/hd.update37
17 files changed, 1282 insertions, 0 deletions
diff --git a/methods/Makefile.in b/methods/Makefile.in
new file mode 100644
index 000000000..47b5d835b
--- /dev/null
+++ b/methods/Makefile.in
@@ -0,0 +1,60 @@
+# Copyright (C) 1994 Ian Murdock <imurdock@debian.org>
+# Copyright (C) 1994,1995 Ian Jackson <ijackson@nyx.cs.du.edu>
+#
+# This is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2,
+# or (at your option) any later version.
+#
+# This is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with dpkg; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+libdir = $(prefix)/lib
+dpkglibdir = $(libdir)/dpkg
+methodsdir = $(dpkglibdir)/methods
+datadir = /var/lib/dpkg
+methodsdatadir = $(datadir)/methods
+methodsmnt = $(datadir)/methods/mnt
+
+SCRIPTS = setup update install
+METHODS = disk floppy
+DESCS = disk.desc.harddisk disk.desc.mounted disk.desc.cdrom \
+ disk.desc.nfs floppy.desc.floppy
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+all:
+
+install:
+ set -e; for m in $(METHODS) ; do \
+ d=$(methodsdir)/$$m ; \
+ test -d $$d || mkdir $$d ; \
+ e=$(methodsdatadir)/$$m ; \
+ test -d $$e || mkdir $$e ; \
+ $(INSTALL_DATA) $$m.names $$d/names ; \
+ for s in $(SCRIPTS) ; do \
+ $(INSTALL_PROGRAM) $$m.$$s $$d/$$s ; \
+ done ; \
+ done
+ set -e; for x in $(DESCS) ; do \
+ d=`echo $$x | sed -e 's:\.:/:'` ; \
+ $(INSTALL_DATA) $$x $(methodsdir)/$$d ; \
+ done
+
+clean:
+ rm -f core
+
+distclean: clean
+ rm -f Makefile *.orig *~ *.~* ./#*#
diff --git a/methods/disk.desc.cdrom b/methods/disk.desc.cdrom
new file mode 100644
index 000000000..b400abb04
--- /dev/null
+++ b/methods/disk.desc.cdrom
@@ -0,0 +1,3 @@
+Installation from a CD-ROM containing a Debian distribution. The
+CD-ROM may be or not be mounted already; it should contain a standard
+ISO9660 CD-ROM filesystem.
diff --git a/methods/disk.desc.harddisk b/methods/disk.desc.harddisk
new file mode 100644
index 000000000..ba4575030
--- /dev/null
+++ b/methods/disk.desc.harddisk
@@ -0,0 +1,9 @@
+Installation from filesystem on a hard disk partition that's not
+currently mounted.
+
+The partition should contain the Packages.gz file from each
+distribution area being installed (usually stable, contrib and
+non-free) as well as the corresponding binary/*/*.deb files.
+
+The easiest way to get this is to make a (partial) copy of the
+distribution site's directory hierarchy, if possible.
diff --git a/methods/disk.desc.mounted b/methods/disk.desc.mounted
new file mode 100644
index 000000000..b980d70ae
--- /dev/null
+++ b/methods/disk.desc.mounted
@@ -0,0 +1,12 @@
+Installation from a directory on a filesystem that has already been
+mounted. If the options available for mounting things automatically
+are inadequate for your needs you'll need to get a shell command
+prompt (for example by switching VT using Alt-F<n> or quitting
+dselect) and use it to mount the filesystem before continuing.
+
+The area you're installing from should contain the Packages.gz file
+from each distribution area being installed (usually stable, contrib
+and non-free) as well as the corresponding binary/*/*.deb files.
+
+The easiest way to do get this is to make a (partial) copy of the
+distribution site's directory hierarchy, if possible.
diff --git a/methods/disk.desc.nfs b/methods/disk.desc.nfs
new file mode 100644
index 000000000..77bb64082
--- /dev/null
+++ b/methods/disk.desc.nfs
@@ -0,0 +1,9 @@
+Installation across the network, from an NFS server which not
+currently mounted.
+
+The server should have contain the Packages.gz file from each
+distribution area being installed (usually stable, contrib and
+non-free) as well as the corresponding binary/*/*.deb files.
+
+The easiest way for them to get this is to make a (partial) copy of
+the distribution site's directory hierarchy, if possible.
diff --git a/methods/disk.install b/methods/disk.install
new file mode 100644
index 000000000..a14cc3994
--- /dev/null
+++ b/methods/disk.install
@@ -0,0 +1,127 @@
+#!/bin/sh
+
+set -e
+vardir="$1"
+method=$2
+option=$3
+
+cd "$vardir/methods/disk"
+
+. ./shvar.$option
+
+xit=1
+trap '
+ if [ -n "$umount" ]
+ then
+ umount "$umount" >/dev/null 2>&1
+ fi
+ exit $xit
+' 0
+
+if [ -n "$p_blockdev" ]
+then
+ umount="$p_mountpoint"
+ mount -rt "$p_fstype" -o nosuid,nodev "$p_blockdev" "$p_mountpoint"
+fi
+
+if [ -n "$p_nfs" ]
+then
+ umount="$p_mountpoint"
+ mount -rt nfs "$p_nfs" -o nosuid,nodev "$p_mountpoint"
+fi
+
+case "$p_mountpoint" in
+*/ ) binaryprefix="$p_mountpoint" ;;
+'' ) binaryprefix="" ;;
+* ) binaryprefix="$p_mountpoint/" ;;
+esac
+
+predep="$vardir/predep-package"
+while true
+do
+ set +e
+ dpkg --predep-package >"$predep"
+ rc=$?
+ set -e
+ if test $rc = 1; then break; fi
+ test $rc = 0
+
+ perl -e '
+ ($binaryprefix,$predep) = @ARGV;
+ $binaryprefix =~ s,/*$,/, if length($binaryprefix);
+ open(P,"< $predep") || die "cannot open $predep: $!\n";
+ while (<P>) {
+ s/\s*\n$//;
+ $package= $_ if s/^Package: //i;
+ @filename= split(/ /,$_) if s/^Filename: //i;
+ @msdosfilename= split(/ /,$_) if s/^MSDOS-Filename: //i;
+ }
+ length($package) || die "internal error - no package";
+ @filename || die "internal error - no filename";
+ @filename==@msdosfilename || !@filename || !@msdosfilename ||
+ die "internal error - mismatch >@filename< >@msdosfilename<";
+ @invoke=(); $|=1;
+ for ($i=0; $i<=$#filename; $i++) {
+ $ppart= $i+1;
+ print "Looking for part $ppart of $package ... ";
+ if (-f "$binaryprefix$filename[$i]") {
+ $print= $filename[$i];
+ $invoke= "$binaryprefix$filename[$i]";
+ } elsif (-f "$binaryprefix$msdosfilename[$i]") {
+ $print= $msdosfilename[$i];
+ $invoke= "$binaryprefix$msdosfilename[$i]";
+ } else {
+ $base= $filename[$i]; $base =~ s,.*/,,;
+ $msdosbase= $msdosfilename[$i]; $msdosbase =~ s,.*/,,;
+ defined($c= open(X,"-|")) ||
+ die "failed to fork for find: $!\n";
+ if (!$c) {
+ exec("find", length($binaryprefix)
+ ? $binaryprefix : ".","-follow",
+ "-name",$base,"-o","-name",$msdosbase);
+ die "failed to exec find: $!\n";
+ }
+ while (chop($invoke= <X>)) { last if -f $invoke; }
+ $print= $invoke;
+ if (substr($print,0,length($binaryprefix)+1) eq
+ "$binaryprefix/") {
+ $print= substr($print,length($binaryprefix));
+ }
+ }
+ if (!length($invoke)) {
+ print STDERR "
+
+Oh dear, I need to install or upgrade $package, but I don'\''t see
+the appropriate file(s) anywhere. I'\''m expecting version $version or
+later, as that is listed in the Packages file.
+
+Perhaps you downloaded it with an unexpected name, or something.
+In any case, you must find the file(s) and then either place it with
+the correct filename(s) (as listed in the Packages file or in
+/var/lib/dpkg/available) and rerun the installation, or upgrade the
+package by using `dpkg --install --auto-deconfigure'\'' by hand.
+
+";
+ exit(1);
+ }
+ print "$print\n";
+ push(@invoke,$invoke);
+ }
+ print "Running dpkg -iB for $package ...\n";
+ exec("dpkg","-iB","--",@invoke);
+ die "failed to exec dpkg: $!\n";
+ ' -- "$binaryprefix$p_main_binary" "$predep"
+done
+
+for f in main ctb nf lcl
+do
+ eval 'this_binary=$p_'$f'_binary'
+ if [ -z "$this_binary" ]; then continue; fi
+ echo Running dpkg -iGROEB "$binaryprefix$this_binary"
+ dpkg -iGROEB "$binaryprefix$this_binary"
+done
+
+echo -n 'Installation OK. Hit RETURN. '
+read response
+
+xit=0
diff --git a/methods/disk.names b/methods/disk.names
new file mode 100644
index 000000000..1f55b78e3
--- /dev/null
+++ b/methods/disk.names
@@ -0,0 +1,4 @@
+30 cdrom Install from a CD-ROM.
+35 nfs Install from an NFS server (not yet mounted).
+40 harddisk Install from a hard disk partition (not yet mounted).
+42 mounted Install from a filesystem which is already mounted.
diff --git a/methods/disk.setup b/methods/disk.setup
new file mode 100644
index 000000000..5a6920039
--- /dev/null
+++ b/methods/disk.setup
@@ -0,0 +1,562 @@
+#!/bin/sh
+
+set -e
+vardir="$1"
+method=$2
+option=$3
+
+cd "$vardir/methods/disk"
+tp=/tmp/ddm$$
+
+xit=1
+trap '
+ rm -f $tp.?
+ if [ -n "$umount" ]
+ then
+ umount "$umount" >/dev/null 2>&1
+ fi
+ exit $xit
+' 0
+
+if ls -d "$tp.?" >/dev/null 2>&1
+then
+ rm $tp.?
+fi
+
+yesno () {
+ while true
+ do
+ echo -n "$2 [$1] "
+ read response
+ if [ -z "$response" ]
+ then
+ response="$1"
+ fi
+ case "$response" in
+ [Nn]*) yesno=no ; return ;;
+ [Yy]*) yesno=yes ; return ;;
+ esac
+ done
+}
+
+getblockdev () {
+ mountpoint="$vardir/methods/mnt"
+ if [ -z "$defaultdevice" ]
+ then
+ defaultdevice="$newdefaultdevice"
+ elif [ "$defaultdevice" != "$newdefaultdevice" ]
+ then
+ echo \
+ "Last time you specified installation from $defaultdevice."
+ fi
+ promptstring="$1"
+ while [ -z "$blockdevice" ]
+ do
+ echo -n "$promptstring [$defaultdevice]: "
+ read response
+ if [ -z "$response" ]
+ then
+ response="$defaultdevice"
+ fi
+ if ! [ -b "$response" ]
+ then
+ echo "$response is not a block device."; continue
+ fi
+ tryblockdevice="$response"
+ if [ $option = cdrom ]
+ then
+ fstype=iso9660
+ elif [ $option = harddisk ]
+ then
+ blockbase="`echo \"$tryblockdevice\" | sed -e 's/[0-9]\{1,\}$//'`"
+ set +e
+ echo -e "p\nq\n" | fdisk "$blockbase" 2>/dev/null >$tp.f
+ set -e
+ proposeddevice="$tryblockdevice" perl -ne '
+next unless /^ *Device +Boot +Begin +Start +End +Blocks +Id +System *$/i .. !/\S/;
+next unless s:^/\S+:: && $& eq $ENV{"proposeddevice"};
+next unless s/^ +(\* +)?\d+ +\d+ +\d+ +\d+\+? +//;
+next unless m/^([0-9a-f]{1,2}) /i;
+%types= ( "1","msdos", "4","msdos", "6","msdos", "7","hpfs", "80","minix",
+ "81","minix", "83","ext2" );
+print $types{$1}; exit(0); ' <$tp.f >$tp.m
+ defaultfstype="`cat $tp.m`"
+ if [ -n "$defaultfstype" ]
+ then
+ cat <<END
+The partition table for $blockbase claims that $tryblockdevice
+contains filesystem type $defaultfstype.
+END
+ if ! grep " $defaultfstype$" /proc/filesystems >/dev/null
+ then
+ echo \
+ "Your kernel does not appear to support that filesystem type."
+ defaultfstype=""
+ fi
+ fi
+ echo -n "Supported filesystems: "
+ sed -e 's/^.* / /' /proc/filesystems | tr '\n' ' '
+ echo -n "
+Enter filesystem type (for $tryblockdevice) [$defaultfstype]: "
+ read fstype
+ if [ -z "$fstype" ]
+ then
+ fstype="$defaultfstype"
+ fi
+ fi
+ umount="$mountpoint"
+ if mount -rt "$fstype" -o nosuid,nodev "$tryblockdevice" "$mountpoint"
+ then
+ echo
+ blockdevice="$tryblockdevice"
+ else
+ umount=""
+ echo \
+ "Unable to mount $tryblockdevice on $mountpoint, type $fstype."
+ fi
+ done
+}
+
+outputparam () {
+ echo "$2" | sed -e "s/'/'\\\\''/; s/^/$1='/; s/$/'/" >&3
+}
+
+intrkey="`stty -a | sed -n 's/.*intr = \([^;]*\);.*/\1/p'`"
+echo "
+If you make a mistake, use the interrupt key ($intrkey) to abort.
+"
+
+# State variables, `best first'
+# {main,ctb,nf,lcl}_{packages,binary}
+# Empty before we've found them or if they're not available,
+# set to the relevant bit under mountpoint otherwise.
+# hierbase
+# A directory containing a Debian FTP site mirror tree.
+# mountpoint
+# The mountpoint for the filesystem containing the stuff
+# empty or unset if we don't know yet, or if we haven't mounted anything;
+# may also be empty if `directory' was set.
+# blockdevice
+# The actual block device to mount.
+# fstype
+# The filesystem type to use.
+# defaultdevice
+# The default block device to mount.
+
+p_usedevel=no
+if [ -f shvar.$option ]
+then
+ . ./shvar.$option
+ defaultdevice="$p_blockdev"
+ defaultnfsserver="$p_nfsserver"
+ defaultnfsrempath="$p_nfsrempath"
+ usedevel="$p_usedevel"
+fi
+
+if [ $option = cdrom ]
+then
+ mount >$tp.m
+ sed -n 's/ ([^)]*)$//; s/^[^ ]* on //; s/ type iso9660$//p' <$tp.m >$tp.l
+ ncdroms=`wc -l <$tp.l`
+ if [ $ncdroms -gt 1 ]
+ then
+ response=""
+ while [ -z "$response" ]
+ do
+ echo \
+ 'Several CD-ROMs (or other ISO9660 filesystems) are mounted:'
+ egrep 'type iso9660 \([^)]*\)$' <$tp.m | nl
+ echo -n \
+ 'Is it any of these ? Type a number, or `n'\'' for none. '
+ read response
+ response="`echo \"$response\" | sed -e 's/[ ]*$//'`"
+ if expr "$response" : '[0-9][0-9]*$' >/dev/null && \
+ [ $response -ge 1 -a $response -le $ncdroms ]
+ then
+ mountpoint="`sed -n $response'p' <$tp.l`"
+ echo
+ elif expr "$response" : '[Nn]' >/dev/null
+ then
+ mountpoint=""
+ else
+ response=""
+ fi
+ done
+ elif [ $ncdroms = 1 ]
+ then
+ mountpoint="`cat $tp.l`"
+ perl -ne 'print if s/ type iso9660 \([^)]*\)$// && s/ on .*$//;' \
+ <$tp.m >$tp.d
+ blockdevice="`cat $tp.d`"
+ yesno yes \
+ "I see a CD-ROM: $blockdevice, mounted on $mountpoint. Is it the right one ?"
+ if [ $yesno = no ]
+ then
+ echo 'Unmounting it ...'
+ umount="$mountpoint"
+ while true
+ do
+ echo -n \
+ 'Please insert the right disc, and hit return: '
+ read response
+ if mount -rt iso9660 -o nosuid,nodev \
+ "$blockdevice" "$mountpoint"
+ then
+ echo
+ break
+ fi
+ done
+ fi
+ fi
+ if [ -z "$mountpoint" ]
+ then
+ if [ -b /dev/cdrom ]
+ then
+ echo \
+ 'I see that /dev/cdrom exists and is a block device.'
+ newdefaultdevice=/dev/cdrom
+ fi
+ getblockdev 'Insert the CD-ROM and enter the block device name'
+ fi
+fi
+
+if [ $option = nfs ]
+then
+ mountpoint="$vardir/methods/mnt"
+ while [ -z "$nfsserver" ]
+ do
+ echo -n \
+"What is the name of the NFS server ? [$defaultnfsserver] "
+ read response
+ if [ -z "$response" -a -n "$defaultnfsserver" ]
+ then
+ response="$defaultnfsserver"
+ fi
+ if [ -z "$response" ]; then continue; fi
+ if [ -x /usr/bin/rpcinfo ]
+ then
+ if rpcinfo -u "$response" mountd >/dev/null
+ then
+ nfsserver="$response"
+ else
+ echo "$response appears not to be an NFS server."
+ fi
+ elif [ -x /bin/ping ]
+ then
+ if ping -q -c 1 "$response" | grep -q ', 1 packets received'
+ then
+ nfsserver="$response"
+ else
+ echo "$response appears to be down or nonexistent."
+ fi
+ else
+ echo \
+"(I can't check that now because there is no /usr/bin/rpcinfo or /bin/ping.)"
+ nfsserver="$response"
+ fi
+ done
+ while [ -z "$nfsrempath" ]
+ do
+ echo -n "
+What is the pathname on the NFS server of the filesystem with
+the Debian files ? [$defaultnfsrempath] "
+ read response
+ if [ -z "$response" -a -n "$defaultnfsrempath" ]
+ then
+ response="$defaultnfsrempath"
+ else
+ response="`echo \"$response\" | sed -e 's:/$::; s:^/*:/:'`"
+ fi
+ umount="$mountpoint"
+ if mount -rt nfs -o nosuid,nodev "$nfsserver:$response" "$mountpoint"
+ then
+ echo
+ nfsrempath="$response"
+ else
+ umount=""
+ echo \
+"Unable to mount NFS filesystem $nfsserver:$response."
+ fi
+ done
+ nfs="$nfsserver:$nfsrempath"
+fi
+
+if [ $option = harddisk ]
+then
+ set +e
+ echo -e 'p\nq\n' | fdisk /dev/hda 2>/dev/null >$tp.f
+ if [ $? != 0 ]
+ then
+ echo -e 'p\nq\n' | fdisk /dev/sda 2>/dev/null >$tp.f
+ fi
+ set -e
+ perl -ne '
+next unless /^ *Device +Boot +Begin +Start +End +Blocks +Id +System *$/i .. !/\S/;
+next unless / [146] +DOS \d+-bit \S+$/;
+next unless m:^/\S+:;
+print $&; ' <$tp.f >$tp.d
+ newdefaultdevice="`cat $tp.d`"
+ echo "
+I need to know which disk partition contains the distribution files;
+disk partitions are specified by the block device name in Linux."
+ if [ -n "$newdefaultdevice" ]
+ then
+ echo \
+"By the way, $newdefaultdevice looks like a DOS partition."
+ fi
+ getblockdev "Enter the partition's block device name"
+fi
+
+if [ -n "$mountpoint" ]
+then
+ # We must have $mountpoint
+ if [ $option = cdrom ]
+ then
+ echo \
+'All directory names should be entered relative to the root of the CD-ROM.
+'
+ elif [ $option = nfs ]
+ then
+ echo \
+"All directory names should be entered relative to the root of the NFS
+filesystem, ie relative to $nfsrempath on the server.
+"
+ else
+ echo \
+"All directory names should be entered relative to the root of the
+$fstype filesystem on $blockdevice.
+"
+ fi
+fi
+
+while true
+do
+ if [ $option = cdrom ]
+ then
+ echo \
+"I would like to know where on the CD-ROM the top level of the Debian
+distribution is - this will usually contain the Packages-Master file.
+
+If the CD-ROM is badly organised and doesn't have a straightforward copy of
+the distribution you may answer \`none' and we'll go through the parts
+I need individually."
+ else
+ echo \
+"In order to make it easy for me to find the relevant files I'd ideally
+like to install from a straightforward copy of the Debian distribution.
+To use this I'll need to know where the top level of that copy of the
+distribution is - this directory usually contains the Packages-Master file.
+
+If you do not have a straightforward copy of the distribution available
+just answer \`none' and we'll go through the parts I need individually."
+ fi
+ defhierbase=none
+ if [ -n "$p_hierbase" ]
+ then
+ if [ -d "$mountpoint/$p_hierbase/stable/binary" ]
+ then
+ echo "
+Last time you said \`$p_hierbase', and that looks plausible."
+ defhierbase="$p_hierbase"
+ else
+ echo "
+Last time you said \`$p_hierbase', but that doesn't look plausible,
+since \`$p_hierbase/stable/binary' doesn't seem to exist."
+ fi
+ fi
+ if [ none = "$defhierbase" -a -d "$mountpoint/debian/stable/binary" ]
+ then
+ echo "
+\`/debian' exists and looks plausible, so that's the default."
+ defhierbase=/debian
+ fi
+ echo -n \
+"Distribution top level ? [$defhierbase] "
+ read response
+ if [ -z "$response" ]
+ then
+ response="$defhierbase"
+ fi
+ if [ none = "$response" ]
+ then
+ hierbase=""
+ break
+ elif [ -d "$mountpoint/$response/stable/binary" ]
+ then
+ hierbase="`echo \"$response\" | sed -e 's:/$::; s:^/*:/:'`"
+ break
+ fi
+ echo \
+"$response/stable/binary does not exist.
+"
+done
+
+whichmain=stable
+if [ -n "$hierbase" ]
+then
+ if [ -d "$mountpoint/$hierbase/development/binary" ]
+ then
+ echo \
+'
+Both a stable released distribution and a work-in-progress
+development tree are available for installation. Would you like to
+use the unreleased development tree (this is only recommended for
+experts who like to live dangerously and want to help with testing) ?'
+ yesno "$p_usedevel" 'Use unreleased development distribution ?'
+ usedevel="$response"
+ if [ "$usedevel" = yes ]
+ then
+ whichmain=development
+ fi
+ else
+ usedevel=no
+ fi
+ echo
+fi
+
+check_binary () {
+ # args: area-in-messages directory
+ if ! [ -d "$mountpoint/$2" ]
+ then
+ echo "\`$2' does not exist."
+ return
+ fi
+ if ! find "$mountpoint/$2" -follow -name '*.deb' -print \
+ 2>/dev/null | head -1 | grep . >/dev/null
+ then
+ echo "\`$2' does not contain any *.deb packages. Hmmpf."
+ return
+ fi
+ echo "Using \`$2' as $1 binary dir."
+ this_binary="$2"
+}
+
+find_area () {
+ # args: area-in-messages area-in-vars subdirectory-in-hier
+ # last-time-binary last-time-packages
+ this_binary=''
+ this_packages=''
+ if [ -n "$hierbase" ]
+ then
+ check_binary $1 "$hierbase/$3/binary"
+ fi
+ if [ $option = cdrom -a $2 = nf -a -z "$this_binary" ]
+ then
+ echo '
+Note: most CD-ROM distributions of Debian do not include programs
+available in the `non-free'\'' directory of the distribution site.
+This is because these programs have copyrights that prevent
+distribution for profit on a CD-ROM - ie they are not free software.
+If you wish to install these programs you'\''ll have to get them from an
+alternative source.'
+ fi
+ while [ -z "$this_binary" ]
+ do
+ defaultbinary="$4"
+ echo "
+Which directory contains the *.deb packages from the $1 distribution
+area (this directory is named \`$3/binary' on the distribution site) ?"
+ if [ $2 != main ]
+ then
+ if [ -z "$defaultbinary" ]
+ then
+ defaultbinary=none
+ fi
+ echo \
+"Say \`none' if this area is not available."
+ fi
+ echo -n \
+"Enter _$1_ binary dir. [$4]
+ ? "
+ read response
+ if [ -z "$response" -a -n "$defaultbinary" ]
+ then
+ response="$defaultbinary"
+ fi
+ if [ none = "$response" -a $2 != main ]
+ then
+ break
+ fi
+ case "$response" in
+ '' | none) continue ;;
+ esac
+ check_binary $1 "`echo \"$response\" | sed -e 's:/$::; s:^/*:/:'`"
+ done
+ if [ -n "$this_binary" ]
+ then
+ for f in Packages.gz packages.gz Packages packages
+ do
+ if [ -f "$mountpoint/$this_binary/$f" ]
+ then
+ echo "Using \`$this_binary/$f' for $1."
+ this_packages="$this_binary/$f"
+ break
+ fi
+ done
+ while [ -z "$this_packages" ]
+ do
+ echo -n "
+I can't find the $1 \`Packages' file. The information in the
+\`Packages' file is important for package selection during new
+installations, and is very useful for upgrades.
+
+If you overlooked it when downloading you should do get it now and
+return to this installation procedure when you have done so: you will
+find one Packages file and one Packages.gz file -- either will do --
+in the \`binary' subdirectory of each area on the FTP sites and
+CD-ROMs.
+
+You need a separate Packages file from each of the distribution areas
+you wish to install.
+
+Where is the _$1_ \`Packages' file (if none is available, say\`none')
+[$5]
+ ? "
+ read response
+ if [ -z "$response" -a -n "$5" ]
+ then
+ response="$5"
+ fi
+ case "$response" in
+ '') continue ;;
+ none) break ;;
+ /*) this_packages="$response" ;;
+ *) this_packages="/$response" ;;
+ esac
+ done
+ fi
+ eval $2'_binary="$this_binary"'
+ eval $2'_packages="$this_packages"'
+}
+
+find_area main main "$whichmain" "$p_main_binary" "$p_main_packages"
+find_area contrib ctb contrib "$p_ctb_binary" "$p_ctb_packages"
+find_area non-free nf non-free "$p_nf_binary" "$p_nf_packages"
+find_area local lcl local "$p_lcl_binary" "$p_lcl_packages"
+
+echo -n '
+Hit RETURN to continue. '
+read response
+
+exec 3>shvar.$option.new
+
+outputparam p_blockdev "$blockdevice"
+outputparam p_fstype "$fstype"
+outputparam p_mountpoint "$mountpoint"
+outputparam p_nfsserver "$nfsserver"
+outputparam p_nfsrempath "$nfsrempath"
+outputparam p_nfs "$nfs"
+outputparam p_hierbase "$hierbase"
+outputparam p_usedevel "$usedevel"
+outputparam p_main_packages "$main_packages"
+outputparam p_main_binary "$main_binary"
+outputparam p_ctb_packages "$ctb_packages"
+outputparam p_ctb_binary "$ctb_binary"
+outputparam p_nf_packages "$nf_packages"
+outputparam p_nf_binary "$nf_binary"
+outputparam p_lcl_packages "$lcl_packages"
+outputparam p_lcl_binary "$lcl_binary"
+
+mv shvar.$option.new shvar.$option
+
+xit=0
diff --git a/methods/disk.update b/methods/disk.update
new file mode 100644
index 000000000..68a525923
--- /dev/null
+++ b/methods/disk.update
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+set -e
+vardir="$1"
+method=$2
+option=$3
+
+cd "$vardir/methods/disk"
+
+. ./shvar.$option
+
+if [ -z "$p_main_packages" -a -z "$p_ctb_packages" -a \
+ -z "$p_nf_packages" -a -z "$p_lcl_packages " ]
+then
+ echo '
+No Packages files available, cannot update available packages list.
+Hit RETURN to continue. '
+ read response
+ exit 0
+fi
+
+xit=1
+trap '
+ rm -f packages-{main,ctb,nf,lcl}
+ if [ -n "$umount" ]
+ then
+ umount "$umount" >/dev/null 2>&1
+ fi
+ exit $xit
+' 0
+
+if [ -n "$p_blockdev" ]
+then
+ umount="$p_mountpoint"
+ mount -rt "$p_fstype" -o nosuid,nodev "$p_blockdev" "$p_mountpoint"
+fi
+
+if [ -n "$p_nfs" ]
+then
+ umount="$p_mountpoint"
+ mount -rt nfs "$p_nfs" -o nosuid,nodev "$p_mountpoint"
+fi
+
+for f in main ctb nf lcl
+do
+ eval 'this_packages=$p_'$f'_packages'
+ if [ -z "$this_packages" ]; then continue; fi
+ case "$p_mountpoint" in
+ */ ) packagesfile="$p_mountpoint$this_packages" ;;
+ '' ) packagesfile="$this_packages" ;;
+ * ) packagesfile="$p_mountpoint/$this_packages" ;;
+ esac
+ case "$packagesfile" in
+ *.gz | *.Z | *.GZ | *.z)
+ echo -n "Uncompressing $packagesfile ... "
+ zcat <"$packagesfile" >packages-$f
+ echo done.
+ dpkg --merge-avail packages-$f
+ ;;
+ '')
+ ;;
+ *)
+ dpkg --merge-avail "$packagesfile"
+ ;;
+ esac
+done
+
+echo -n 'Update OK. Hit RETURN. '
+read response
+
+xit=0
diff --git a/methods/floppy.desc.floppy b/methods/floppy.desc.floppy
new file mode 100644
index 000000000..0bd6329ed
--- /dev/null
+++ b/methods/floppy.desc.floppy
@@ -0,0 +1,9 @@
+Installation using a pile of floppies, at least one of which (usually
+the first) contains the Packages file, and the rest of which contain
+the binary *.deb files.
+
+If you are installing software from the `non-free' or `contrib'
+directories as well as the main Debian distribution you must have the
+Packages files for those areas on separate floppies. The usual way to
+do this is to put each Packages file on the first floppy which contains
+packages from the relevant area.
diff --git a/methods/floppy.install b/methods/floppy.install
new file mode 100644
index 000000000..a9823a492
--- /dev/null
+++ b/methods/floppy.install
@@ -0,0 +1,100 @@
+#!/bin/sh
+
+set -e
+vardir="$1"
+method=$2
+option=$3
+
+cd "$vardir/methods/floppy"
+
+mountpoint="$vardir/methods/mnt"
+
+. ./shvar.$option
+
+help () {
+ echo '
+Now I need the disks containing the packages to be installed.
+I shall keep telling you what is left to be done, in case that
+is helpful deciding which floppy to use.'
+}
+
+help
+
+xit=1
+trap '
+ if [ -n "$umount" ]
+ then
+ umount "$umount"
+ fi
+ exit $xit
+' 0
+
+while [ -z "$goconfigure" ]
+do
+ yet="`dpkg --yet-to-unpack`"
+ if [ -z "$yet" ]
+ then
+ echo '
+All packages unpacked, going on to configure them.
+'
+ goconfigure=1
+ continue
+ fi
+ echo '
+Packages yet to be unpacked:'
+ echo "$yet"
+ dpkg-split -l
+
+ echo -n '
+Insert a disk containing *.deb files, or type q to quit. '
+ read response
+ case "$response" in
+ [Qq] | [Qq][Uu][Ii][Tt] )
+ goconfigure=1
+ ;;
+ * )
+ umount="$defaultfloppy"
+ if mount -rt "$defaultfstype" "$defaultfloppy" "$mountpoint"
+ then
+ echo
+ dpkg --unpack -GROEB "$mountpoint" || true
+ umount "$defaultfloppy"
+ fi
+ umount=""
+ ;;
+ esac
+done
+
+if ! [ -z "$yet" ]
+then
+ response=""
+ while [ -z "$response" ]
+ do
+ echo -n '
+Not all the packages have yet been unpacked. Shall I try to
+proceed with configuration anyay ? If any of the packages which
+have been unpacked so far depend on any that haven'\''t then you'\''ll
+see error messages; on the other hand if you say no those packages that
+could have been configured will not be. (y/n) '
+ read response
+ case "$response" in
+ [Nn]* )
+ echo '
+OK. Be sure to come back to this, because unpacked-but-not-configured
+packages are not in general useable. Alternatively, use the Configure
+option on the dselect menu.
+'
+ exit 1
+ ;;
+ [Yy]* )
+ ;;
+ * )
+ response=""
+ ;;
+ esac
+ done
+fi
+
+dpkg --configure --pending
+
+xit=0
diff --git a/methods/floppy.names b/methods/floppy.names
new file mode 100644
index 000000000..72b189a1c
--- /dev/null
+++ b/methods/floppy.names
@@ -0,0 +1 @@
+50 floppy Install from a pile of floppy disks.
diff --git a/methods/floppy.setup b/methods/floppy.setup
new file mode 100644
index 000000000..8c16cd233
--- /dev/null
+++ b/methods/floppy.setup
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+set -e
+vardir="$1"
+method=$2
+option=$3
+
+cd "$vardir/methods/floppy"
+
+defaultfloppy=fd0
+defaultfstype=msdos
+if [ -f shvar.$option ]
+then
+ . ./shvar.$option
+ defaultfloppy="`echo \"$defaultfloppy\" | sed -e 's,^/dev/,,'`"
+fi
+
+while [ -z "$floppy" ]
+do
+ echo -n '
+Which floppy disk drive do you wish to use ? Give the name in
+/dev (eg fd0) or the MSDOS drive letter (eg A). ['$defaultfloppy'] '
+ read floppy
+ if [ -z "$floppy" ]
+ then
+ floppy="$defaultfloppy"
+ fi
+ case "$floppy" in
+ [ABab] | [ABab]: )
+ floppy="`echo $floppy | \
+ sed -e 's/:$//; s,^[Aa],/dev/fd0,; s,^[Bb],/dev/fd1,'`"
+ ;;
+ /* )
+ ;;
+ * )
+ floppy="/dev/$floppy"
+ ;;
+ esac
+ if ! [ -b "$floppy" ]
+ then
+ echo "$floppy is not a block device."
+ floppy=""
+ fi
+done
+
+while [ -z "$fstype" ]
+do
+ echo -n '
+What kind of filesystem is on the floppies ? ['$defaultfstype'] '
+ read fstype
+ if [ -z "$fstype" ]
+ then
+ fstype="$defaultfstype"
+ fi
+ if ! grep " $fstype$" /proc/filesystems >/dev/null
+ then
+ echo \
+ "Your kernel does not appear to support that filesystem type."
+ fstype=""
+ fi
+done
+
+echo
+
+outputparam () {
+ echo "$2" | sed -e "s/'/'\\\\''/; s/^/$1='/; s/$/'/" >&3
+}
+
+exec 3>shvar.$option.new
+
+outputparam defaultfloppy "$floppy"
+outputparam defaultfstype "$fstype"
+
+mv shvar.$option.new shvar.$option
+
+exit 0
diff --git a/methods/floppy.update b/methods/floppy.update
new file mode 100644
index 000000000..190308946
--- /dev/null
+++ b/methods/floppy.update
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+set -e
+vardir="$1"
+method=$2
+option=$3
+
+cd "$vardir/methods/floppy"
+
+mountpoint="$vardir/methods/mnt"
+
+. ./shvar.$option
+
+help () {
+ echo '
+First I need the disk(s) which contain the Packages file(s) for
+the parts of the archive you wish to be able to install. If you
+want to install packages from the non-free and contrib areas of
+the FTP site you need a floppy with a Packages file for each of
+those, in addition to the main Packages file for the main Debian
+distribution. If you don'\''t then you just need one Packages file.'
+}
+
+help
+
+xit=1
+trap '
+ if [ -n "$umount" ]
+ then
+ umount "$umount"
+ fi
+ exit $xit
+' 0
+
+tryupdate () {
+ if [ $success = 1 ]; then return; fi
+ if [ ! -f "$mountpoint/Packages" ]; then
+ echo "$mountpoint/Packages does not exist.";
+ return
+ fi
+ if dpkg --merge-avail "$mountpoint/Packages"
+ then
+ success=1
+ echo '
+You may incorporate another Packages file from another floppy if you wish.'
+ fi
+}
+
+while [ $xit = 1 ]
+do
+ echo -n '
+Insert a disk containing a Packages file, or type q to quit. '
+ read response
+ case "$response" in
+ [Qq] | [Qq][Uu][Ii][Tt] )
+ xit=0
+ ;;
+ * )
+ umount="$defaultfloppy"
+ if mount -rt "$defaultfstype" "$defaultfloppy" "$mountpoint"
+ then
+ success=0
+ tryupdate Packages
+ tryupdate packages
+ tryupdate PACKAGES
+ umount "$defaultfloppy"
+ fi
+ umount=""
+ ;;
+ esac
+done
+
+echo '
+OK, continuting with installation.'
+
+xit=0
diff --git a/methods/hd.setup b/methods/hd.setup
new file mode 100755
index 000000000..a238c5292
--- /dev/null
+++ b/methods/hd.setup
@@ -0,0 +1,90 @@
+#!/bin/perl
+#
+# Copyright (C) 1994 Carl Streeter <streeter@cae.wisc.edu>
+#
+# this script is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2,
+# or (at your option) any later version.
+#
+# this script is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this script; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+print "Is the partition to install from mounted? [Y] ";
+$ans = <STDIN>;
+if ($ans =~ /^[Nn]/) {
+ do {
+ do {
+ print "Which device should I mount? /dev/";
+ $drive = <STDIN>;
+ chop $drive;
+ $drive =~ tr/[A-Z]/[a-z]/;
+ } while (! -b "/dev/$drive");
+
+ $mpoint = "/mnt";
+ do {
+ print "Where should I mount it? (Please use full path) [$mpoint] ";
+ $newmp = <STDIN>;
+ chop $newmp;
+ $mpoint = $newmp if ($newmp !~ /^$/);
+ } while (($mpoint !~ ?^/?) || (! -d $mpoint));
+
+ print "These filesystems are available:";
+ open(FILESYS, "</proc/filesystems");
+ $systems = " ";
+ while (<FILESYS>) {
+ next if /^nodev/;
+ chop;
+ /(\w+)/;
+ $systems .= "$1 ";
+ }
+ print "$systems\n";
+ do {
+ print "What filesystem is the partition to mount? [ext2] ";
+ $filesys = <STDIN>;
+ chop $filesys;
+ $filesys = "ext2" if ($filesys =~ /^$/);
+ $filesys =~ tr/[A-Z]/[a-z]/;
+ } while ($systems !~ /\s$filesys\s/);
+
+ do {
+ print "Any other options for mount? ";
+ print "(eg. '-o ro' for cdrom, must start with '-') [] ";
+ $opts = <STDIN>;
+ chop $opts;
+ } while ($opts !~ /^$/ && $opts !~ /^\-/);
+
+ $command = "/bin/mount -t $filesys $opts /dev/$drive $mpoint";
+ print "I will now run \"$command\"\n";
+ # system("$command");
+ } while ($?);
+} # I never knew how hard I could make it to mount a drive.
+
+# Assumedly, the drive is now mounted
+
+open (STATUS, ">/var/lib/dpkg/methods/hd/hd.status") || die "Can't open hd.status";
+do {
+ print "What is the full path to the 'available' file?\n";
+ print "This file is found as Packages on the ftp site and CDROM";
+ print "Use 'none' if you don't have one.";
+ $avail = <STDIN>;
+ chop $avail;
+} while (! -f $avail || $avail !~ ?^/? || $avail !~ /none/);
+
+do{
+ print "What is the full path to the base directory ";
+ print "containing the .deb packages?\n";
+ $debpath = <STDIN>;
+ chop $debpath;
+} while(! -d $debpath || $debpath !~ ?^/?);
+
+print STATUS "AVAIL: $avail\n";
+print STATUS "DEBDIR: $debpath\n";
+close (STATUS);
+exit (0);
diff --git a/methods/hd.unpack b/methods/hd.unpack
new file mode 100755
index 000000000..ad22c6b0b
--- /dev/null
+++ b/methods/hd.unpack
@@ -0,0 +1,36 @@
+# Return associative array of fields from control file $file.
+sub slurp
+{
+ local ($file) = @_;
+ local (%controlinfo);
+ local (%ci);
+
+ open (CONTROL, $file) || return 1;
+
+ # Get entire text of control file.
+ undef $/; $* = 1; $_ = <CONTROL>;
+
+ # Join lines.
+ s/\n[ \t]+/ /g;
+
+ # Split on fields.
+ %controlinfo = ('PRESTUFF', split (/^(\S+):\s*/));
+
+ $/ = "\n"; $* = 0;
+ foreach $key (keys %controlinfo)
+ {
+ $key2 = $key; $key2 =~ y/A-Z/a-z/;
+ chop ($controlinfo{$key}) if (/\n/);
+ $ci{$key2} = $controlinfo{$key};
+ }
+
+ return %ci;
+}
+
+$file = "/var/lib/dpkg/methods/hd/hd.status";
+%info = slurp($file);
+$dpkg = "dpkg --auto --unpack --no-auto-select ";
+$dpkg .= "--refuse downgrade --skip-same-version";
+
+system("$dpkg $info{'debdir'}");
+
diff --git a/methods/hd.update b/methods/hd.update
new file mode 100755
index 000000000..98bf56b35
--- /dev/null
+++ b/methods/hd.update
@@ -0,0 +1,37 @@
+# Return associative array of fields from control file $file.
+sub slurp
+{
+ local ($file) = @_;
+ local (%controlinfo);
+ local (%ci);
+
+ open (CONTROL, $file) || return 1;
+
+ # Get entire text of control file.
+ undef $/; $* = 1; $_ = <CONTROL>;
+
+ # Join lines.
+ s/\n[ \t]+/ /g;
+
+ # Split on fields.
+ %controlinfo = ('PRESTUFF', split (/^(\S+):\s*/));
+
+ $/ = "\n"; $* = 0;
+ foreach $key (keys %controlinfo)
+ {
+ $key2 = $key; $key2 =~ y/A-Z/a-z/;
+ chop ($controlinfo{$key}) if (/\n/);
+ $ci{$key2} = $controlinfo{$key};
+ }
+
+ return %ci;
+}
+
+$file = "/var/lib/dpkg/methods/hd/hd.status";
+%info = slurp($file);
+open (IN, "<$info{'avail'}") || die "can't open $info{'avail'}";
+open (OUT, ">/var/lib/dpkg/available") || die "can't open /var/lib/dpkg/available";
+print OUT while (<IN>);
+close IN;
+close OUT;
+