#!/bin/sh # http://www.phys.ethz.ch/~franklin/Projects/dphys2/endfirstrun.dphys-admin # - script to be run at end of /sbin/dbootstrap for further automation # installs additional base-config script to install dphys-admin # uses http://www.phys.ethz.ch/~franklin/Projects/dphys-admin/ # copyright ETH Zuerich Physics Departement, # use under either BSD or GPL license # author Neil Franklin, last modification 2005.03.31 # 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 ### ------ 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 hostname input line options # --- CONF_* various site or subnet dependant user config variables # none of these currently # --- DEBUG_*, various debugging settings # these can be set to "yes" by -D option, followed by name without DEBUG_ # as this is called by dbootstrap, do this on thats hostname input line # such as like this: -D PRINT_STEP -D WAIT_FIRST_REBOOT # 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 output debug state info and wait after each step #DEBUG_WAIT_STEP=yes # set this so that our generated base-config scripts stay, instead of deleting #DEBUG_LEAVE_BC_SCRIPTS=yes # --- SYS_*, various system internal values # none of these currently ### ------ actual implementation from here on # no user settings any more below this point # --- insert script to load our site package # do an apt-get install of site package at the end # this allows us to do anything, including rebooting, without conflicts /bin/echo "---------------------------------------------------------------" /bin/echo "*** Apt-get Install Site Package Script *** for autoinstall ..." if [ x${DEBUG_SLEEP} != x ] ; then /bin/sleep ${DEBUG_SLEEP} fi # this script will run as part of second stage of install, from base-config # 99sitepackage after all other stuff has been done, as if user had logged in SCRIPT_SITEPACKAGE=/usr/lib/base-config/99sitepackage /bin/cat << END-SITE-PACKAGE-SCRIPT > ${SCRIPT_SITEPACKAGE} #!/bin/sh -e # install dphys-admin package manager to get rest of packages and configs # uses http://www.phys.ethz.ch/~franklin/Projects/dphys-admin/ # install identd, else no access to non-free site packages and config files /usr/bin/nice /usr/bin/yes '' | /usr/bin/apt-get install oidentd # now we can add our local packages server to apt sources list echo deb http://debian.ethz.ch/pub/debian-local woody/local \ main contrib non-free >> /etc/apt/sources.list echo deb-src http://debian.ethz.ch/pub/debian-local woody/local \ main contrib non-free >> /etc/apt/sources.list # now we can access extra package lists let apt update package database /usr/bin/nice /usr/bin/yes '' | /usr/bin/apt-get update # and have dpkg also update its package database /usr/bin/apt-cache dumpavail > /var/cache/apt/available /usr/bin/dpkg --update-avail /var/cache/apt/available /bin/rm -f /var/cache/apt/available # and trigger installing of all our site dependant stuff # we name all our self made packages dphys-*, # you are advised to use -* # site specific setup stuff is called dphys-local-* # see "makesourcepackage" for generating/modifying such packages # dphys-local-admin package is expected to: # a) set up base url for dphys-admin to read packages list from # b) set up base url for dphys-local-* to read config files from # 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 # run yes with nice, else it uses up all CPU und apt-get gets really slow /usr/bin/nice /usr/bin/yes '' | /usr/bin/apt-get install dphys-local-admin /usr/bin/nice /usr/bin/yes '' | /usr/bin/apt-get install dphys-admin if [ x${DEBUG_LEAVE_BC_SCRIPTS} != xyes ] ; then /bin/rm ${SCRIPT_SITEPACKAGE} fi # and the last action of the 2nd install phase, pass on to dphys-admin /bin/echo "### activate dphys-admin install/upgrade process, as if booting" /etc/init.d/dphys-admin start exit 0 END-SITE-PACKAGE-SCRIPT /bin/chmod 755 ${SCRIPT_SITEPACKAGE} if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${SCRIPT_SITEPACKAGE} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi