#!/bin/sh # http://www.phys.ethz.ch/~franklin/Projects/dphys2/endfirstrun # - script to be run at end of /sbin/dbootstrap for further automation # copyright ETH Zuerich Physics Deparement, use under either BSD or GPL license # author Neil Franklin, last modification 2003.08.04 # this script is intended to be run as root by dbootstrap chroot-ed to the # target disk, at the end of the first installation stage # this script generates scripts to be run by base-config, that fix up the # installed system, so that it autoinstalls our desired packages and configs # and does so without any questions being asked # --- read in setup, for ${CONF_*}, ${DEBUG_*} and ${SYS_*} . /etc/setup-dphys2 # --- local setup stuff for this script # whether we want to install an identd for local non-free package server access # this is for accessing packages containing stuff not intended for everyone # such package smay contain ssh hostkeys, license keys, or be commercial sw CONF_IDENTD=yes # what the names of our host packages begin with # we name all our local packages dphys-*, so host packages are dphys-host-* # you are advised to use -host-* # dphys-host-`hostname` package is expected to: # a) depend on host specific packages (such as kernel) # b) install host specific config files (such as XF86Config) # c) an dphys-site site package which does the rest of the work # dphys-site package is expected to: # a) depends on packages used on all hosts # b) installs config files used on all hosts # c) depend on dphys-admin package # dphys-admin package is expected to: # a) add daily cron job to apt-get update/upgrade, incl newer dphys-admin # b) add init script for the case cron job is not run due to power off # see "makepackage" for generating/modifying such host and site packages CONF_HOST_TO_PKG_PREFIX=dphys-host- # whether to leave our generated script, or tidy them up #DEBUG_LEAVE_SCRIPTS=yes # where to add the additional base-config scripts SYS_BASECONF_DIR=/usr/lib/base-config # --- fix up debconf for no questions # prevent questions while installing packages from woody-proposed-updates # this is also then active later when installing random stuff /bin/echo "-------------------------------------------" /bin/echo "*** Fix up Debconf *** for no questions ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # 01debconf, so just after 00dbootstrap_settings, after Debian has touched this SCRIPT_DEBCONF=${SYS_BASECONF_DIR}/01debconf /bin/cat << EOF > ${SCRIPT_DEBCONF} #!/bin/sh -e # reconfigure debconf to not ask any questions # debconf access needs this, first action (may restart this script!) . /usr/share/debconf/confmodule # make base-config set up debconf to use defaults, without asking questions # get rid of as many dialogs and questions as possible # *NOTE* that we still need debconf-preload because base-config tricks us db_set debconf/priority critical db_set debconf/frontend noninteractive if [ x${DEBUG_LEAVE_SCRIPTS} != xyes ] ; then rm ${SCRIPT_DEBCONF} fi EOF /bin/chmod 755 ${SCRIPT_DEBCONF} if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/ls -al ${SCRIPT_DEBCONF} /bin/echo "--- end debug info ---" read dummy fi # --- eneble IDE DMA speed up some stupid disk drives # prevent having to sit a long tome while the massive apt-get is running on PIO # dbootstrap has once set this, but only until the second stage reboot # so we here go and ensure that base-config reenables it before large work # for continued operation after next reboot, install dphys-ide-dma package # 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 second stage IDE DMA *** on ${CONF_DISK} ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # 02idedma, so just after 01debconf SCRIPT_IDEDMA=${SYS_BASECONF_DIR}/02idedma DRIVE=`echo ${CONF_DISK} | cut -f 3 -d "/"` /bin/cat << EOF > ${SCRIPT_IDEDMA} #!/bin/sh -e # enable IDE DMA for faster apt-get install # use this to force DMA usage on some stupid hd disk drives echo "using_dma:1" > /proc/ide/${DRIVE}/settings echo "io_32bit:1" > /proc/ide/${DRIVE}/settings if [ x${DEBUG_LEAVE_SCRIPTS} != xyes ] ; then rm ${SCRIPT_IDEDMA} fi EOF /bin/chmod 755 ${SCRIPT_IDEDMA} if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/ls -al ${SCRIPT_IDEDMA} /bin/echo "--- end debug info ---" read dummy fi fi # --- insert script to load our host package for this host # do an apt-get install of host package at the end /bin/echo "--------------------------------------------------------" /bin/echo "*** Apt-get Install Host Package *** for autoinstall ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # 99z20hostpackage so it sorts after 99inittab, 'h'<'i' so use 'z' :-( # so after all Debian stuff done, as if user had logged in and done apt-get # this allows us to do anything, including rebooting, without conflicts SCRIPT_HOSTPACKAGE=${SYS_BASECONF_DIR}/99z20hostpackage /bin/cat << EOF > ${SCRIPT_HOSTPACKAGE} #!/bin/sh -e # install the host package and all its dependencies ### *** really ugly nasty workaround ### this stuff makes massive trouble with apt-get (nondeterministic row) # forget them preinst scripts, they don't time reliable, throw this in here cat << EO2 > /etc/kernel-img.conf # Do not create symbolic links in / do_symlinks = Yes do_initrd = Yes silent_modules = Yes do_bootfloppy = No do_bootloader = Yes EO2 ### *** end really ugly nasty workaround # install identd, else we will not get access to host/site/admin packages if [ x${CONF_IDENTD} = xyes ] ; then nice yes '' | apt-get install oidentd nice yes '' | apt-get update fi # run yes with nice, else it uses up all CPU und apt-get gets really slow nice yes '' | apt-get install ${CONF_HOST_TO_PKG_PREFIX}\`hostname\` # some packages crash out of apt-get install but work when re-run # some being g77 und g77-2.95, if you have such, use this dirty fix instead: #while ! nice yes '' | \ # apt-get install ${CONF_HOST_TO_PKG_PREFIX}\`hostname\`; do :; done # flag file, any script run by apt-get can touch and so demand an reboot # reboot must be done after apt-get, not from postinst else we are screwed REBOOT_FILE=/root/NEED-REBOOT if [ -f \${REBOOT_FILE} ] ; then rm \${REBOOT_FILE} echo "### rebooting due to \${REBOOT_FILE} having being touched" reboot fi if [ x${DEBUG_LEAVE_SCRIPTS} != xyes ] ; then rm ${SCRIPT_HOSTPACKAGE} fi EOF /bin/chmod 755 ${SCRIPT_HOSTPACKAGE} if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- debug info ---" /bin/ls -al ${SCRIPT_HOSTPACKAGE} /bin/echo "--- end debug info ---" read dummy fi