#!/bin/sh # http://www.phys.ethz.ch/~franklin/Projects/dphys2/dbootstrap # - replaces /sbin/dbootstrap of install root floppy of Debian woody (3.0) # copyright ETH Zuerich Physics Deparement, use under either BSD or GPL license # author Neil Franklin, last modification 2003.08.04 # this script replaces the Debian /sbin/dbootstrap binary program # whose purpose is to install an basic Debian system # this replacement does so without asking lots of question - automatically # so that we can install 100s of machines without lots of work time usage # based on /derived from Debian boot-floppies-3.0.22 utilities/dbootstrap # ------ read in setup # this is shared with Makefile, makeroot, makerescue, endfirstrun . /etc/setup-dphys2 # ------ announce that we are running /bin/echo "============================================================" /bin/echo "*** dphys2 Debian 3.0 (woody) simple automated installer ***" /bin/echo "============================================================" /bin/echo if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # ------ host specific stuff, changes for each host - ask user at install # ensure that rescue floppy is re-inserted into drive, for fetching kernel /bin/echo "-> eject root floppy, so that later reboot from HD does not fail <-" /bin/echo # ask user for hostname and possibly IP address /bin/echo -n "enter hostname: " read CONF_HOSTNAME if [ x${CONF_DHCP} != xyes ] ; then /bin/echo -n "enter IP address: " read CONF_IPADDR fi /bin/echo "no further questions will be asked, now auto-installing ..." # ------ from here on code to do the actual actions, follows Debians menus # --- "Configure the Keyboard" menu # [all *.c and *() are relative to boot-floppies-3.0.22/utilities/dbootstrap] # replaces kbdconfig.c configure_keyboard() # set our standard keyboard /bin/echo "---------------------------------------------------" /bin/echo "*** Configure the Keyboard *** to ${CONF_KEYBD} ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi /bin/echo "KEYBD='${CONF_KEYBD}'" > /tmp/keybd_settings /bin/zcat /etc/keymaps.tgz | /bin/tar -xOf - ${CONF_KEYBD}.bmap | \ /sbin/loadkmap if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/cat /tmp/keybd_settings /bin/echo "--- end debug info ---" read dummy fi # --- auto-select disk drive type IDE vs SCSI we want to install on # replaces partition_config.c select_drive() # if user has set ${CONF_DISK} to /dev/??? use that, else auto-select if [ x${CONF_DISK} = x ] ; then /bin/echo "------------------------------------------------------" /bin/echo "*** Auto-Select Drive hda vs sda *** for CONF_DISK ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi if [ x`ls -1d /proc/ide/hd? | grep hda` != x ] ; then # we have got an bootable (hda) IDE disk in here CONF_DISK=/dev/hda else # else assume we have got an bootable (sda) SCSI disk in here CONF_DISK=/dev/sda fi # fixup setup, so /target/${SYS_ENDFIRSTRUN_ON_TARGET} can use ${CONF_DISK} /bin/echo >> /etc/setup-dphys2 /bin/echo >> /etc/setup-dphys2 /bin/echo "# ------ added by dbootstrap auto-select " >> /etc/setup-dphys2 /bin/echo >> /etc/setup-dphys2 /bin/echo "CONF_DISK=${CONF_DISK}" >> /etc/setup-dphys2 if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/echo "auto-selected ${CONF_DISK} for CONF_DISK" /bin/echo "--- end debug info ---" read dummy fi fi # --- set up IDE DMA so that installation is not slowed down # this is not part of the normal Debian installation prosess # use this to force IDE DMA usage on some stupid hd disk drives if [ x${CONF_DISK_IDEDMA} != x ] ; then /bin/echo "-----------------------------------------------------" /bin/echo "*** Force enabling of IDE DMA *** on ${CONF_DISK} ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi DRIVE=`echo ${CONF_DISK} | cut -f 3 -d "/"` /bin/echo "using_dma:1" > /proc/ide/${DRIVE}/settings /bin/echo "io_32bit:1" > /proc/ide/${DRIVE}/settings if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/cat /proc/ide/${DRIVE}/settings /bin/echo "--- end debug info ---" read dummy fi fi # --- "Partition a Hard Disk" menu # replaces partition_config.c partition_disk() # use an simple boot+swap+root configuration /bin/echo "----------------------------------------------------------------" /bin/echo "*** Partition Hard Disk *** ${CONF_DISK} into boot+swap+root ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # sfdisk is an command line driven fdisk, no menu, scriptable # 16M Linux for /boot, ${CONF_SWAP_SIZE} Swap for swap, rest Linux for / /sbin/sfdisk -uM ${CONF_DISK} << EOF ,16,L ,${CONF_SWAP_SIZE},S ,,L ; EOF # generate partition names PART_BOOT=${CONF_DISK}1 PART_SWAP=${CONF_DISK}2 PART_ROOT=${CONF_DISK}3 # and number for "activate" PART_BOOT_NO=1 if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /sbin/fdisk -l ${CONF_DISK} /bin/echo "--- end debug info ---" read dummy fi # --- "Initialize and Activate a Swap Partition" menu # replaces partition_config.c init_swap() # straightforward usage of our swap partition /bin/echo "------------------------------------------------------------------" /bin/echo "*** Initialize and Activate Swap Partition *** on ${PART_SWAP} ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi /sbin/mkswap ${PART_SWAP} /sbin/swapon ${PART_SWAP} if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /usr/bin/free /bin/echo "--- end debug info ---" read dummy fi # --- "Initialize a Linux Partition" menu, twice # replaces partition_config.c init_linux() and init_ext() # first set up our root partition /bin/echo "---------------------------------------------------------------" /bin/echo "*** Initialize and Mount Partition *** root on ${PART_ROOT} ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi /sbin/mkfs.ext2 ${PART_ROOT} /bin/mount ${PART_ROOT} /target # second add our boot partition /bin/echo "*** Initialize and Mount Partition *** boot on ${PART_BOOT} ..." /sbin/mkfs.ext2 ${PART_BOOT} /bin/mkdir /target/boot /bin/mount ${PART_BOOT} /target/boot if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/mount /bin/echo "--- end debug info ---" read dummy fi # --- "Install Kernel and Driver Modules menu" # replaces extract_kernel.c extract_kernel_and_modules() and # choose_and_install() /bin/echo "--------------------------------------------------------------" /bin/echo "*** Install Kernel and Driver Modules menu *** from floppy ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # - subpart check_pending_config() # just duplicate Debian code effects, write config sofar exists to disk /bin/echo "* writing base config setting to disk ..." /bin/mkdir /target/root /bin/echo "BUILDTIME='2002.01.01-07:53+0000'" >/target/root/dbootstrap_settings /bin/cat /tmp/keybd_settings >> /target/root/dbootstrap_settings /bin/echo "LANG_INST='C'" >> /target/root/dbootstrap_settings /bin/echo "LANGUAGE_INST='en'" >> /target/root/dbootstrap_settings if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/cat /target/root/dbootstrap_settings /bin/echo "--- end debug info ---" read dummy fi ## - subpart extract_kernel.c install_floppy() # # install kernel, requires rescue floppy to be in drive after boot # *** do not do this here, wait until net working, then install from net *** # #/bin/echo "* installing kernel from rescue disk in /dev/fd0 ..." # ## -t auto gives warnings, -t msdos avoids them, but hangs with bf2.4 kernel #/bin/mount -r -t auto /dev/fd0 /floppy ## allow retries if it fails (say due to an wrong disk) #while [ ! -f /floppy/type.txt ] ; do # /bin/echo dbootstrap Error: no rescue floppy in /dev/fd0, insert proper # # give User chance for corrective action, possibly using 2nd console # read dummy #done #cd /floppy #./install.sh /target #cd / #/bin/umount /floppy # #if [ x${DEBUG_WAIT_STEP} = xyes ] ; then # /bin/echo "--- debug info ---" # /bin/ls -al /target /target/boot # /bin/echo "--- end debug info ---" # read dummy #fi # - subpart extract_kernel.c install_floppies() # install drivers, small selection instead of 4 disks, no disk jockey /bin/echo "* installing our small selection of drivers ..." /bin/mkdir /target/tmp; chown 0.3 /target/tmp; chmod 01777 /target/tmp /bin/mkdir /target/tmp/drivers; chown 0.3 /target/tmp/drivers; # here Debian fetches the 4 drivers disks to /target/drivers.tgz # we have already included an small drivers file on this root disk # because this is incomplete we will have to add all the rest later from net /bin/cp -p ${SYS_DRIVERS_TGZ} /target/drivers.tgz cd /target/tmp/drivers /bin/zcat /target/drivers.tgz | tar -x ./install.sh /target cd / /bin/rm /target/drivers.tgz if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/ls -alR /target/lib/modules /bin/echo "--- end debug info ---" read dummy fi # - back from choose_and_install() do util.c frob_lib_modules() # from install system to use now installed modules /bin/echo "* using installed modules while install ..." /bin/rm -rf /lib/modules.old /bin/mv /lib/modules /lib/modules.old /bin/ln -s /target/lib/modules /lib/modules # - back from frob_lib_modules() /sbin/depmod -a if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/ls -ald /lib/modules* /bin/echo "--- end debug info ---" read dummy fi # --- "Configure Device Driver Modules" menu # replaces baseconfig.c configure_drivers() # try to activate all our possible Ethernet drivers /bin/echo "-------------------------------------------------------------------" /bin/echo "*** Configure Device Driver Modules*** for our Ethernet drivers ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi /sbin/depmod -a /bin/echo /sbin/modprobe >/proc/sys/kernel/modprobe /usr/bin/test -f /target/etc/modules || cp /etc/modules /target/etc/ # here Debian uses GUI modconf to ask which drivers to install # we simply try through all our few pre-selected drivers # ***BUGFIX*** Debian only does this "cp" for s390, we need it also for x86 # perhaps this is a difference of modconf GUI vs --load-only mode /bin/cp -a /etc/modules.conf /target/etc/ for module in ${CONF_MODULESNET}; do modulebase=`/bin/echo $module | /usr/bin/cut -f 1 -d "."` /target/usr/sbin/modconf --target /target --libdir /tmp/drivers \ --load-only ${modulebase} done # then we add our driver line to /etc/modules /sbin/lsmod | /bin/grep -v ^Module | /bin/grep -v ^unix | \ /bin/grep -v ^af_packet | /usr/bin/cut -f 1 -d " " >> /target/etc/modules /bin/echo /bin/true >/proc/sys/kernel/modprobe if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/cat /target/etc/modules /sbin/lsmod /bin/echo "--- end debug info ---" read dummy fi # --- "Configure the Network" menu # replaces netconfig.c configure_network() # set network for system given up at top of script /bin/echo "--------------------------------------------------------" /bin/echo "*** Configure the Network *** for our network config ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # - subpart netconfig.c write_common_network() /bin/echo "* writing common net config files to disk ..." # this first part just sets up an network-less network config (only lo) /bin/mkdir /target/etc/network /bin/echo "${CONF_HOSTNAME}" > /target/etc/hostname /bin/echo "127.0.0.1 ${CONF_HOSTNAME}" > /target/etc/hosts /bin/echo "# /etc/network/interfaces --" \ "configuration file for ifup(8), ifdown(8)" \ > /target/etc/network/interfaces /bin/echo "" >> /target/etc/network/interfaces /bin/echo "# The loopback interface" >> /target/etc/network/interfaces /bin/echo "auto lo" >> /target/etc/network/interfaces /bin/echo "iface lo inet loopback" >> /target/etc/network/interfaces if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/cat /target/etc/hosts /bin/echo "---" /bin/cat /target/etc/network/interfaces if [ -f /target/etc/resolv.conf ] ; then /bin/echo "---" /bin/cat /target/etc/resolv.conf fi /bin/echo "--- end debug info ---" read dummy fi if [ x${CONF_DHCP} = xyes ] ; then # - subpart netconfig.c configure_network() /bin/echo "* getting network configuraton by DHCP ..." if [ -x /sbin/dhclient-2.2.x ] ; then /bin/echo "interface \"${CONF_IF}\" {" > /etc/dhclient.conf /bin/echo " send host-name \"${CONF_HOSTNAME}\";" >> /etc/dhclient.conf /bin/echo " }" >> /etc/dhclient.conf /sbin/dhclient-2.2.x -e -lf /tmp/dhcp.leases ${CONF_IF} else # Debian has this in their code, despite program not included :-) /sbin/pump -i ${CONF_IF} -h ${CONF_HOSTNAME} fi # - subpart netconfig.c write_dhcp_network() /bin/echo "* writing dynamic net config files to disk ..." # this adds config for ${CONF_IF}, using DHCP cp /etc/resolv.conf /target/etc/resolv.conf /bin/echo "# The first network card -" \ "this entry was created during the Debian/dphys2 installation" \ >> /target/etc/network/interfaces /bin/echo "auto ${CONF_IF}" >> /target/etc/network/interfaces /bin/echo "iface ${CONF_IF} inet dhcp" >> /target/etc/network/interfaces else # - subpart netconfig.c configure_static_network() and write_static_network() /bin/echo "* writing static net config files to disk ..." # this adds config for ${CONF_IF}, using static data /bin/echo "127.0.0.1 localhost" \ > /target/etc/hosts /bin/echo "${CONF_IPADDR} ${CONF_HOSTNAME}.${CONF_DOMAIN}" \ >> /target/etc/hosts /bin/echo "localnet ${CONF_NETWORK}" > /target/etc/networks /bin/echo "search ${CONF_DOMAIN}" > /target/etc/resolv.conf /bin/echo "nameserver ${CONF_NAMESERVER1}" >> /target/etc/resolv.conf if [ x${CONF_NAMESERVER2} != x ] ; then /bin/echo "nameserver ${CONF_NAMESERVER2}" >> /target/etc/resolv.conf fi if [ x${CONF_NAMESERVER3} != x ] ; then /bin/echo "nameserver ${CONF_NAMESERVER3}" >> /target/etc/resolv.conf fi if [ x${CONF_NAMESERVER4} != x ] ; then /bin/echo "nameserver ${CONF_NAMESERVER4}" >> /target/etc/resolv.conf fi /bin/echo "# The first network card -" \ "this entry was created during the Debian/dphys2 installation" \ >> /target/etc/network/interfaces /bin/echo "# (network, broadcast and gateway are optional)" >> /target/etc/network/interfaces /bin/echo "auto ${CONF_IF}" >> /target/etc/network/interfaces /bin/echo "iface ${CONF_IF} inet static" >> /target/etc/network/interfaces /bin/echo -e "\taddress ${CONF_IPADDR}" >> /target/etc/network/interfaces /bin/echo -e "\tnetmask ${CONF_NETMASK}" >> /target/etc/network/interfaces /bin/echo -e "\tnetwork ${CONF_NETWORK}" >> /target/etc/network/interfaces /bin/echo -e "\tbroadcast ${CONF_BROADCAST}" \ >> /target/etc/network/interfaces /bin/echo -e "\tgateway ${CONF_GATEWAY}" >> /target/etc/network/interfaces fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/cat /target/etc/hosts /bin/echo "---" /bin/cat /target/etc/network/interfaces if [ -f /target/etc/resolv.conf ] ; then /bin/echo "---" /bin/cat /target/etc/resolv.conf fi /bin/echo "--- end debug info ---" read dummy fi # - subpart netconfig.c activate_static_network() /bin/echo "* activating net config ..." /bin/rm /etc/resolv.conf /bin/ln -s /target/etc/resolv.conf /etc/resolv.conf /sbin/ifconfig lo 127.0.0.1 if [ x${CONF_DHCP} != xyes ] ; then # in case fo DHCP ${CONF_IF} already got configured above /sbin/ifconfig ${CONF_IF} down /sbin/ifconfig ${CONF_IF} ${CONF_IPADDR} netmask ${CONF_NETMASK} \ broadcast ${CONF_BROADCAST} /sbin/route add default gw ${CONF_GATEWAY} metric 1 fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /sbin/ifconfig /bin/echo "--- end debug info ---" read dummy fi # --- second "Install Kernel and Driver Modules menu", now that net is running # this is not part of the normal Debian installation prosess /bin/echo "-----------------------------------------------------------" /bin/echo "*** Install Kernel and Driver Modules menu *** from net ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # - subpart extract_kernel.c install_floppy() # moved here from above, now that we have network, no rescue floppy needed # install kernel, requires network /bin/echo "* installing kernel from rescue floppy image from net ..." # "insert" rescue floppy image from network if [ x${CONF_KERNEL_24} = xyes ] ; then # change path to files for 2.4 kernel SYS_DEBRESCUE=${SYS_DEBRESCUE_24} fi /usr/bin/wget -P /target \ http://${CONF_DEBSERVER}/${CONF_DEBDIR}/${SYS_DEBRESCUE} # -t auto gives warnings, -t msdos avoids them, but hangs with bf2.4 kernel /bin/mount -r -t auto -o loop /target/rescue.bin /floppy # allow retries if it fails (say due to an wrong disk) while [ ! -f /floppy/type.txt ] ; do /bin/echo dbootstrap Error: no rescue floppy in /dev/fd0, insert proper # give User chance for corrective action, possibly using 2nd console read dummy done cd /floppy ./install.sh /target cd / /bin/umount /floppy # "eject" rescue floppy image from network rm /target/rescue.bin if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/ls -al /target /target/boot /bin/echo "--- end debug info ---" read dummy fi # - subpart extract_kernel.c install_floppies() # install drivers, now full set, now we have network, no drivers floppies /bin/echo "* installing drivers from drivers.tgz from net ..." # these directories still exit from first driver install #/bin/mkdir /target/tmp; chown 0.3 /target/tmp; chmod 01777 /target/tmp #/bin/mkdir /target/tmp/drivers; chown 0.3 /target/tmp/drivers; # here Debian fetches the 4 drivers disks to /target/drivers.tgz # we fetch the full drivers.tgz file from the net if [ x${CONF_KERNEL_24} = xyes ] ; then # change path to files for 2.4 kernel SYS_DEBDRIVERS=${SYS_DEBDRIVERS_24} fi /usr/bin/wget -P /target \ http://${CONF_DEBSERVER}/${CONF_DEBDIR}/${SYS_DEBDRIVERS} cd /target/tmp/drivers /bin/zcat /target/drivers.tgz | tar -x ./install.sh /target cd / /bin/rm /target/drivers.tgz if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/ls -al /target/lib/modules/* /bin/echo "--- end debug info ---" read dummy fi # - back from choose_and_install() do frob_lib_modules() # symlink is already set from first driver install #/bin/rm -rf /lib/modules.old #/bin/mv /lib/modules /lib/modules.old #/bin/ln -s /target/lib/modules /lib/modules # - back from frob_lib_modules() /sbin/depmod -a if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/ls -ald /lib/modules* /bin/echo "--- end debug info ---" read dummy fi # --- "Install the Base System" menu # replaces main_menu.c main_menu_extract_base() and debootstrap_extract_base() # install base.tgz, fetching it from now running network, no floppies /bin/echo "------------------------------------------------" /bin/echo "*** Install the Base System *** from network ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # thankfully Debian put all this stuff into an separate program # so we can just run it unchanged /bin/echo "* running debootstrap to install base.tzg ..." # test whether download works omitted: #/usr/bin/wget -q $SOURCE/dists/woody/Release # we get it via standard http, so no need to set up NFS to get it /usr/sbin/debootstrap --arch ${SYS_ARCH} woody /target \ http://${CONF_DEBSERVER}/${CONF_DEBDIR}/ /bin/echo "DEBIAN_MIRROR_HOSTNAME='${CONF_DEBSERVER}'" \ >> /target/root/dbootstrap_settings /bin/echo "DEBIAN_MIRROR_METHOD='http'" >> /target/root/dbootstrap_settings /bin/echo "DEBIAN_MIRROR_PATH='${CONF_DEBDIR}'" \ >> /target/root/dbootstrap_settings /bin/echo "DEBIAN_MIRROR_PORT='80'" >> /target/root/dbootstrap_settings /bin/echo "SUITE='testing'" >> /target/root/dbootstrap_settings /bin/mv /target/etc/inittab /target/etc/inittab.real /bin/cp /etc/inittab.install /target/etc/inittab if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/cat /target/root/dbootstrap_settings /bin/echo "--- end debug info ---" read dummy fi # - subpart baseconfig.c write_fstab() # surprising that they do this so late /bin/echo "* generating fstab ..." /bin/echo "# /etc/fstab: static file system information." > /target/etc/fstab /bin/echo "#" >> /target/etc/fstab /bin/echo -e \ "# \t\t\t\t\t\t\t" \ >> /target/etc/fstab # root /bin/echo -e "${PART_ROOT}\t/\t\text2\tdefaults,errors=remount-ro\t0\t1" \ >> /target/etc/fstab # swap /bin/echo -e "${PART_SWAP}\tnone\t\tswap\tsw\t\t\t0\t0" >> /target/etc/fstab # proc /bin/echo -e "proc\t\t/proc\t\tproc\tdefaults\t\t\t0\t0" >> /target/etc/fstab # floppy and cdrom /bin/echo -e "/dev/fd0\t/floppy\t\tauto\tdefaults,user,noauto\t\t0\t0\n" \ >> /target/etc/fstab /bin/echo -e \ "/dev/cdrom\t/cdrom\t\tiso9660\tdefaults,ro,user,noauto\t\t0\t0\n" \ >> /target/etc/fstab # others, for us just /boot /bin/echo -e "${PART_BOOT}\t/boot\t\text2\tdefaults\t0\t2" >> /target/etc/fstab if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/cat /target/etc/fstab /bin/echo "--- end debug info ---" read dummy fi # - subpart baseconfig.c configure_base() # this is actually outdated code, but do it for safety /bin/echo "* tidying up unconfigured.sh ..." /bin/rm -f /target/sbin/unconfigured.sh if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/ls -al /target /bin/echo "--- end debug info ---" read dummy fi # --- "Make System Bootable" menu # replaces bootconfig.c make_bootable() and run_lilo() # setup LILO to boot system /bin/echo "---------------------------------------------------------------" /bin/echo "*** Make System Bootable *** with LILO, mbr, boot partition ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # we are putting LILO in the MBR (unclean), because bug using mbr and in ROOT # the boot code does not get written (or written and then overwriten?) # and this is a single-OS system anyway, and its better for security anyway # lilo.conf is 1/4 size of this script, so don't generate it, use template file # replace template %PLACEHOLDER% place holders with entire actual lines if [ x${CONF_PASSWORD_LILO} != x ] ; then /bin/sed -e "s@%PART_BOOT%@boot=${CONF_DISK}@" \ -e "s@%PART_ROOT%@root=${PART_ROOT}@" \ -e "s@%PASSWORD%@password=${CONF_PASSWORD_LILO}@" \ -e "s@%RESTRICTED%@restricted@" \ ${SYS_LILO_CONF} > /target/etc/lilo.conf else # user did not want an LILO password /bin/sed -e "s@%PART_BOOT%@boot=${CONF_DISK}@" \ -e "s@%PART_ROOT%@root=${PART_ROOT}@" \ -e "s@%PASSWORD%@# no password installed@" \ -e "s@%RESTRICTED%@# restricted if password were set@" \ ${SYS_LILO_CONF} > /target/etc/lilo.conf fi # *** WARNING *** # this file must be chmod 600 because of LILO password in it /bin/chmod 600 /target/etc/lilo.conf /usr/sbin/chroot /target /sbin/lilo # activate boot partition export LD_LIBRARY_PATH=\"/target/lib:/target/usr/lib\"; \ /target/sbin/activate ${CONF_DISK} ${PART_BOOT_NO} if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /sbin/fdisk -l ${CONF_DISK} /bin/echo "--- end debug info ---" read dummy fi # --- fix up installed system so that 2nd boot stage has no dialogs # this is not part of the normal Debian installation process # fix up debconf database to prevent base-config dialogs /bin/echo "---------------------------------------------------------" /bin/echo "*** fixing up debconf *** for no dialogs after reboot ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # debconf-preload is 1/2 size of this script, don't generate, use template file # replace template %PLACEHOLDER% place holders with actual content (no lines) /bin/sed -e "s@%SYS_DEBCONF_DB%@${SYS_DEBCONF_DB}@" \ -e "s@%CONF_TIMEZOME_AREA%@${CONF_TIMEZOME_AREA}@" \ -e "s@%CONF_TIMEZOME_PLACE%@${CONF_TIMEZOME_PLACE}@" \ -e "s@%CONF_PASSWORD_MD5%@${CONF_PASSWORD_MD5}@" \ -e "s@%CONF_PASSWORD_SHADOW%@${CONF_PASSWORD_SHADOW}@" \ -e "s@%CONF_PASSWORD_ROOT%@${CONF_PASSWORD_ROOT}@" \ -e "s@%CONF_PCMCIA_REMOVE%@${CONF_PCMCIA_REMOVE}@" \ -e "s@%CONF_DEBSERVER%@${CONF_DEBSERVER}@" \ -e "s@%CONF_DEBDIR%@${CONF_DEBDIR}@" \ -e "s@%CONF_PCMCIA_REMOVE%@${CONF_PCMCIA_REMOVE}@" \ -e "s@%CONF_USE_CONTRIB%@${CONF_USE_CONTRIB}@" \ -e "s@%CONF_USE_NON_FREE%@${CONF_USE_NON_FREE}@" \ -e "s@%CONF_USE_PROPOSED%@${CONF_USE_PROPOSED}@" \ -e "s@%CONF_DEBSERVER_NON_US%@${CONF_DEBSERVER_NON_US}@" \ -e "s@%CONF_DEBDIR_NON_US%@${CONF_DEBDIR_NON_US}@" \ -e "s@%SYS_DEBSUBDIR_NON_US%@${SYS_DEBSUBDIR_NON_US}@" \ -e "s@%CONF_DEBSERVER_SECURITY%@${CONF_DEBSERVER_SECURITY}@" \ -e "s@%CONF_DEBDIR_SECURITY%@${CONF_DEBDIR_SECURITY}@" \ -e "s@%SYS_DEBSUBDIR_SECURITY%@${SYS_DEBSUBDIR_SECURITY}@" \ -e "s@%CONF_DEBSERVER_LOCAL%@${CONF_DEBSERVER_LOCAL}@" \ -e "s@%CONF_DEBDIR_LOCAL%@${CONF_DEBDIR_LOCAL}@" \ -e "s@%SYS_DEBSUBDIR_LOCAL%@${SYS_DEBSUBDIR_LOCAL}@" \ ${SYS_PRELOAD_ON_FLOPPY} > /target/${SYS_PRELOAD_ON_TARGET} # *** WARNING *** # this file must be chmod 700 because of root password in it /bin/chmod 700 /target/${SYS_PRELOAD_ON_TARGET} /usr/sbin/chroot /target ${SYS_PRELOAD_ON_TARGET} if [ x${DEBUG_WAIT_DEL_PRELOAD} = xyes ] ; then /bin/echo "--- DEBUG: wait delete /target/${SYS_PRELOAD_ON_TARGET} ---" read dummy fi /bin/rm /target/${SYS_PRELOAD_ON_TARGET} if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/ls -al /target/var/cache/debconf /bin/echo "--- end debug info ---" read dummy fi # --- run user script at end of first install stage, for further automation # this is not part of the normal Debian installation prosess # give user chance to do further site specific automation if [ -f ${SYS_ENDFIRSTRUN_ON_FLOPPY} ] ; then /bin/echo "--------------------------------------------------" /bin/echo "*** Run user script *** for further automation ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi /bin/cp -p ${SYS_ENDFIRSTRUN_ON_FLOPPY} /target/${SYS_ENDFIRSTRUN_ON_TARGET} /bin/chmod a+x /target/${SYS_ENDFIRSTRUN_ON_TARGET} # so that ${SYS_ENDFIRSTRUN_ON_TARGET} can also be configured from same file /bin/cp -p /etc/setup-dphys2 /target/etc /usr/sbin/chroot /target ${SYS_ENDFIRSTRUN_ON_TARGET} if [ x${DEBUG_WAIT_DEL_EFR_SCRIPT} = xyes ] ; then /bin/echo "--- DEBUG: wait delete /target/${SYS_ENDFIRSTRUN_ON_TARGET} ---" read dummy fi /bin/rm /target/${SYS_ENDFIRSTRUN_ON_TARGET} /bin/rm /target/etc/setup-dphys2 # no debug output here, should be done in ${SYS_ENDFIRSTRUN_ON_TARGET} fi # --- "Reboot the System" menu # replaces reboot_system.c reboot_system() # reboot into 2nd stage of install /bin/echo "----------------------------------------------" /bin/echo "*** Reboot the System *** for second stage ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi /bin/sync /bin/umount /instmnt /bin/cp /var/log/messages /target/var/log/installer.log if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/df /usr/bin/free /bin/echo "--- end debug info ---" read dummy fi if [ x${DEBUG_WAIT_ENDFIRST} = xyes ] ; then /bin/echo "--- DEBUG: wait reboot ---" read dummy fi /sbin/reboot