#!/bin/sh # http://www.phys.ethz.ch/~franklin/Projects/dphys2/endfirstrun.simple # - script to be run at end of /sbin/dbootstrap for further automation # installs additional base-config script to install some stuff I use # copyright ETH Zuerich Physics Departement, # use under either BSD or GPL license # author Neil Franklin, last modification 2004.10.14 # 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 # where we will place our merged config file SYS_DPHYS2CONF_ON_TARGET=/dphys2 ### ------ actual implementation from here on # no user settings any more below this point # --- config file stuff # what we are NAME=endfristrun PNAME=dphys2 # check user config file(s), let user override settings # same config files used in dphys2[rescue|root|cd|pxe] and dbootstrap # but all merged into one file for inclusion on floppy by dphys2root if [ -f ${SYS_DPHYS2CONF_ON_TARGET} ] ; then . ${SYS_DPHYS2CONF_ON_TARGET} fi # --- 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 "*** Rest of System Setup 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_SYSTEMSETUP=/usr/lib/base-config/99systemsetup /bin/cat << END-SYSTEM-SETUP-SCRIPT > ${SCRIPT_SYSTEMSETUP} #!/bin/sh -e # setup rest of my test system # get rest of packages I want, even for an install test server /usr/bin/nice /usr/bin/yes '' | /usr/bin/apt-get install tcsh /usr/bin/nice /usr/bin/yes '' | /usr/bin/apt-get install less /usr/bin/nice /usr/bin/yes '' | /usr/bin/apt-get install ssh # for test system minimal user comfort setup /bin/cat << END-CSHRC > /root/.cshrc # .cshrc - set up C shell # author Neil Franklin, last modification 2004.01.04 # reduced version for test hosts 2004.08.05 # turn on filename completion, history set filec set history = 100 # prevent loose files umask 022 if ( \\\$user == "root") then set path = (/sbin /usr/sbin /usr/local/sbin \\\$path) endif # more and less setenv LESS "-cfiMq" setenv LESSCHARSET latin1 setenv PAGER /usr/bin/less setenv EDITOR /usr/bin/vi # get my own programs set path = (~/bin \\\$path) # prompt how I like it set prompt='%n@%m %~%# ' if (\\\$?term == 1) then if ( \\\$term == "linux" || \\\$term == "vt100" ) then # console some configurations fail to work with \033 for some odd reason set prompt="%B\\\$prompt%b" endif if ( \\\$term == "xterm" || \\\$term == "iris-ansi" ) then set prompt="%{\033]2;\\\$prompt\007%}%B\\\$prompt%b" endif endif END-CSHRC # add some important scripts # I prefer scripts (cost of one at runtime) over alias (cost of all at login) if [ ! -e /root/bin ] ; then /bin/mkdir /root/bin fi /bin/cat << END-BIN-LA > /root/bin/la #!/bin/sh # ~/bin/la - ls all long exec ls -alF \\\$* END-BIN-LA /bin/chmod 755 /root/bin/la # allow ssh logins without password if [ ! -e /root/.ssh ] ; then /bin/mkdir /root/.ssh /bin/chmod 700 /root/.ssh fi /bin/cat << END-SSH-AUTH-KEY > /root/.ssh/authorized_keys 1024 35 87284004596883244711294572577878691295870121542215195616794331308261777326879452323193798528948434670829119898580668256893668153836470682618291469217706441884331454172106552397405732549599921952126473434558872640359621704806839163346411310207952522962629894560040108406215173211743913961199629550664569669811 root@chonsp ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAnxkN5P5X6vuhyXnTbK8AD6HLAjlL1fuQOG3h+I6RcdoS0vQY1GL0+oFdcivmfSDwKfJCt+uv5rrbFqx797wDyo2O8BbJHCrgh/JWILxPlaAb4TerJQxp0NaDdl9SJVQhOni+EOGmu8m3ALw/l+JNZtKBJocXj3o21Hx7EYjS95M= root@chonsp ssh-dss AAAAB3NzaC1kc3MAAACBAJf6tCeSYavSDm73pADfm3wM28TQlC0LwPo9P9LD7/6D59oTpBDhRABu3oMi6cWCZBCZOgal9oi7+s0R5XMyvT8hG+10eCsr3zI2w5Jf1JtPJSWJhDdLFEPoL1sMZHAAf7oMZYTk4/TE4Pgi/y7eUKwHWXusqqWthYlTk7bSnHdlAAAAFQCvAaYx+q1zSJDvZDuodXt55175cwAAAIBQmaCoFiP6CL7a3pk3fkwlubdAFNqPUaWRATLFt9bQTaLlN16ticHD+gubTIIsyDkOdZ5ckW28iq1tE1Gh9kwoz/2NFATz5WtIfufCZO2pNQoAYW0+45vvgCJpR2uXDGBEYI3a9ntIlvl7cKayA/5fDVt5gIKgSNXcEiu+/YOlbQAAAIA2muypWBf1lSZxhOXDbaBzCleoCXjbd583LcSEuAW+GXb5b1nWiW0tg2FocPa8nutFIbM95r0sNEjbu1i2UOh1zqD0tkJCrTHUNZrO+LtutVYNBz7yxiRszN3voKW6waaR7H39xJ6E2Q5iZWIcY5Z34JkH4ob+8L452AAUqfPoIA== root@chonsp END-SSH-AUTH-KEY /bin/chmod 600 /root/.ssh/authorized_keys if [ x${DEBUG_LEAVE_BC_SCRIPTS} != xyes ] ; then /bin/rm ${SCRIPT_SYSTEMSETUP} fi exit 0 END-SYSTEM-SETUP-SCRIPT /bin/chmod 755 ${SCRIPT_SYSTEMSETUP} if [ x${DEBUG_WAIT_STEP} = xyes ] ; then /bin/echo "--- DEBUG: info ---" /bin/ls -al ${SCRIPT_SYSTEMSETUP} /bin/echo "--- end info ---" fi if [ x${DEBUG_WAIT_STEP} = xyes ] ; then read -p "--- DEBUG: wait after step ---" dummy fi