#!/bin/sh # # /etc/ORC/ORCsetPXE # # Set up the right PXE environment for ORC testing # # Copyright (c) 2002 Owl River Company, Columbus OH # by: info@owlriver.com # ORC confidential # # master site: ftp.first.lan/etc/ORC/ also /usr/local/bin # mirror site: ftp.owlriver.com # /pub/local/ORC/k12ltsp/ # VER="0.08-050119" # # usage: /etc/ORC/ORCsetPXE [-v] control-file # # options: -v will be verbose # # 050119 0.08 RPH - track down the noise we were getting on the # pointing to the initrd.img and the vmlinuz and quell it # and also remove -rhl- specific constructs; enhance # bail, sanity checking and warning structures # 050114 0.07 RPH - add a touch of notice into the syslog # 031024 0.06 RPH - automated run logic cleanup -- ok to # delete known link files # 030712 0.05 RPH - ks.cfg setting logic made more error # resistant # 030304 0.04 RPH - add a default ks.cfg if no custom one # exists, catch umount errors # 030220 0.03 RPH - add debugging option stanza # ################################################################ # PXESRC="/var/ftp/pub/install/ftpinstall/images/pxeboot" PXEDEST="/tftpboot/rhl/pxe" KSWEB="/var/www/html/pub/kickstart" # INSTALL="/usr/local/bin/install-from-iso.sh " UPDATEDB="/usr/bin/updatedb " # RCDIR="/etc/ORC" # ############################################################# # Owl River dep-req tracking #myname: /etc/ORC/ORCsetPXE internal #function: Set up the right PXE environment for ORC testing #calls dep-req: /usr/local/bin/install-from-iso.sh GPL ##################################### # MYNAME=`basename $0` VERBOSE="" [ "x$1" = "x-v" ] && { VERBOSE="-v" export VERBOSE shift 1 } # VERBOSE="-v" # ARGONE=`echo "$1"` BAIL="" # in at 0.09 - YDL does not support PXE, so we can occasionally # skip looking for the vmlinuz, etc SETPXE="y" # OK="" for i in 73 80 8094 90 9090 LTSP aurora ; do [ "x$ARGONE" = "x$i" ] && { [ "x$OK" = "x" -a "x$VERBOSE" != "x" ] && \ echo "Found: $ARGONE -- matches $i" OK="y" export OK } done cd $RCDIR for i in ` ls installCDrc-${ARGONE} | awk -F"-" {'print $2'}` ; do [ "x$ARGONE" = "x$i" ] && { [ "x$OK" = "x" -a "x$VERBOSE" != "x" ] && \ echo "Found: $ARGONE -- match $i" OK="y" export OK } done # [ "x$OK" != "x" ] && { # cd $RCDIR [ -e installCDrc-${ARGONE} ] && { # # This code moved to the installer with a better test in # the installer's ver. 0.20; out here at 0.09 # Clean away the old mounts # for i in ` df | grep iso$ ` ; do # umount $i || { # echo "ERROR: cannot umount $i" 1>&2 # exit 1 # } # done # # cd /var/ftp/pub/ # rm -rf install # # --- this ends the section out in 0.09 respecting installer tasks # # tell the installer which ISO's to use cd $RCDIR [ -e installCDrc ] && rm -f installCDrc [ -e installCDrc-$ARGONE ] && { ln -s installCDrc-$ARGONE installCDrc } || { ln -s installCDrc-default installCDrc } $INSTALL $VERBOSE } || { echo "ERROR: cannot find installCDrc-$ARGONE -- bailing" 1>&2 pwd exit 1 } # # Now - 0.09 added test for YDL (non-PXE type) distro # TBD: does Aurora have like code? [ ! -e $PXESRC ] && { export SETPXE="n" } # # unless we are called off, try to set up the PXE [ "x$SETPXE" = "xy" ] && { # # Set the installation PXE environment up cd $PXEDEST/ # ###################################################################### # # Restore the pxe binaries set if missing [ ! -e pxelinux.0 ] && \ cp /usr/lib/syslinux/pxelinux.0 . # # some clients call under differing names for it [ ! -e pxelinux.bin -a -e pxelinux.0 ] && \ ln -s pxelinux.0 pxelinux.bin # ##################################################################### # # Get a good initrd image in place -- varies [ -e initrd.img ] && rm -f initrd.img # # and do some sanity checking [ ! -e $PXESRC/initrd.img ] && { echo "Warning: I do not recognize the initrd.img in $PXESRC " 1>&2 find $PXESRC -type f 1>&2 echo " " 1>&2 } # self-populate when we see a new one [ ! -e initrd.img-$ARGONE -a -e $PXESRC/initrd.img ] && \ cp $PXESRC/initrd.img $PXEDEST/initrd.img-$ARGONE [ "x$OK" = "x" -a "x$VERBOSE" != "x" ] && \ echo "linking initrd.img " [ -e initrd.img ] && rm -f initrd.img [ -e initrd.img-$ARGONE ] && { ln -s initrd.img-$ARGONE initrd.img } || { echo "Error: I do not recognize the initrd in $PXEDEST " 1>&2 find $PXEDEST -type f 1>&2 find $PXESRC -type f 1>&2 NONCE=`echo "$BAIL cannot find initrd; "` export BAIL=`echo "$BAIL"` VERBOSE="-v" export VERBOSE } # ##################################################################### # # remind us where we are cd $PXEDEST/ # Get a good kernel in place -- varies [ -e vmlinuz ] && rm -f vmlinuz # # and do some sanity checking [ ! -e $PXESRC/vmlinuz ] && { echo "Warning: I do not recognize the vmlinuz in $PXESRC " 1>&2 find $PXESRC -type f 1>&2 echo " " 1>&2 } # self-populate when we see a new one [ ! -e vmlinuz-$ARGONE -a -e $PXESRC/vmlinuz ] && \ cp $PXESRC/vmlinuz $PXEDEST/vmlinuz-$ARGONE [ "x$OK" = "x" -a "x$VERBOSE" != "x" ] && \ echo "linking vmlinuz" [ -e vmlinuz ] && rm -f vmlinuz [ -e vmlinuz-$ARGONE ] && { ln -s vmlinuz-$ARGONE vmlinuz } || { echo "Error: I do not recognize the vmlinuz in $PXEDEST " 1>&2 find $PXEDEST -type f 1>&2 find $PXESRC -type f 1>&2 NONCE=`echo "$BAIL cannot find vmlinuz; "` export BAIL=`echo "$BAIL"` VERBOSE="-v" export VERBOSE } # cd $PXEDEST/pxelinux.cfg/ [ "x$VERBOSE" != "x" ] && { ls -al pwd echo "--------------------------------" } [ -e 0A-$ARGONE -o -e 0A-PXETEST ] && { [ -e 0A ] && rm -f 0A [ -e 0A-$ARGONE ] && { ln -s 0A-$ARGONE 0A } || { ln -s 0A-PXETEST 0A echo "Info: could not find 0A-$ARGONE - used default 0A-PXETEST " } } || { # # nothing need be done to use 'default' echo "Info: could not find 0A-$ARGONE - using default" } # # Web server ks.cfg instructions cd $KSWEB [ -e ks.cfg ] && rm -f ks.cfg [ -e ks.cfg-$ARGONE ] && { ln -s ks.cfg-$ARGONE ks.cfg echo "Info: Set to point at: ks.cfg-$ARGONE" } || { [ -e default.cfg ] && { ln -s default.cfg ks.cfg echo "Info: Set to point at: ks.cfg-$ARGONE" } || { ln -s `ls -1 ks* | head -1 ` ks.cfg echo "Info: Set to point at: some random ks.cfg" } } # # end of the big SETPXE conditional } # [ "x$VERBOSE" != "x" ] && \ echo "all done" # leave a note in the logfile echo "$MYNAME done - $* used as args - $BAIL" | logger -p local0.info [ "x$BAIL" != "x" ] && { echo "Error: Bailing - $BAIL " 1>&2 } # } # # NONCE=`basename `df | awk {'print $1'} | grep iso$ | tail -1 `` # echo "I see: $NONCE" # $UPDATEDB & # exit 0 #