download packages in cross-install
Hello,
The major obstacle to installing the Hurd from a Debian system using the
lots-of-packages method has generally been that it's a pain to get all
the packages by hand (yes, not *much* of a pain but still nontrivial) The
attached patch modifies cross-install to support downloading the files with
wget as part of the installation process. It also should support aborted
downloads.
In addition, the patch adds a mechanism for parsing additional options on the
command-line (this is used for activating the download feature, but I also
hooked it into some other options).
I believe that cross-install should continue to work as it does currently if
the download feature is not enabled.
Daniel
--
In dreams I crossed a barren land,
A land of ruin, far away;
Around me hung on every hand
A deathful stillness of decay.
And silent, as in bleak dismay
That song should thus forsaken be,
On that forgotten ground there lay
The broken flutes of Arcady.
-- Edwin Arlington Robinson, "Ballad of Broken Flutes"
--- cross-install Thu Sep 2 20:07:16 1999
+++ cross-install-wget Thu Sep 2 21:16:24 1999
@@ -111,6 +111,15 @@
# ./cross-install /gnu
# where /gnu is the mount point of your hurd partition.
+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}"; }
+
+shift
+
#
# CONFIGURATION
#
@@ -118,11 +127,55 @@
dpkghurd="`pwd`/dpkg-hurd"
nativeinstall="`pwd`/native-install"
log="`pwd`/install.log"
+ftphost=
+repository=`pwd`
+
+while [ "$#" -ne 0 ]
+do
+ case "$1" in
+ "--hostname"|"--dpkghurd"|"--nativeinstall"|"--log"|"--download"|"--repository")
+ if [ "$#" -lt 2 ]
+ then
+ echo "$1 needs an argument"
+ exit 1
+ fi
+ case "$1" in
+ "--hostname") hostname="$2";;
+ "--dpkghurd") dpkghurd="$2";;
+ "--nativeinstall") nativeinstall="$2";;
+ "--log") log="$2";;
+ "--download") download="$2";;
+ "--repository") repository="$2";;
+ esac
+ shift 2
+ ;;
+ "--help")
+ echo "Usage: cross-install DEST-DIR [OPTION]..."
+ echo "Cross-installation script for Debian GNU/Hurd"
+ echo
+ echo " Options:"
+ echo " --hostname name Set the hostname of the new system"
+ echo " --dpkghurd file Give the filename of the dpkg-hurd script"
+ echo " --nativeinstall file Give the filename of the native-install script"
+ echo " --log file Give the filename of the generated output log"
+ echo " --download server Download missing files from the given Debian mirror"
+ shift
+ exit 0
+ ;;
+ *)
+ echo "Bad option: $1"
+ exit 1
+ esac
+done
# END OF CONFIGURATION
set -u -e
+echo dest = ${dest}
+echo log = ${log}
+cat > ${log} < /dev/null
+
PS4='+$LINENO: '
err ()
@@ -131,23 +184,6 @@
exit 1
}
-if [ ! "$#" = 1 ] ; then
- err "exactly one argument is required, the destination directory"
-fi
-
-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.
#############################
@@ -187,12 +223,25 @@
matches=`ls -1 ${repository}/${pname}_*.deb 2> /dev/null | wc -l`
if [ ${matches} = 0 ] ; then
- pname=`basename ${pname}`
- package=`ls -1 ${repository}/${pname}_*.deb 2> /dev/null | tail -n 1`
- matches=`ls -1 ${repository}/${pname}_*.deb 2> /dev/null | wc -l`
+ newpname=`basename ${pname}`
+ package=`ls -1 ${repository}/${newpname}_*.deb 2> /dev/null | tail -n 1`
+ matches=`ls -1 ${repository}/${newpname}_*.deb 2> /dev/null | wc -l`
fi
if [ ${matches} = 0 ] ; then
+ if ! [ -z "$download" ]; then
+ echo - ${pname} not found, downloading from $download.
+ mkdir -p ${repository}/partial
+ wget --retr-symlinks -cqP ${repository}/partial ftp://${download}/debian/dists/unstable/main/binary-hurd-i386/${pname}_\*.deb
+ mv ${repository}/partial/`basename ${pname}`_*.deb ${repository}/`dirname ${pname}`
+ package=`ls -1 ${repository}/${pname}_*.deb 2> /dev/null | tail -n 1`
+ matches=`ls -1 ${repository}/${pname}_*.deb 2> /dev/null | wc -l`
+ fi
+ fi
+
+ pname=`basename $pname`
+
+ if [ ${matches} = 0 ] ; then
echo - ${pname} could not be found, but it is needed.
exit 1
else
@@ -211,10 +260,23 @@
matches=`ls -1 ${repository}/${pname}_*.deb 2> /dev/null | wc -l`
if [ ${matches} = 0 ] ; then
- pname=`basename ${pname}`
- package=`ls -1 ${repository}/${pname}_*.deb 2> /dev/null | tail -n 1`
- matches=`ls -1 ${repository}/${pname}_*.deb 2> /dev/null | wc -l`
+ newpname=`basename ${pname}`
+ package=`ls -1 ${repository}/${newpname}_*.deb 2> /dev/null | tail -n 1`
+ matches=`ls -1 ${repository}/${newpname}_*.deb 2> /dev/null | wc -l`
fi
+
+ if [ ${matches} = 0 ] ; then
+ if ! [ -z "$download" ]; then
+ echo - ${pname} not found, downloading from $download.
+ mkdir -p ${repository}/partial
+ wget --retr-symlinks -cqP ${repository}/partial ftp://${download}/debian/dists/unstable/main/binary-hurd-i386/${pname}_\*.deb
+ mv ${repository}/partial/`basename ${pname}`_*.deb ${repository}/`dirname ${pname}`
+ package=`ls -1 ${repository}/${pname}_*.deb 2> /dev/null | tail -n 1`
+ matches=`ls -1 ${repository}/${pname}_*.deb 2> /dev/null | wc -l`
+ fi
+ fi
+
+ pname=`basename pname`
if [ ${matches} = 0 ] ; then
echo - ${pname} could not be found, let us hope it is not vital.
Reply to: