#!/bin/sh # http://www.phys.ethz.ch/~franklin/Projects/dphys2/dphys2rescue # - build dphys2 replacement rescue floppy image for Debian woody (3.0) # copyright ETH Zuerich Physics Departement, # use under either BSD or GPL license # author Neil Franklin, last modification 2004.10.14 ### ------ configuration for this site # first CONF_* various site or subnet dependant user config variables # then DEBUG_* various debugging settings # last SYS_* various system internal values # some of these are overridable by command line options # --- CONF_* various site or subnet dependant user config variables # base URL from which all Debian stuff can be downloaded CONF_DEBSERVER=http://ftp.debian.org/debian # are we using an 2.2 or 2.4 style kernel # if Debian kernels, this selects whether standard 2.2.20 or bf24 2.4.18 # if own kernels, this determines which Debian .config to use as base # if no own config is provided in CONF_KERNEL_CONFIG # so set this allways, if using or making an 2.4 kernel, instead of 2.2 CONF_KERNEL_24=no # use this to select an own (2.2 or 2.4) kernel source, to self compile # only needed if making own kernel CONF_KERNEL_OWN="" # and take this kernel .config to use, for the self compile # if not set, extract .config File from Debian rescue floppy image # only may be needed if making own kernel # your kernel config is NOT ALLOWED to have in it: # - devfs (CONFIG_DEVFS_FS), as old style /dev/* names are used and needed # your kernel config MUST HAVE COMPILED IN in it (= not as modules): # - floppy device (CONFIG_BLK_DEV_FD), for reading 2nd/root floppy # (only needed if you are going to make boot floppies) # - loopback devide (CONFIG_BLK_DEV_LOOP), for getting kernel from resc image # - RAM disk device (CONFIG_BLK_DEV_RAM), for root filesystem while install # - initrd support (CONFIG_BLK_DEV_INITRD), for loading root filesys # (only needed if you are going to make an boot CD) # - FAT filesystem (CONFIG_FAT_FS + CONFIG_MSDOS_FS), for extracting kernel CONF_KERNEL_CONFIG="" # server where we upload our compiled floppy images and driver archives to CONF_INST_SERVER=not-configured-server # user as which we login to above server CONF_USER=not-configured-user # make sure multiple users (group of them) can install files on package server # if this is set, chgrp directories and files to this group and chmod g+w CONF_GROUP="" # base directory on server where we put our floppy images and driver archives # this is the base directory for adding dists/woody/local/
/*/*/*.deb # paralleling Debians use dists/woody/main/
/*/* on their servers # and so should appear in the http:// space of the server # dphys2rescue -u uploads everything relative to this CONF_INST_BASE=/not/configured/directory # base URL from which the dphys2 rescue root and drivers can be fetched # used for generating the URLs. to access our packages web server # the end result should parallel the scp login@server:/basedir above CONF_OWNSERVER=http://not-configured-server/not/configured/directory # this is the directory to use, within dists/woody/local/main/disks-i386 tree # vary this for multiple sets of rescue images and drivers archives # naming schemes maybe by subnets, or by kernel options, or by compiling user CONF_DISKSVERSION=custom # install floppy drive, where our generated rescue image goes # this should be the drive on the install generating system, not on target(s) # most people can leave this as it is CONF_INST_FLOPPY=/dev/fd0 # --- DEBUG_*, various debugging settings # these can be set to "yes" by -D option, followed by name without DEBUG_ # such as like this: dphys2rescue -D PRINT_STEP -D LEAVE_TEMPFILES -g # set this to sleep after displaying each steps header, number is in seconds #DEBUG_SLEEP=2 # set this to output debug state info after each step #DEBUG_PRINT_STEP=yes # set this to wait after each debug state info #DEBUG_WAIT_STEP=yes # set this to not delete temporary files (workdir) after -g #DEBUG_LEAVE_TEMPFILES=yes # set this to leave temporary directories undeleted after -u #DEBUG_LEAVE_TEMPDIRS=yes # --- SYS_*, various system internal values # where we want to do all the kernel compile / rescue modify stuff # this must be a directory that root can access (not a root-squash NFS mount) # and there should be about 70MByte free space in its filesystem SYS_WORKDIR=/var/tmp/dphys2rescue-$$-work # where we want to put together stuff for upload # not ./upload as this may collide with something user already has SYS_UPLOADDIR=/var/tmp/dphys2rescue-$$-upload # note: this program has only been designed for and tested with i386 # others at own risk, I expect them to fail badly SYS_ARCH=i386 ### ------ actual implementation from here on # no user settings any more below this point # --- config file stuff # what we are, program and package name NAME=dphys2rescue PNAME=dphys2 # check user config file(s), let user override settings # same config files used in dphys2[rescue|root|cd|pxe] and dbootstrap if [ -f /etc/${PNAME} ] ; then . /etc/${PNAME} fi if [ -f /etc/default/${PNAME} ] ; then . /etc/default/${PNAME} fi if [ -f ~/.${PNAME} ] ; then . ~/.${PNAME} fi if [ -f ./${PNAME} ] ; then . ./${PNAME} fi # --- parse command line # so long next parameter is a set of options (= begins with an - character) while [ x`/bin/echo $1 | /usr/bin/cut -c 1` = x- ] ; do # extract options from parameter (cut off the "-") OPTS=`/bin/echo $1 | /usr/bin/cut -c 2-` shift 1 # so long still unprocessed option characters while [ x${OPTS} != x ] ; do # first option to process OPT=`/bin/echo ${OPTS} | /usr/bin/cut -c 1` # and rest of options for later OPTS=`/bin/echo ${OPTS} | /usr/bin/cut -c 2-` case ${OPT} in d) # download: download orignal Debian files from server DO_DOWN=yes ;; g) # generate: generate dphys2 files DO_GEN=yes ;; w) # workdir: generate using this work directory SYS_WORKDIR=$1 shift 1 ;; u) # upload: upload generated files to local install server DO_UPLOAD=yes ;; b) # base: upload generated package files to base directory CONF_INST_BASE=$1 shift 1 ;; f) # fetch: fetch dphys2 files from local install server DO_FETCH=yes ;; i) # install: install original or dphys2 files onto floppy DO_INST=yes ;; r) # remove: remove dphys2 files, after installing DO_REMOVE=yes ;; D) # Debug: set an debug option to yes eval DEBUG_$1=yes shift 1 ;; h) # help: give out help how this script can be used /bin/cat << END-HELP-TEXT Usage is: $0 [options] options: -d download: download orignal Debian rescue image and drivers archive files from distribution server -g generate: generate dphys2 rescue image and drivers archive -w workdir workdir: generate using this work directory -u upload: upload generated files to local install server for usage by dphys2root and dbootstrap while install -b baseaddr base: upload generated package files to this base directory -f fetch: fetch dphys2 rescue image from local install server usefull if installing on different system than generating -i install: install original or dphys2 rescue image onto floppy -r remove: remove Debian and dphys2 files, after installing -D Debug: activate an debug option, see source for operation -h help: give out help how this script can be used If multiple of -d -g -u -f -i -r or -i are used, they are processed in the order they appear here in the help section, not the order they are typed on the command line. Other options modify behaviour. END-HELP-TEXT exit 0 ;; *) # not one of our recognized options /bin/echo "$0: ERROR: unknown option: ${OPT}" >&2 /bin/echo # call self with -h to display help $0 -h exit 1 ;; esac done done if [ "x${DO_DOWN}${DO_GEN}${DO_UPLOAD}${DO_FETCH}${DO_INST}${DO_REMOVE}" \ = x ] ; then /bin/echo "$0: WARNING: no option selected, doing nothing" >&2 fi if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/echo options are: DO_DOWN: ${DO_DOWN}, DO_GEN: ${DO_GEN}, \ DO_UPLOAD: ${DO_UPLOAD}, DO_FETCH: ${DO_FETCH}, \ DO_INST: ${DO_INST}, DO_REMOVE: ${DO_REMOVE} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi # --- test if we can work # this script is intended to be run as root, it will fail if run as user! if [ ! `/usr/bin/whoami` = root ] ; then /bin/echo "$0: sorry, you need to run this script as root - aborting ..." exit 1 fi # --- compute paths on disk image server # paths for Debian files we download from server DEBDISKS=dists/woody/main/disks-${SYS_ARCH}/current # for standard 2.2(.20) kernel DEBRESCUE=${DEBDISKS}/images-1.44/rescue.bin DEBROOT=${DEBDISKS}/images-1.44/root.bin DEBDRIVERS=${DEBDISKS}/drivers.tgz # for bf2.4 (2.4.18) kernel DEBRESCUE_BF24=${DEBDISKS}/images-1.44/bf2.4/rescue.bin DEBROOT_BF24=${DEBDISKS}/images-1.44/bf2.4/root.bin DEBDRIVERS_BF24=${DEBDISKS}/bf2.4/drivers.tgz # paths for dphys2 files we upload to and fetch from server OWNDISKS=dists/woody/local/main/disks-${SYS_ARCH}/${CONF_DISKSVERSION} OWNRESCUE=${OWNDISKS}/images-1.44/rescue-dphys.bin OWNROOT=${OWNDISKS}/images-1.44/root-dphys.bin OWNDRIVERS=${OWNDISKS}/drivers-dphys.tgz # --- download Debian rescue disk image to work on # determine the correct rescue floppy image file # used by -d and -g and others, so once here outside of -d if [ x${CONF_KERNEL_24} = xyes ] ; then RESC_URL="${CONF_DEBSERVER}/${DEBRESCUE_BF24}" else RESC_URL="${CONF_DEBSERVER}/${DEBRESCUE}" fi RESC=`/usr/bin/basename ${RESC_URL}` if [ x${DO_DOWN} != x ] ; then /bin/echo "--------------------------------------------" /bin/echo "*** downloading Debian rescue disk image ***" if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # -N so only newer is fetched, save waisting bandwidth if already here # if user wants to force download, use an make clean before # downloaded and to-upload files should end in current directory # this is also most likely where config and kernel archive will be # everything else in work directory and then deleted at the end /usr/bin/wget -N ${RESC_URL} if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${RESC} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi fi # --- no own kernel, no need to compile, only above download for floppy install if [ x${CONF_KERNEL_OWN} = x ] ; then /bin/echo "-----------------------------------------------" /bin/echo "*** using standard Debian rescue floppy *** ..." /bin/echo "no own kernel, not making own rescue image or drivers archive" # thats it for using standard rescue, rest of -dgu all for making own rescue DO_DOWN="" DO_GEN="" DO_UPLOAD="" fi # --- download Debian drivers archive to work on # determine the correct full drivers archive if [ x${CONF_KERNEL_24} = xyes ] ; then DRV_URL="${CONF_DEBSERVER}/${DEBDRIVERS_BF24}" else DRV_URL="${CONF_DEBSERVER}/${DEBDRIVERS}" fi DRV=`/usr/bin/basename ${DRV_URL}` if [ x${DO_DOWN} != x ] ; then /bin/echo "----------------------------------------------" /bin/echo "*** downloading Debian drivers tar archive ***" if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # -N to only newer is fetched, save waisting bandwidth if already here # if user wants to force download, use an make clean before /usr/bin/wget -N ${DRV_URL} if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${DRV} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi fi # --- space to work in if [ x${DO_GEN} != x ] ; then /bin/mkdir -p ${SYS_WORKDIR} fi # --- unpack users kernel if [ x${DO_GEN} != x ] ; then /bin/echo "----------------------------------------------------" /bin/echo "*** unpacking kernel *** from ${CONF_KERNEL_OWN} ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi if [ ! -f ${CONF_KERNEL_OWN} ] ; then /bin/echo "$0: ERROR: kernel archive ${CONF_KERNEL_OWN} not found" >&2 exit 1 fi # remove any existing kernel, to avoid mess on overwriting # directory may be linux for < 2.4 or linux- for >= 2.4 if [ -d ${SYS_WORKDIR}/linux* ] ; then /bin/rm -rf ${SYS_WORKDIR}/linux* fi # allow either .tar.bz or .tar.gz archives if [ x`/bin/echo ${CONF_KERNEL_OWN} | /bin/grep '\.tar\.bz2$'` != x ] ; then /bin/tar -jxpf ${CONF_KERNEL_OWN} -C ${SYS_WORKDIR} elif [ x`/bin/echo ${CONF_KERNEL_OWN} | /bin/grep '\.tar\.gz$'` != x ] ; then /bin/tar -zxpf ${CONF_KERNEL_OWN} -C ${SYS_WORKDIR} else /bin/echo "kernel archive ${CONF_KERNEL_OWN} is not a .tar.bz or .tar.gz" exit 1 fi if [ -d ${SYS_WORKDIR}/linux* ] ; then # not LINUX=${SYS_WORKDIR}/linux* as then cp -p ${LINUX}/.config # becomes cp -p ${SYS_WORKDIR}/linux*/.config and doesnt expand LINUX=`/bin/echo ${SYS_WORKDIR}/linux*` else /bin/echo "$0: ERROR: kernel archive ${CONF_KERNEL_OWN} did not unpack" >&2 exit 1 fi if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -ald ${LINUX} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi fi # --- extract Debians .config file to kernel directory if [ x${DO_GEN} != x ] ; then # no .config file given so extract one from Debian rescue disk if [ x${CONF_KERNEL_CONFIG} != x ] ; then /bin/echo "---------------------------------------------------------" /bin/echo "*** copying in .config *** from ${CONF_KERNEL_CONFIG} ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi if [ ! -f ${CONF_KERNEL_CONFIG} ] ; then /bin/echo "$0: ERROR: kernel config ${CONF_KERNEL_CONFIG} not found" >&2 exit 1 fi /bin/cp -p ${CONF_KERNEL_CONFIG} ${LINUX}/.config else /bin/echo "------------------------------------------------------" /bin/echo "*** extracting .config *** from Debian rescue disk ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # get rescue file system from floppy image RESCFLOPPY=${SYS_WORKDIR}/floppy /bin/mkdir -p ${RESCFLOPPY} /bin/mount -o loop ${RESC} ${RESCFLOPPY} /bin/gunzip -c ${RESCFLOPPY}/config.gz > ${LINUX}/.config /bin/umount ${RESCFLOPPY} /bin/rm -rf ${RESCFLOPPY} fi if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${LINUX}/.config /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi fi # --- make oldconfig if [ x${DO_GEN} != x ] ; then /bin/echo "----------------------------------------" /bin/echo "*** making oldconfig *** in ${LINUX} ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi /bin/echo /bin/echo "*** --- oldconfig... --- ***" /bin/echo "(if you are using an debian .config this may ask you questions)" /bin/echo (cd ${LINUX}; /usr/bin/make oldconfig) if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${LINUX}/.config /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi fi # --- build the kernel, make dep bzImage modules if [ x${DO_GEN} != x ] ; then /bin/echo "-------------------------------------------" /bin/echo "*** building the kernel *** in ${LINUX} ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi /bin/echo /bin/echo "*** --- dep... --- ***" /bin/echo (cd ${LINUX}; /usr/bin/make dep) /bin/echo /bin/echo "*** --- bzImage... --- ***" /bin/echo # this needs to be bzImage because syslinux bootloader only knows that (cd ${LINUX}; /usr/bin/make -j 4 bzImage) /bin/echo /bin/echo "*** --- modules... --- ***" /bin/echo (cd ${LINUX}; /usr/bin/make -j 4 modules) if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${LINUX}/.config* ${LINUX}/vmlinux \ ${LINUX}/System.map ${LINUX}/arch/${SYS_ARCH}/boot/bzImage /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi fi # --- pack stuff into dphys2 rescue floppy image # name for new floppy image # used also in other places RESC_DPHYS2=`/usr/bin/basename ${OWNRESCUE}` if [ x${DO_GEN} != x ] ; then /bin/echo "--------------------------------------------------" /bin/echo "*** packing kernel *** into dphys2 rescue disk ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # copy of Debians image (for Syslinux and help stuff) to pack kernel into /bin/cp -p ${RESC} ${RESC_DPHYS2} # put our kernel stuff onto it RESCFLOPPY=${SYS_WORKDIR}/floppy /bin/mkdir -p ${RESCFLOPPY} /bin/mount -o loop ${RESC_DPHYS2} ${RESCFLOPPY} /bin/cp -p ${LINUX}/arch/${SYS_ARCH}/boot/bzImage ${RESCFLOPPY}/linux.bin /bin/gzip -c ${LINUX}/System.map > ${RESCFLOPPY}/sys_map.gz /bin/gzip -c ${LINUX}/.config > ${RESCFLOPPY}/config.gz # change name of kernel in floppy images boot files KERNVERS=`/bin/echo ${CONF_KERNEL_OWN} | \ /usr/bin/cut -f 2 -d "-" | /usr/bin/cut -f1-3 -d "."` # announce what version the user has inserted, for checking if right one # use name.tmp naming instead of name.ext.1 because of FAT 8.3 limit /bin/sed -e "/^This disk uses/s/2.*$/${KERNVERS}/" \ ${RESCFLOPPY}/debian.txt > ${RESCFLOPPY}/debian.tmp /bin/mv ${RESCFLOPPY}/debian.tmp ${RESCFLOPPY}/debian.txt # also change ending for kernel/config/system.map filenames in /boot # no need to set chmod +x, as on FAT all files have this allways # also use name.tmp naming instead of name.ext.1 because of FAT 8.3 limit /bin/sed -e "/^VERSION=/s/2.*$/${KERNVERS}/" \ ${RESCFLOPPY}/install.sh > ${RESCFLOPPY}/install.tmp /bin/mv ${RESCFLOPPY}/install.tmp ${RESCFLOPPY}/install.sh if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${RESCFLOPPY} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi /bin/umount ${RESCFLOPPY} /bin/rm -rf ${RESCFLOPPY} # writing to loop mounted image file does not seem to update its access time /bin/touch ${RESC_DPHYS2} if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${RESC_DPHYS2} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi fi # --- pack stuff into dphys2 drivers archive # name for new floppy image # used also in other places DRV_DPHYS2=`/usr/bin/basename ${OWNDRIVERS}` if [ x${DO_GEN} != x ] ; then /bin/echo "-------------------------------------------------------" /bin/echo "*** packing modules *** into dphys2 drivers archive ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # create our /lib/modules//* stuff /bin/rm -rf ${SYS_WORKDIR}/modules /bin/mkdir -p ${SYS_WORKDIR}/modules (cd ${LINUX}; INSTALL_MOD_PATH=`/bin/pwd`/../modules make modules_install) # unpack drivers archive to insert our modules /bin/rm -rf ${SYS_WORKDIR}/drivers /bin/mkdir -p ${SYS_WORKDIR}/drivers /bin/tar zxpf ${DRV} -C ${SYS_WORKDIR}/drivers # insert our modules into driver archive /bin/tar zcf ${SYS_WORKDIR}/drivers/modules.tgz -C ${SYS_WORKDIR}/modules . # and repack our new drivers archive /bin/tar zcf ${DRV_DPHYS2} -C ${SYS_WORKDIR}/drivers . if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${SYS_WORKDIR}/drivers ${DRV_DPHYS2} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi fi # --- tidy up after working if [ x${DO_GEN} != x ] ; then /bin/echo "-----------------------------------" /bin/echo "*** tidying up from working *** ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${SYS_WORKDIR} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi # remove temporary directory and its contents, to save space # must be after debug printout if [ x${DEBUG_LEAVE_TEMPFILES} != xyes ] ; then # but offer to leave this to investigate bugs /bin/rm -rf ${SYS_WORKDIR} fi fi # --- upload dphys2 rescue floppy image and drivers archive if [ x${DO_UPLOAD} != x ] ; then /bin/echo "---------------------------------------------------------------" /bin/echo "*** uploading rescue and drivers *** to ${CONF_INST_SERVER} ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # put together stuff to upload, needs an temp dir RESC_DIR=${SYS_UPLOADDIR}/`/usr/bin/dirname ${OWNRESCUE}` DEV_DIR=${SYS_UPLOADDIR}/`/usr/bin/dirname ${OWNDRIVERS}` /bin/mkdir -p ${RESC_DIR} ${DRV_DIR} if [ x${CONF_GROUP} != x ] ; then /bin/chgrp -R ${CONF_GROUP} ${SYS_UPLOADDIR} /bin/chmod -R 2775 ${SYS_UPLOADDIR} fi if [ -f ${RESC_DPHYS2} ] ; then /bin/cp -p ${RESC_DPHYS2} ${RESC_DIR} if [ x${CONF_GROUP} != x ] ; then /bin/chgrp ${CONF_GROUP} ${RESC_DIR}/* /bin/chmod 664 ${RESC_DIR}/* fi fi if [ -f ${DRV_DPHYS2} ] ; then /bin/cp -p ${DRV_DPHYS2} ${DEV_DIR} if [ x${CONF_GROUP} != x ] ; then /bin/chgrp ${CONF_GROUP} ${DEV_DIR}/*.tgz /bin/chmod 664 ${DEV_DIR}/*.tgz fi fi # include directory tree, duplicating tree to server, in case server has none # may be none if new package is in an previously unused section # this is a bit site dependant, you need ssh on your local package server # 2> needed to get rid of error message, because scp can not change dir modes # this loses us the progress bar, because scp tests also 2> for tty or not # if user has given us somewhere to upload to, else dphys2root gets screwed if [ x${CONF_INST_SERVER} != x ] ; then /usr/bin/scp -pr ${SYS_UPLOADDIR}/* \ ${CONF_USER}@${CONF_INST_SERVER}:${CONF_INST_BASE} 2> /dev/null else /bin/echo "$0: ERROR: no server to upload rescue floppy image to" >&2 exit 1 fi if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -alR ${SYS_UPLOADDIR}/* /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi # remove temporary directory and its contents, to save space # must be after debug printout if [ x${DEBUG_LEAVE_TEMPDIRS} != xyes ] ; then # but offer to leave this to investigate bugs /bin/rm -rf ${SYS_UPLOADDIR} fi fi # --- fetch dphys2 rescue disk image to install if [ x${DO_FETCH} != x ] ; then /bin/echo "-----------------------------------------" /bin/echo "*** fetching dphys2 rescue disk image ***" if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # always dphys2 root image, never fetch Debian, use -d for that RESC_DPHYS2_URL="${CONF_OWNSERVER}/${OWNRESCUE}" # usage see -d download /usr/bin/wget -N ${RESC_DPHYS2_URL} if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${RESC_DPHYS2} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi fi # --- install rescue disk image onto an floppy if [ x${DO_INST} != x ] ; then /bin/echo "------------------------------------" /bin/echo "*** installing rescue disk image ***" if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # determine correct rescue floppy image file, downloaded or generated/fetched if [ -f ${RESC_DPHYS2} ] ; then RESC_FLOPPY=${RESC_DPHYS2} else RESC_FLOPPY=${RESC} fi /bin/dd if=${RESC_FLOPPY} of=${CONF_INST_FLOPPY} bs=1024 if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${RESC_FLOPPY} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi fi # --- remove rescue disk images and drivers tar archives if [ x${DO_REMOVE} != x ] ; then /bin/echo "------------------------------------------------------------" /bin/echo "*** removing rescue disk images and drivers tar archives ***" if [ x${DEBUG_PRINT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${RESC} ${DRV} ${RESC_DPHYS2} ${DRV_DPHYS2} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi if [ -f ${RESC} -o -f ${DRV} -o \ -f ${RESC_DPHYS2} -o -f ${DRV_DPHYS2} ] ; then /bin/rm -rf ${RESC} ${DRV} ${RESC_DPHYS2} ${DRV_DPHYS2} fi fi