Initial checkin of the old files. Still need a manefest and a Makefile
Jason D. Clinton [Mon, 30 Jun 2008 22:53:56 +0000 (17:53 -0500)]
46 files changed:
etc/breakin/burnin/badblocks [new file with mode: 0755]
etc/breakin/burnin/ecc [new file with mode: 0755]
etc/breakin/burnin/hpl [new file with mode: 0755]
etc/breakin/burnin/mcelog [new file with mode: 0755]
etc/breakin/dumplog.sh [new file with mode: 0755]
etc/breakin/hardware.sh [new file with mode: 0755]
etc/breakin/network.sh [new file with mode: 0755]
etc/breakin/startup.sh [new file with mode: 0755]
etc/breakin/stop.sh [new file with mode: 0755]
etc/cloner/detect_cd.sh [new file with mode: 0755]
etc/cloner/get_setup.sh [new file with mode: 0755]
etc/cloner/include.sh [new file with mode: 0755]
etc/cloner/installer.sh [new file with mode: 0755]
etc/cloner/library.sh [new file with mode: 0755]
etc/cloner/prep_disks.sh [new file with mode: 0755]
etc/cloner/remount-fs.sh [new file with mode: 0755]
etc/cloner/startup.sh [new file with mode: 0755]
etc/cloner/switch_cd.sh [new file with mode: 0755]
etc/dropbear/dropbear_dss_host_key [new file with mode: 0644]
etc/dropbear/dropbear_rsa_host_key [new file with mode: 0644]
etc/fstab [new file with mode: 0644]
etc/group [new file with mode: 0644]
etc/hardware.sh [new file with mode: 0755]
etc/hardware_output.sh [new file with mode: 0755]
etc/ifup.udhcp.sh [new file with mode: 0755]
etc/init.d/rcS [new file with mode: 0755]
etc/inittab [new file with mode: 0644]
etc/ld.so.conf [new file with mode: 0644]
etc/library.sh [new file with mode: 0755]
etc/logdev.sh [new file with mode: 0755]
etc/lvm/lvm.conf [new file with mode: 0644]
etc/modules_other.conf [new file with mode: 0644]
etc/mtab [new file with mode: 0644]
etc/nsswitch.conf [new file with mode: 0644]
etc/passwd [new file with mode: 0644]
etc/profile [new file with mode: 0755]
etc/rescue/startup.sh [new file with mode: 0755]
etc/resumescreen [new file with mode: 0755]
etc/screenrc [new file with mode: 0644]
etc/shells [new file with mode: 0644]
etc/startup.sh [new file with mode: 0755]
etc/syscheck/startup.sh [new file with mode: 0755]
etc/udev/rules.d/cd-awesomeness.rules [new file with mode: 0644]
etc/udev/scripts/find_next_cd [new file with mode: 0755]
etc/udev/udev.conf [new file with mode: 0644]
var/run/utmp [new file with mode: 0644]

diff --git a/etc/breakin/burnin/badblocks b/etc/breakin/burnin/badblocks
new file mode 100755 (executable)
index 0000000..e2678ec
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/ash
+
+. /etc/library.sh
+
+# read in our hardware configs
+if [ -e /var/run/breakin.dat ]
+then
+       . /var/run/breakin.dat
+fi
+
+FOUND_ERROR=0
+
+# if we don't have any disks - this should never run again
+if [ "${DISK_QTY}" -le "0" ]
+then
+       echo "MSG: No disk devices found"
+       exit 255
+fi
+
+I=0
+while [ "${I}" -lt "${DISK_QTY}" ];
+do
+       DRIVE_NAME=`eval echo \\\$DISK_${I}_NAME`
+
+       /usr/bin/badblocks -v /dev/${DRIVE_NAME} > /tmp/badblocks.${DRIVE_NAME}.log 2>&1
+       if [ "$?" != 0 ]
+       then
+               echo "Disk drive check failed on device ${DRIVE_NAME}"
+               FOUND_ERROR=1
+       fi
+       I=`expr ${I} + 1`
+done
+
+if [ "${FOUND_ERROR}" = "0" ]
+then
+       echo "MSG: No disk errors found"
+fi
diff --git a/etc/breakin/burnin/ecc b/etc/breakin/burnin/ecc
new file mode 100755 (executable)
index 0000000..e282262
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/ash
+
+. /etc/library.sh
+
+# read in our hardware configs
+if [ -e /var/run/breakin.dat ]
+then
+       . /var/run/breakin.dat
+fi
+
+if [ ! -d /sys/devices/system/edac/mc/mc0 ]
+then
+       echo "MSG: No support for ECC checking on this system"
+       exit 255
+fi
+
+# now we look at each file in mc
+
+
+COUNT=0
+FOUND_ERROR=0
+
+ERROR_STRING=""
+for i in /sys/devices/system/edac/mc/mc?
+do
+    CE_COUNT=`cat ${i}/ce_count`
+    UE_COUNT=`cat ${i}/ue_count`
+    ERR_COUNT=`expr ${CE_COUNT} + ${UE_COUNT}`
+    
+    if [ "${ERR_COUNT}" -gt 0 ]
+    then
+        FOUND_ERROR=1
+        for j in ${i}/csrow?
+        do
+            CE_COUNT=`cat ${j}/ce_count`
+                   UE_COUNT=`cat ${j}/ue_count`
+            ERR_COUNT=`expr ${CE_COUNT} + ${UE_COUNT}`
+                   MC=`basename ${i}`
+                   CSROW=`basename ${j}`
+            ERROR_STRING="${MC}:${CSROW} error counter at ${ERR_COUNT}"
+            echo ${ERROR_STRING}
+        done
+    fi
+done
+
+sleep 10
+
+if [ "${FOUND_ERROR}"  = "0" ]
+then
+       echo "MSG: No ECC errors found"
+fi
+exit ${FOUND_ERROR}
diff --git a/etc/breakin/burnin/hpl b/etc/breakin/burnin/hpl
new file mode 100755 (executable)
index 0000000..9ad76cf
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/ash
+
+. /etc/library.sh
+
+MATHLIB="atlas"
+
+# read in our hardware configs
+if [ -e /var/run/breakin.dat ]
+then
+       . /var/run/breakin.dat
+fi
+
+BINARY="xhpl.amd.${MATHLIB}"
+RUNNING_JOB=""
+
+# the top template
+cat /usr/breakin/hpl/HPL-top.txt > /usr/local/breakin/hpl/HPL.dat
+
+# we first figure out our N based on the ammount of RAM we have
+N_SIZE=`/usr/breakin/hpl/hpl_calc_n.${MATHLIB} ${MEM_TOTAL}`
+
+echo "${N_SIZE}         Ns" >> /usr/breakin/hpl/HPL.dat
+
+cat /usr/breakin/hpl/HPL-middle.txt >> /usr/local/breakin/hpl/HPL.dat
+
+if [ "${CPU_QTY}" = "1" ]
+then
+       echo "1     Ps" >> /usr/breakin/hpl/HPL.dat     
+       echo "1     Qs" >> /usr/breakin/hpl/HPL.dat     
+
+elif [ "${CPU_QTY}" = "2" ]
+then
+
+       echo "2     Ps" >> /usr/breakin/hpl/HPL.dat     
+       echo "1     Qs" >> /usr/breakin/hpl/HPL.dat     
+
+elif [ "${CPU_QTY}" = "4" ]
+then
+
+       echo "2     Ps" >> /usr/breakin/hpl/HPL.dat     
+       echo "2     Qs" >> /usr/breakin/hpl/HPL.dat     
+
+elif [ "${CPU_QTY}" = "8" ]
+then
+
+       echo "4     Ps" >> /usr/breakin/hpl/HPL.dat     
+       echo "2     Qs" >> /usr/breakin/hpl/HPL.dat     
+
+elif [ "${CPU_QTY}" = "16" ]
+then
+
+       echo "4     Ps" >> /usr/breakin/hpl/HPL.dat     
+       echo "4     Qs" >> /usr/breakin/hpl/HPL.dat     
+elif [ "${CPU_QTY}" = "32" ]
+then
+
+       echo "8     Ps" >> /usr/breakin/hpl/HPL.dat     
+       echo "4     Qs" >> /usr/breakin/hpl/HPL.dat     
+fi
+cat /usr/breakin/hpl/HPL-bottom.txt >> /usr/local/breakin/hpl/HPL.dat
+
+echo "${CPU_MODEL}" | grep "Intel" > /dev/null 2>&1
+if [ "$?" = "0" ]
+then
+       BINARY="xhpl.intel.${MATHLIB}"
+fi
+
+
+OMP_NUM_THREADS=1
+GOTO_NUM_THREADS=1
+export OMP_NUM_THREADS GOTO_NUM_THREADS
+
+#export LD_LIBRARY_PATH=/opt/hpl/libs
+cd /usr/breakin/hpl
+/usr/breakin/mpi/bin/mpirun -np ${CPU_QTY} ${BINARY} > /tmp/hpl.log 2>&1
+
+if [ "$?" -ne 0 ]
+then
+       cat /tmp/hpl.log > /errors/hpl.log
+       echo "test failed possible memory or cpu errors" 
+       exit 1
+else
+       GFLOPS=`grep ^WR /tmp/hpl.log | tail -1 | awk '{print $7}'`
+       echo "MSG: Passed (${GFLOPS} GFLOPS)" 
+       exit 0
+fi
+done
diff --git a/etc/breakin/burnin/mcelog b/etc/breakin/burnin/mcelog
new file mode 100755 (executable)
index 0000000..669cd32
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/ash
+# read /dev/mcelog every 5 seconds because that's the kernel interval
+
+. /etc/library.sh
+
+FOUND_ERROR=0
+
+OUTPUT=`/usr/bin/mcelog --dmi`
+RETVAL=$?
+if [ $RETVAL = 1 ]
+then
+
+       msg "mcelog couldn't access mce, mem, or dmi data"
+       exit 255
+
+elif [ $RETVAL = 0 ]
+then
+       if [ -n "${OUTPUT}" ]
+       then
+               FOUND_ERROR=1
+               echo "${OUTPUT}"
+       fi
+
+fi
+sleep 5
+exit $FOUND_ERROR 
diff --git a/etc/breakin/dumplog.sh b/etc/breakin/dumplog.sh
new file mode 100755 (executable)
index 0000000..f40cb61
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/ash
+
+trymount() {
+       DEV_NAME=$1
+       #source /tmp/vol_id.tmp # might use these variables some day
+       mount /dev/${DEV_NAME} /var/snapshot
+       if [ $? != 0 ]
+       then
+               echo "Mount error for found USB device."
+               return 1
+       fi
+       echo "USB snapshot device found at ${DEV_NAME}."
+       
+       echo "==== INFO ===" > /var/snapshot/breakin.dmp
+       echo "Breakin version: 2.2" >> /var/snapshot/breakin.dmp
+       uname -a >> /var/snapshot/breakin.dmp
+       echo "==== breakin.dat ====" >> /var/snapshot/breakin.dmp
+       cat /var/run/breakin.dat >> /var/snapshot/breakin.dmp
+       echo "==== breakin.log ====" >> /var/snapshot/breakin.dmp
+       cat /var/logdev/breakin.log >> /var/snapshot/breakin.dmp
+       echo "==== syslog ====" >> /var/snapshot/breakin.dmp
+       cat /var/log/messages >> /var/snapshot/breakin.dmp
+       echo "==== cmdline ====" >> /var/snapshot/breakin.dmp
+       cat /proc/cmdline >> /var/snapshot/breakin.dmp
+       echo "==== cpuinfo ====" >> /var/snapshot/breakin.dmp
+       cat /proc/cpuinfo >> /var/snapshot/breakin.dmp
+       echo "==== partitions ====" >> /var/snapshot/breakin.dmp
+       cat /proc/partitions >> /var/snapshot/breakin.dmp
+       echo "==== PCI ====" >> /var/snapshot/breakin.dmp
+       lspci -vv >> /var/snapshot/breakin.dmp
+       echo "==== dmi ====" >> /var/snapshot/breakin.dmp
+       /usr/bin/dmidecode >> /var/snapshot/breakin.dmp
+
+       sync
+
+       umount /var/snapshot
+
+       echo "Data written to 'breakin.dmp', safe to remove USB device."
+       exit 0
+}
+
+for i in `ls -1d /sys/block/sd[a-z] /sys/block/hd[a-z] 2>/dev/null`
+do
+       REMOVABLE=$(< ${i}/removable)
+       if [ "${REMOVABLE}" != 1 ]
+       then
+               ls -l ${i}/device | grep usb > /dev/null
+               if [ $? != 0 ]
+               then
+                       continue # skip non-removable, non-usb devices
+               fi
+       fi
+       DEV_NAME=`basename ${i}`
+       vol_id -x /dev/${DEV_NAME} > /tmp/vol_id.tmp
+       if [ $? != 0 ] # no file system found
+       then
+               for j in `ls -1d ${i}/?d?[0-9] 2>/dev/null`
+               do
+                       DEV_NAME=`basename ${j}`
+                       vol_id -x /dev/${DEV_NAME} > /tmp/vol_id.tmp
+                       if [ $? = 0 ]
+                       then
+                               trymount $DEV_NAME
+                       fi
+               done
+       else # found file system
+               trymount $DEV_NAME
+       fi
+done
+
+echo "No USB device found."
+exit 1
+
diff --git a/etc/breakin/hardware.sh b/etc/breakin/hardware.sh
new file mode 100755 (executable)
index 0000000..4670ed9
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/ash
+
+
+# this has been removed and added to startup instead of inside of breakin
+
+exit
diff --git a/etc/breakin/network.sh b/etc/breakin/network.sh
new file mode 100755 (executable)
index 0000000..49daa82
--- /dev/null
@@ -0,0 +1,124 @@
+#!/bin/ash
+
+. /etc/library.sh
+
+NET_MODULE_PATH="/lib/modules/`uname -r`/kernel/drivers/net"
+
+dhcp_on_interface() {
+       INTERFACE=${1}
+
+
+       # this is a stop gap for my laptop
+       if [ "${INTERFACE}" = "ath0" ]
+       then
+               return 1
+       fi
+
+       msg -n "Trying DHCP on ${i} interface"
+
+       /sbin/udhcpc -i ${INTERFACE} -n -s /etc/ifup.udhcp.sh \
+               -p /tmp/dhcp.${INTERFACE}.pid >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+       if [ "$?" = 0 ]
+       then
+               . /tmp/network.dhcp
+               ok_msg
+               return 0
+       else
+               fail_msg
+               return 1
+       fi
+}
+
+header "Loading network card modules"
+
+for i in `find ${NET_MODULE_PATH} -name \*.ko`
+do
+       load_module "${i}"
+done
+
+header "Finding ethernet devices"
+
+NET_DEVICES=`/sbin/ifconfig -a | grep "^[a-z]" | cut -d" " -f1`
+NET_DEVICE_COUNT=0
+NET_DEVICE=""
+
+for i in ${NET_DEVICES}
+do
+
+       # we want to skip the loopback interfaces since they don't really count
+       if [ "${i}" = "lo" ]
+       then
+               continue
+       fi
+
+       NET_DEVICE_COUNT=`expr ${NET_DEVICE_COUNT} + 1`
+
+       msg -n "Checking link status for ${i}"
+       /bin/mii-diag -s ${i} >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+       if [ "$?" != "0" ];
+       then
+               fail_msg
+       else
+               ok_msg
+               dhcp_on_interface ${i}
+               if [ "$?" = "0" ]
+               then
+                       NET_DEVICE="${i}"
+               fi
+       fi
+done
+
+if [ "${NET_DEVICE_COUNT}" = "0" ];
+then
+       fatal_error "No network devices found on your system"
+fi
+
+if [ "${NET_DEVICE}" = "" ];
+then
+       msg ""
+       msg "Unable to find interface with link, manually trying each interface"
+       for i in ${NET_DEVICES}
+       do
+               if [ "${i}" = "lo" ]
+               then
+                       continue
+               fi
+
+               dhcp_on_interface ${i}
+               if [ "$?" = "0" ]
+               then
+                       NET_DEVICE="${i}"
+                       break
+               fi
+       done
+fi
+
+if [ "${NET_DEVICE}" = "" ];
+then
+       fatal_error "DHCP server did not respond on any network interface"
+fi
+
+msg -n "Setting hostname to be HW address  "
+HOST=`echo ${NET_MACADDR} | sed 's/://g'`
+msg -n " ${NET_MACADDR}"
+hostname ${HOST} >> /tmp/stdout.log 2> /tmp/stderr.log
+if [ "$?" = 0 ]
+then
+       ok_msg
+else
+       fail_msg
+fi
+
+header "Network Settings"
+
+msg "Network interface:  ${NET_INTERFACE}"
+msg "       IP address:  ${NET_IPADDR}"
+msg "      Subnet mask:  ${NET_SUBNET}"
+msg "          Gateway:  ${NET_ROUTER}"
+msg " Hardware address:  ${NET_MACADDR}"
+
+breakin_start
+
+exit 0
diff --git a/etc/breakin/startup.sh b/etc/breakin/startup.sh
new file mode 100755 (executable)
index 0000000..0aafdda
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/ash
+
+ARGS=""
+
+if [ "${_update_interval}" != "" ]
+then
+       ARGS="${ARGS} --update_interval ${_update_interval}"
+fi
+
+if [ "${_update_url}" != "" ]
+then
+       ARGS="${ARGS} --update_url ${_update_url}"
+fi
+
+if [ "${_sshpasswd}" != "" ]
+then
+       ARGS="${ARGS} --ssh"
+fi
+
+if [ "${_console}" != "" ]
+then
+        PORT=`echo ${CONSOLE} | cut -d"," -f1`
+        BAUD=`echo ${CONSOLE} | cut -d"," -f2`
+
+       if [ "${PORT}" = "ttyS0" ]
+       then
+               ARGS="${ARGS} --serialdev=/dev/${PORT} --baud=${BAUD}"
+       fi
+fi
+
+exec /usr/bin/breakin ${ARGS}
diff --git a/etc/breakin/stop.sh b/etc/breakin/stop.sh
new file mode 100755 (executable)
index 0000000..17cb05f
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/ash
+sync
+umount /var/logdev
+echo "Breakin was stopped"
diff --git a/etc/cloner/detect_cd.sh b/etc/cloner/detect_cd.sh
new file mode 100755 (executable)
index 0000000..7d2ceec
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/ash
+
+. /etc/library.sh
+. /etc/cloner/include.sh
+. /tmp/cmdline.dat
+
+# find the CD-ROM device and create a symlink to it
+
+header "Trying to locate CD/DVD-ROM device"
+
+for i in `ls -1 /dev/cdrom*`
+do
+       msg -n "Mounting ${ANSI_BLUE}${i}${ANSI_DONE} on /mnt/media"
+       mount -t udf ${i} /mnt/media >> /tmp/stdout.log \
+               2>> /tmp/stderr.log
+
+       if [ "$?" = "0" ]
+       then
+               ok_msg
+               ln -s ${i} /dev/media >> /tmp/stdout.log \
+                       2>> /tmp/stderr.log     
+               break
+       else
+               fail_msg
+       fi
+done
+       
+if [ ! -e /dev/media ]
+then
+       fatal_error "Can't find a valid CD/DVD-ROM on this machine"
+fi
diff --git a/etc/cloner/get_setup.sh b/etc/cloner/get_setup.sh
new file mode 100755 (executable)
index 0000000..f7374c0
--- /dev/null
@@ -0,0 +1,146 @@
+#!/bin/ash
+
+. /etc/library.sh
+. /etc/cloner/include.sh
+. /tmp/hardware.dat
+
+write_client_conf () {
+       # Takes $SERVER, $IMAGE and $NODE as arguments and makes 
+       # /etc/cloner-client.conf
+       mkdir -p /cloner/setup/node/etc
+       if [ "${1}x" != "x" ]; then
+               echo "SERVER=${1}" >> /cloner/setup/node/etc/cloner-client.conf
+       fi
+       if [ "${2}x" != "x" ]; then
+               echo "IMAGE=${2}" >> /cloner/setup/node/etc/cloner-client.conf
+       fi
+       if [ "${3}x" != "x" ]; then
+               echo "NODE=${3}" >> /cloner/setup/node/etc/cloner-client.conf
+       fi
+               
+}
+
+if [ "${_srcpath}" != "" ]
+then
+       header "Copying setup information from ${_srcpath}"
+else
+       if [ "${_server}" = "" ]
+       then
+               fatal_error "The server must be specified on the command line"
+               exit
+       fi
+       header "Getting setup information from cloner server (${_server})"
+fi
+
+if [ "${_image}" = "" ]
+then
+       # user has not specified the cloner image from the command line
+
+       USE_SETTINGS=""
+
+       I=0
+       while [ "${I}" -lt "${NIC_COUNT}" ]
+       do
+               MACADDR=`eval "echo \\\${NIC_${I}_HWADDR}"`
+               ADDR=`echo ${MACADDR} | sed 's/://g'`
+
+               msg -n "Asking server for setup information for ${ADDR}"
+               rsync -v ${_server}::${CLONER_HOST_PATH}/${ADDR} \
+                       /cloner/setup/${ADDR} >> /tmp/stdout.log 2>> /tmp/stderr.log
+               if [ "$?" = 0 ]
+               then
+                       ok_msg
+                       USE_SETTINGS=${ADDR}
+                       break
+               else
+                       fail_msg
+               fi
+
+               I=`expr ${I} + 1`
+       done
+
+       if [ "${USE_SETTINGS}" != "" ]
+       then
+               . /cloner/setup/${USE_SETTINGS} 
+               msg "Using settings image=${ANSI_BLUE}${IMAGE}${ANSI_DONE} node=${ANSI_BLUE}${NODE}${ANSI_DONE}"
+
+               replace_setting "_image" "${IMAGE}"
+               replace_setting "_node" "${NODE}"
+       fi
+fi
+
+if [ "${_image}" = "" ]
+then
+       fatal_error "No image was specified or downloaded from the server"
+fi
+       
+# if we are installing from a disk or CD-ROM
+
+if [ "${_srcpath}" != "" ]
+then
+       msg -n "Copying setup data for image ${_image}"
+       rsync -v /mnt/media/setup/* /cloner/setup \
+               >> /tmp/stdout.log 2>> /tmp/stderr.log
+       if [ "$?" = 0 ]
+       then
+               ok_msg
+       else
+               fail_msg
+       
+               fatal_error "Can't get setup information from /mnt/media/setup"
+       fi
+
+       if [ "${_node}" != "" ]
+       then
+               msg -n "Copying node specific data for image=${_image} node=${_node}"
+               cp -av /mnt/media/setup/nodes/${_node}/* /cloner/setup/node \
+                       >> /tmp/stdout.log 2>> /tmp/stderr.log
+               if [ "$?" = 0 ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+                       fatal_error "Can't get node specific information from /mnt/media"
+               fi
+       fi
+
+# we are installing from the network
+else
+       msg -n "Downloading setup data for image ${_image}"
+       rsync -v ${_server}::${CLONER_IMAGE_PATH}/${_image}/* /cloner/setup \
+               >> /tmp/stdout.log 2>> /tmp/stderr.log
+       if [ "$?" = 0 ]
+       then
+               ok_msg
+       else
+               fail_msg
+       
+               fatal_error "Can't get setup information from ${_server}::${CLONER_IMAGE_PATH}/${_image}"
+       fi
+
+       if [ "${_node}" != "" ]
+       then
+               msg -n "Downloading node specific data for image=${_image} node=${_node}"
+               rsync -av ${_server}::${CLONER_IMAGE_PATH}/${_image}/nodes/${_node}/ \
+                       /cloner/setup/node >> /tmp/stdout.log 2>> /tmp/stderr.log
+       
+               if [ "$?" = 0 ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+       
+                       fatal_error "Can't get node specific information from ${_server}::${CLONER_IMAGE_PATH}/${_image}/nodes/${_node}"
+               fi
+               msg -n "Writing /etc/cloner-client.conf"
+               write_client_conf ${_server} ${_image} ${_node}
+               if [ "$?" = 0 ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+       
+                       fatal_error "Could not write /cloner/setup/etc/cloner-client.conf"
+               fi
+       fi
+fi
diff --git a/etc/cloner/include.sh b/etc/cloner/include.sh
new file mode 100755 (executable)
index 0000000..35aa519
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/ash
+
+PRODUCT_NAME="Advanced Clustering's Cloner"
+PRODUCT_VERSION="2.1"
+
+CLONER_IMAGE_PATH="cloner-2/images"
+CLONER_HOST_PATH="cloner-2/hosts"
+
+. /tmp/cmdline.dat
+
+replace_setting() {
+
+       KEY=${1}
+       VALUE=${2}
+
+       sed 's/${KEY}=.*//' /tmp/cmdline.dat > /tmp/cmdline.new
+       echo "${KEY}=\"${VALUE}\"" >> /tmp/cmdline.new
+
+       mv /tmp/cmdline.new /tmp/cmdline.dat
+       . /tmp/cmdline.dat
+}
diff --git a/etc/cloner/installer.sh b/etc/cloner/installer.sh
new file mode 100755 (executable)
index 0000000..29d4495
--- /dev/null
@@ -0,0 +1,232 @@
+#!/bin/ash
+
+. /etc/library.sh
+. /etc/cloner/include.sh
+. /tmp/cmdline.dat
+
+# TODO
+#  * Further testing of GRUB / LILO bootloader
+
+header "Starting the installation process"
+
+# --------------
+#  Perform a multicast install
+# --------------
+if [ "${_multicast}" = "1" ]
+then
+
+       msg "Starting multicast receiver, server will initiate transfer"
+       /usr/bin/udp-receiver --nokbd --pipe 'tar -xvf - -C /cloner/mnt'
+
+       if [ "$?" = "0" ]
+       then
+               ok_msg
+       else
+               fail_msg
+               fatal_error "Failed to untar multicasted image"
+       fi
+
+# --------------
+#  A CD-DVD based install
+# --------------
+elif [ "${_srcpath}" != "" ]
+then
+       msg "Starting the unpacking from CD/DVD-ROM"
+
+       # change to our install directory
+       cd /cloner/mnt >> /tmp/stdout.log 2>>/tmp/stderr.log
+
+       if [ -e /cloner/setup/disk_size ]
+       then
+               . /cloner/setup/disk_size
+       else
+               fatal_error "No disk size specified on setup directory"
+       fi
+
+       afio -i -Z -v -s $DISK_SIZE -H /etc/cloner/switch_cd.sh \
+               /mnt/media/${_image}.afio
+
+       if [ "$?" != 0 ]
+       then
+               fail_msg
+               fatal_error "Failed to extract filesystem from CD/DVD drive"
+       fi
+
+       # revert back to our old directory
+       cd - >> /tmp/stdout.log 2>>/tmp/stderr.log
+
+# --------------
+#  A standard network RSYNC based install
+# --------------
+else
+
+       #msg "The installation process can take a while, check ${ANSI_RED}[ALT-F4]${ANSI_DONE} to view progress"
+
+       msg -n "Syncing data from ${ANSI_BLUE}${_server}${ANSI_DONE} image ${ANSI_BLUE}${_image}${ANSI_DONE}"
+       /usr/bin/rsync -avz --numeric-ids \
+               ${_server}::${CLONER_IMAGE_PATH}/${_image}/data/  /cloner/mnt/
+       if [ "$?" = "0" ]
+       then
+               ok_msg
+       else
+               fail_msg
+               fatal_error "Failed to sync filesystem data from server!"
+       fi
+       
+fi
+       
+# remake an directories we excluded from our rsync process
+sort -k1 /cloner/setup/makedirectories \
+       > /cloner/setup/makedirectories.sorted 2>> /tmp/stderr.log
+
+header "Making missing directories"
+while read line
+do
+
+       DIR=`echo $line | awk '{print $1}'`
+       DIR_MODE=`echo $line | awk '{print $2}'`
+       DIR_UID=`echo $line | awk '{print $3}'`
+       DIR_GID=`echo $line | awk '{print $4}'`
+
+       if [ "${DIR}" != "" ]
+       then
+               msg -n "Making directory ${ANSI_BLUE}${DIR}${ANSI_DONE}"
+               mkdir -p /cloner/mnt/${DIR} >> /tmp/stdout.log \
+                       2>> /tmp/stderr.log
+
+               chmod ${DIR_MODE} /cloner/mnt/${DIR} >> \
+                       /tmp/stdout.log 2>> /tmp/stderr.log
+       
+               chown ${DIR_UID}:${DIR_GID} /cloner/mnt/${DIR} \
+                       >> /tmp/stdout.log 2>> /tmp/stderr.log
+       
+               if [ "$?" = "0" ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+               fi
+       fi
+
+done < /cloner/setup/makedirectories.sorted
+       
+if [ "${_node}" != "" ]
+then
+
+       if [ "${_srcpath}" != "" ]
+       then
+               header "Installing node specific data"
+               msg -n "Syning node ${ANSI_BLUE}${_node}${ANSI_DONE} data from /mnt/media"
+               rsync -avz -I --numeric-ids --exclude /.valid \
+                       /cloner/setup/node/ /cloner/mnt \
+                       >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+               if [ "$?" = "0" ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+                       fatal_error "Failed to sync node data from CD/DVD"
+               fi
+       else
+               header "Installing node specific data"
+               msg -n "Syning node ${ANSI_BLUE}${_node}${ANSI_DONE} data from ${_server}"
+
+               rsync -avz --numeric-ids --exclude /.valid \
+                       ${_server}::${CLONER_IMAGE_PATH}/${_image}/nodes/${_node}/ \
+                       /cloner/mnt >> /tmp/stdout.log 2>> /tmp/stderr.log
+               if [ "$?" = "0" ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+                       fatal_error "Failed to sync node data from server!"
+               fi
+       fi
+fi
+
+header "Installing bootloader"
+while read line
+do
+       BL_DEVICE=`echo $line | awk '{print $1}'`
+       BL_TYPE=`echo $line | awk '{print $2}'`
+
+       if [ "${BL_TYPE}" = "grub" ]
+       then
+               msg -n "Installing grub bootloader on ${ANSI_BLUE}${BL_DEVICE}${ANSI_DONE}"
+
+               GRUB_PATH=""
+               if [ -x /cloner/mnt/sbin/grub-install ]
+               then
+                       GRUB_PATH="/sbin/grub-install"
+               elif  [ -x /cloner/mnt/usr/sbin/grub-install ]
+               then
+                       GRUB_PATH="/usr/sbin/grub-install"
+               else
+                       fatal_error "Can't find the grub-install binary on mounted filesystem, no bootloader installed"
+               fi
+
+               chroot /cloner/mnt ${GRUB_PATH} --no-floppy ${BL_DEVICE} \
+                       >> /tmp/stdout.log 2>> /tmp/stderr.log
+               if [ "$?" = "0" ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+                       msg -n "Trying alternative grub installation "
+                       echo "root (hd0,0)" > /cloner/mnt/grub.txt
+                       echo "setup (hd0)" >> /cloner/mnt/grub.txt
+
+                       chroot /cloner/mnt ""/sbin/grub --device-map=/boot/grub/device.map --no-floppy --batch < /cloner/mnt/grub.txt"" \ 
+                               >> /tmp/stdout.log 2>> /tmp/stderr.log
+                       if [ "$?" = "0" ]
+                       then
+                               ok_msg
+                       else
+                               fail_msg
+                               fatal_error "Failed to install grub bootloader"
+                       fi
+               fi
+       elif [ "${BL_TYPE}" = "lilo" ]
+       then
+               msg -n "Installing lilo bootloader on ${ANSI_BLUE}${BL_DEVICE}${ANSI_DONE}"
+               chroot /cloner/mnt /sbin/lilo >> /tmp/stdout.log 2>> /tmp/stderr.log
+               if [ "$?" = "0" ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+                       fatal_error "Failed to install grub bootloader"
+               fi
+       fi
+
+done < /cloner/setup/bootloader
+
+# we want to sort our filesystems via the mntpoint field so we can unmount them in
+# the reverse order
+sort -r -k2 /cloner/setup/filesystems \
+       > /cloner/setup/filesystems.revsorted 2>> /tmp/stderr.log
+
+header "Unmounting filesystems"
+while read line
+do
+       FS_DEVICE=`echo $line | awk '{print $1}'`
+       FS_MNTPOINT=`echo $line | awk '{print $2}'`
+       FS_TYPE=`echo $line | awk '{print $3}'`
+       FS_LABEL=`echo $line | awk '{print $4}'`
+
+       case "${FS_TYPE}"
+       in
+               swap)
+                       msg -n "Turning off swap partitions"
+                       swapoff ${FS_DEVICE} >> /tmp/stdout.log 2>> /tmp/stderr.log
+                       ok_or_fail $?
+                       ;;
+               *)
+                       msg -n "Unmounting ${FS_DEVICE} -> ${FS_MNTPOINT}"
+                       umount /cloner/mnt${FS_MNTPOINT} >> /tmp/stdout.log 2>> /tmp/stderr.log
+                       ok_or_fail $?
+                       ;;
+       esac
+done < /cloner/setup/filesystems.revsorted
+
diff --git a/etc/cloner/library.sh b/etc/cloner/library.sh
new file mode 100755 (executable)
index 0000000..44f1db4
--- /dev/null
@@ -0,0 +1,142 @@
+#!/bin/ash
+
+eval `stty size 2>/dev/null | (read L C; echo LINES=${L:-24} COLUMNS=${C:-80})`
+
+PRODUCT_NAME="Advanced Clustering's Cloner"
+PRODUCT_VERSION="2.1"
+
+CLONER_IMAGE_PATH="cloner-2/images"
+CLONER_HOST_PATH="cloner-2/hosts"
+
+
+ANSI_GREEN="\033[1;32m"
+ANSI_RED="\033[1;31m"
+ANSI_BLUE="\033[1;34m"
+ANSI_PURPLE="\033[1;35m"
+ANSI_LEFT="\033[${COLUMNS}G\033[10D"
+ANSI_DONE="\033[0m"
+
+PRINT_OK=`echo -n ${ANSI_LEFT}${ANSI_GREEN} [ OK ] ${ANSI_DONE}`
+PRINT_FAIL=`echo -n ${ANSI_LEFT}${ANSI_RED} [ FAIL ] ${ANSI_DONE}`
+
+# if we have a settings file, load that
+if [ -e "/cloner/settings.conf" ]
+then
+       . /cloner/settings.conf
+fi
+
+msg() {
+       ARG1=$1
+       ARG2=$2
+
+       if [ "$ARG1" = "-n" ]
+       then
+               echo -en ${ARG2}
+       else 
+               echo -e ${ARG1}
+       fi
+}
+
+
+fail_msg() {
+       MSG=$1
+
+       # echo wget a error message to the server
+       msg "${PRINT_FAIL}"
+}
+
+ok_msg() {
+       MSG=$1
+
+       # echo wget a error message to the server
+       msg "${PRINT_OK}"
+}
+
+ok_or_fail() {
+       RETURN=$1
+
+       if [ "$RETURN" = "0" ]
+       then
+               ok_msg
+       else
+               fail_msg
+       fi
+}
+
+header() {
+       MSG=$1
+
+       msg -n "${ANSI_GREEN}"
+       msg "================================="
+       msg -n "${ANSI_BLUE}"
+       msg " ${MSG}"
+       msg -n "${ANSI_GREEN}"
+       msg "================================="
+       msg -n ${ANSI_DONE}
+
+}
+
+fatal_error() {
+       MSG=$1
+
+       msg ""
+       msg -n "${ANSI_RED}"
+       msg "========================================================"
+       msg "           Fatal Error - halting ${PRODUCT_NAME} ${PRODUCT_VERSION}"
+       msg "========================================================"
+       msg -n "${ANSI_BLUE}"
+       msg " ${MSG}"
+       msg -n "${ANSI_RED}"
+       msg "========================================================"
+       msg -n ${ANSI_DONE}
+       msg ""
+       exit 1
+
+}
+
+modprobe_module() {
+
+       MODULE_NAME=${1}
+
+       msg -n "Trying to load ${ANSI_BLUE}${MODULE_NAME}${ANSI_DONE}"
+       /sbin/modprobe "${MODULE_NAME}"  >> /tmp/stdout.log 2>> /tmp/stderr.log
+       if [ "$?" = "1" ];
+       then
+               fail_msg
+               return 1
+       else
+               ok_msg
+               return 0
+       fi
+}
+
+load_module() {
+
+       MODULE_PATH=${1}
+       MODULE_NAME=`basename ${MODULE_PATH}`
+       MODULE_BARE=`echo ${MODULE_NAME} | cut -d . -f 1`
+
+       msg -n "Trying to load ${ANSI_BLUE}${MODULE_NAME}${ANSI_DONE}"
+       # /sbin/insmod "${MODULE_PATH}"  >> /tmp/stdout.log 2>> /tmp/stderr.log
+       /sbin/modprobe "${MODULE_BARE}"  >> /tmp/stdout.log 2>> /tmp/stderr.log
+       if [ "$?" = "1" ];
+       then
+               fail_msg
+               return 1
+       else
+               ok_msg
+               return 0
+       fi
+}
+
+
+replace_setting() {
+
+       KEY=${1}
+       VALUE=${2}
+
+       sed 's/${KEY}=.*//' /cloner/settings.conf > /tmp/settings.new
+       echo "${KEY}=\"${VALUE}\"" >> /tmp/settings.new
+
+       mv /tmp/settings.new /cloner/settings.conf
+}
diff --git a/etc/cloner/prep_disks.sh b/etc/cloner/prep_disks.sh
new file mode 100755 (executable)
index 0000000..17966bc
--- /dev/null
@@ -0,0 +1,285 @@
+#!/bin/ash
+
+. /etc/library.sh
+. /etc/cloner/include.sh
+
+
+# TODO:
+#
+#  1. Finish software RAID setup
+#
+
+if [ "${_nomkfs}" = "" ]
+then
+
+       header "Partiting disks and formating filesystems"
+
+       DELAY=15
+       msg "Going to partition and format disks in ${DELAY} seconds, press [CTRL-C] to abort"
+       msg -n "${ANSI_BLUE}"
+       while [ "${DELAY}" != "0" ]
+       do
+               msg -n " ${ANSI_BLUE}${DELAY} ${ANSI_DONE} "
+               sleep 1
+               DELAY=`expr ${DELAY} - 1`
+       done
+       msg ""
+       
+
+       header "Partition the disk devices"
+       
+       for i in `ls -1 /cloner/setup/*.sfdisk`
+       do
+               DEVICE=`basename ${i}`
+               DEVICE=`echo ${DEVICE} | sed 's/\..*//g'`
+       
+       
+               msg -n "Partition device ${ANSI_BLUE}${DEVICE}${ANSI_DONE} "
+       
+               /usr/bin/sfdisk --force --no-reread -uM /dev/${DEVICE} < ${i} \
+                       >> /tmp/stdout.log 2>>/tmp/stderr.log
+       
+               if [ "$?" != "0" ];
+               then
+                       fail_msg
+                       fatal_error "Failed to partition disk device ${DEVICE} check /tmp/stdout.log or /tmp/stderr.log for details"
+               else
+                       ok_msg
+               fi
+       done
+       
+       for i in `ls -1 /cloner/setup/*.sec_fdisk 2> /dev/null`
+       do
+               DEVICE=`basename ${i}`
+               DEVICE=`echo ${DEVICE} | sed 's/\..*//g'`
+       
+               msg -n "Partition device ${ANSI_BLUE}${DEVICE}${ANSI_DONE} "
+       
+               /usr/bin/sfdisk --force --no-reread /dev/${DEVICE} < ${i} \
+                       >> /tmp/stdout.log 2>>/tmp/stderr.log
+       
+               if [ "$?" != "0" ];
+               then
+                       fail_msg
+                       fatal_error "Failed to partition disk device ${DEVICE} check /tmp/stdout.log or /tmp/stderr.log for details"
+               else
+                       ok_msg
+               fi
+       done
+fi
+       
+if [ -e /cloner/setup/raidconf ]
+then
+       header "Setting up software RAID devices"
+
+       while read line
+       do
+               MD_DEVICE=`echo $line | awk '{print $1}'`
+               MD_LEVEL=`echo $line | awk '{print $2}'`
+               MD_DISK_QTY=`echo $line | awk '{print $3}'`
+               MD_SPARE_QTY=`echo $line | awk '{print $4}'`
+               MD_DISKS=`echo $line | awk '{print $5}'`
+               MD_SPARES=`echo $line | awk '{print $6}'`
+
+               T1=`echo $MD_DISKS | sed 's/,/ /'`
+               T2=`echo $MD_SPARES | sed 's/,/ /'`
+               MD_DISK_STRING="${T1} ${T2}"
+               
+
+               msg -n "Creating ${ANSI_BLUE}${MD_DEVICE}${ANSI_DONE} - $MD_LEVEL on $MD_DISK_QTY disk(s)"
+               /usr/bin/mdadm --create ${MD_DEVICE} --force --run --level=${MD_LEVEL} --chunk=128 --raid-devices=${MD_DISK_QTY} --spare-devices=${MD_SPARE_QTY} ${MD_DISK_STRING} >> /tmp/stdout.log 2>> /tmp/stderr.log
+       
+       done < /cloner/setup/raidconf
+
+fi
+
+if [ -e /cloner/setup/pv_devices ]
+then
+
+       header "Setting up LVM groups"
+
+       while read line
+       do
+               PV_DEVICE=`echo $line | awk '{print $1}'`
+               PV_VG=`echo $line | awk '{print $2}'`
+               PV_UUID=`echo $line | awk '{print $3}'`
+
+               msg -n "Setting UUID on ${ANSI_BLUE}${PV_DEVICE}${ANSI_DONE}"
+               /usr/bin/lvm pvcreate -ff -y --uuid ${PV_UUID} \
+                       --restorefile /cloner/setup/lvm.${PV_VG} \
+                       ${PV_DEVICE} >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+               if [ "$?" != "0" ];
+               then
+                       fail_msg
+                       fatal_error "Failed to restore LVM UUID ${PV_UUID} to ${PV_DEVICE}";
+               else
+                       ok_msg
+               fi
+       done < /cloner/setup/pv_devices
+
+       for i in `ls -1 /cloner/setup/lvm.*`
+       do
+               FILENAME=`basename $i`
+               VG_NAME=`echo $FILENAME | cut -d"." -f2`        
+
+               msg -n "Restoring volume group ${ANSI_BLUE}${VG_NAME}${ANSI_DONE}"
+               /usr/bin/lvm vgcfgrestore -f $i ${VG_NAME} \
+                       >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+               if [ "$?" != "0" ];
+               then
+                       fail_msg
+                       fatal_error "Failed to restore LVM volume ${VG_NAME}";
+               else
+                       ok_msg
+               fi
+               msg -n "Activating volume group ${ANSI_BLUE}${VG_NAME}${ANSI_DONE}"
+               /usr/bin/lvm vgchange -a y ${VG_NAME} \
+                       >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+               if [ "$?" != "0" ];
+               then
+                       fail_msg
+                       fatal_error "Failed to bring LVM volume ${VG_NAME} online";
+               else
+                       ok_msg
+               fi
+       done
+fi
+
+# we want to sort our filesystems via the mntpoint field so we can mount them in
+# the correct order
+sort -k2 /cloner/setup/filesystems \
+       > /cloner/setup/filesystems.sorted 2>> /tmp/stderr.log
+
+header "Creating/mounting filesystems"
+while read line
+do
+       FS_DEVICE=`echo $line | awk '{print $1}'`
+       FS_MNTPOINT=`echo $line | awk '{print $2}'`
+       FS_TYPE=`echo $line | awk '{print $3}'`
+       FS_LABEL=`echo $line | awk '{print $4}'`
+
+       if [ "${_noddfs}" = "1" ]
+       then
+               msg "Skipping erasing first 5MB on partitions"
+       else
+               msg -n "Erasing first 5MB of data on partiion"
+               dd if=/dev/zero of=${FS_DEVICE} bs=1M count=5 \
+                       >> /tmp/stdout.log 2>> /tmp/stderr.log
+               ok_or_fail $?
+       fi
+
+       if [ "${_nomkfs}" = "" ]
+       then
+
+               msg -n "Creating ${ANSI_BLUE}${FS_TYPE}${ANSI_DONE} filesystem on ${ANSI_BLUE}${FS_DEVICE}${ANSI_DONE}"
+
+               case "${FS_TYPE}"
+               in
+                       ext3)
+                                       CMD="/usr/bin/mke2fs -F -j ${FS_DEVICE}"
+                                       if [ "${FS_LABEL}" != "" ]
+                                       then    
+                                               CMD="/usr/bin/mke2fs -F -L ${FS_LABEL} -j ${FS_DEVICE}"
+                                       fi
+       
+                                       $CMD >> /tmp/stdout.log 2>> /tmp/stderr.log
+                                       if [ "$?" = "0" ]
+                                       then
+                                               ok_msg
+                                       else
+                                               fail_msg
+                                               fatal_error "Failed to make ext3 filesystem on ${FS_DEVICE}"
+                                       fi
+                               ;;
+                       ext2)
+                                       CMD="/usr/bin/mke2fs -F ${FS_DEVICE}"
+                                       if [ "${FS_LABEL}" != "" ]
+                                       then    
+                                               CMD="/usr/bin/mke2fs -F -L ${FS_LABEL} ${FS_DEVICE}"
+                                       fi
+       
+                                       $CMD >> /tmp/stdout.log 2>> /tmp/stderr.log
+                                       if [ "$?" = "0" ]
+                                       then
+                                               ok_msg
+                                       else
+                                               fail_msg
+                                               fatal_error "Failed to make ext2 filesystem on ${FS_DEVICE}"
+                                       fi
+                               ;;
+                       xfs)
+                                       /usr/bin/mkfs.xfs -f ${FS_DEVICE} \
+                                               >> /tmp/stdout.log 2>> /tmp/stderr.log
+                                       if [ "$?" = "0" ]
+                                       then
+                                               ok_msg
+                                       else
+                                               fail_msg
+                                               fatal_error "Failed to make xfs filesystem on ${FS_DEVICE}"
+                                       fi
+                               ;;
+       
+                       reiserfs)
+                                       /usr/bin/mkreiserfs -ff ${FS_DEVICE} \
+                                               >> /tmp/stdout.log 2>> /tmp/stderr.log
+       
+                                       if [ "$?" = "0" ]
+                                       then
+                                               ok_msg
+                                       else
+                                               fail_msg
+                                               fatal_error "Failed to make reiserfs filesystem on ${FS_DEVICE}"
+                                       fi
+                               ;;
+                       swap)
+                                       /usr/bin/mkswap -f ${FS_DEVICE} \
+                                               >> /tmp/stdout.log 2>> /tmp/stderr.log
+                                       if [ "$?" = "0" ]
+                                       then
+                                               ok_msg
+                                       else
+                                               fail_msg
+                                               fatal_error "Failed to make swap filesystem on ${FS_DEVICE}"
+                                       fi
+       
+                                       msg -n "Activating swap device ${FS_DEVICE}"
+                                       swapon ${FS_DEVICE} >> /tmp/stdout.log 2>> /tmp/stderr.log
+                                       if [ "$?" = "0" ]
+                                       then
+                                               ok_msg
+                                       else
+                                               fail_msg
+                                               fatal_error "Failed to activate swap filesystem on ${FS_DEVICE}"
+                                       fi
+                               ;;
+                       *)
+                               fatal_error "Don't know how to handle filesystem type ${FS_TYPE}"
+                               ;;
+               esac
+
+       fi
+       
+       # if it starts with a / it's going to be mounted
+       if [ `echo ${FS_MNTPOINT} | grep '^/'` ]
+       then
+               MNT_POINT=`echo ${FS_MNTPOINT} | sed 's/^\///'`
+               msg -n "Mounting ${ANSI_BLUE}${FS_DEVICE}${ANSI_DONE} on ${ANSI_BLUE}/cloner/mnt/${MNT_POINT}${ANSI_DONE}"
+
+               mkdir -p /cloner/mnt/${MNT_POINT} >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+               mount -t ${FS_TYPE} ${FS_DEVICE} /cloner/mnt/${MNT_POINT} >> /tmp/stdout.log 2>> /tmp/stderr.log
+               if [ "$?" = "0" ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+                       fatal_error "Failed to mount ${FS_DEVICE} to /cloner/mnt/${MNT_POINT}"
+               fi
+       fi
+
+done < /cloner/setup/filesystems.sorted
+
+
diff --git a/etc/cloner/remount-fs.sh b/etc/cloner/remount-fs.sh
new file mode 100755 (executable)
index 0000000..3d1cff4
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/ash
+
+# we want to sort our filesystems via the mntpoint field so we can mount them in
+# the correct order
+sort -k2 /cloner/setup/filesystems \
+       > /cloner/setup/filesystems.sorted 2>> /tmp/stderr.log
+
+header "Mounting filesystems"
+while read line
+do
+       FS_DEVICE=`echo $line | awk '{print $1}'`
+       FS_MNTPOINT=`echo $line | awk '{print $2}'`
+       FS_TYPE=`echo $line | awk '{print $3}'`
+       FS_LABEL=`echo $line | awk '{print $4}'`
+
+       
+       # if it starts with a / it's going to be mounted
+       if [ `echo ${FS_MNTPOINT} | grep '^/'` ]
+       then
+               MNT_POINT=`echo ${FS_MNTPOINT} | sed 's/^\///'`
+               msg -n "Mounting ${ANSI_BLUE}${FS_DEVICE}${ANSI_DONE} on ${ANSI_BLUE}/cloner/mnt/${MNT_POINT}${ANSI_DONE}"
+
+               mkdir -p /cloner/mnt/${MNT_POINT} >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+               mount -t ${FS_TYPE} ${FS_DEVICE} /cloner/mnt/${MNT_POINT} >> /tmp/stdout.log 2>> /tmp/stderr.log
+               if [ "$?" = "0" ]
+               then
+                       ok_msg
+               else
+                       fail_msg
+                       fatal_error "Failed to mount ${FS_DEVICE} to /cloner/mnt/${MNT_POINT}"
+               fi
+       fi
+
+done < /cloner/setup/filesystems.sorted
+
diff --git a/etc/cloner/startup.sh b/etc/cloner/startup.sh
new file mode 100755 (executable)
index 0000000..b97095e
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/ash
+
+. /etc/library.sh
+. /etc/cloner/include.sh
+
+# first thing we do is bring up the network interface if we are not
+# installing from a sourcepath
+if [ "${_srcpath}" != "" ]
+then
+       /etc/cloner/detect_cd.sh
+fi
+
+/etc/cloner/get_setup.sh
+
+# if we are supposed to automatically format disks
+if [ "${_manualdisk}" = "" ]
+then
+       /etc/cloner/prep_disks.sh
+       /etc/cloner/installer.sh
+
+       header "Cloner install finished"
+       echo -e "The cloner install has finished successfully.  You may now reboot"
+       echo -e "the machine.  If you would like to re-mount the destination filesystems"
+       echo -e "to make any changes manually please run ${ANSI_BLUE}/etc/cloner/remount-fs.sh${ANSI_DONE}"
+       echo -e ""
+       echo -en "Press ${ANSI_BLUE}[ENTER]${ANSI_DONE} for a command prompt"
+       read PROMPT
+
+else
+
+       header "Partition and format disks"
+       echo -e "You have selected to manually partition and format your hard disk drives"
+       echo -e "please do that now, and mount them under /cloner/mnt as they will be in"
+       echo -e "the installed OS.  When finished execute /etc/cloner/installer.sh on the command"
+       echo -e "line to finish the installation of this system."
+
+       echo -en "Press ${ANSI_BLUE}[ENTER]${ANSI_DONE} for a command prompt"
+       read PROMPT
+fi
diff --git a/etc/cloner/switch_cd.sh b/etc/cloner/switch_cd.sh
new file mode 100755 (executable)
index 0000000..a3a482b
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/ash
+
+. /etc/library.sh
+. /etc/cloner/include.sh
+. /tmp/cmdline.dat
+
+VOLUME=${1}
+FILENAME=${2}
+CONTINUE=0
+
+header "End of CD/DVD-ROM reached"
+
+while  [ "$CONTINUE" = "0" ]; do
+    umount /mnt/media >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+    msg "Please insert disk ${ANSI_BLUE}#${VOLUME}${ANSI_DONE} and press enter:"
+    read INPUT <&1
+
+    mount -t udf /dev/media /mnt/media >> /tmp/stdout.log \
+               2>> /tmp/stderr.log
+
+    if [ -e "/mnt/media/DISK_${VOLUME}" ]; then
+        CONTINUE=1
+    else
+        msg "${ANSI_RED}**** INVALID DISK ****${ANSI_DONE}"
+    fi
+done
+
+exit
diff --git a/etc/dropbear/dropbear_dss_host_key b/etc/dropbear/dropbear_dss_host_key
new file mode 100644 (file)
index 0000000..a4b7e4e
Binary files /dev/null and b/etc/dropbear/dropbear_dss_host_key differ
diff --git a/etc/dropbear/dropbear_rsa_host_key b/etc/dropbear/dropbear_rsa_host_key
new file mode 100644 (file)
index 0000000..b4cee84
Binary files /dev/null and b/etc/dropbear/dropbear_rsa_host_key differ
diff --git a/etc/fstab b/etc/fstab
new file mode 100644 (file)
index 0000000..d4372bb
--- /dev/null
+++ b/etc/fstab
@@ -0,0 +1 @@
+proc           /proc           proc    defaults        0       0
diff --git a/etc/group b/etc/group
new file mode 100644 (file)
index 0000000..9811bea
--- /dev/null
+++ b/etc/group
@@ -0,0 +1,36 @@
+root:x:0:root
+bin:x:1:root,bin,daemon
+daemon:x:2:root,bin,daemon
+sys:x:3:root,bin,adm
+adm:x:4:root,adm,daemon
+tty:x:5:
+disk:x:6:root,adm
+lp:x:7:lp
+mem:x:8:
+kmem:x:9:
+wheel:x:10:root
+floppy:x:11:root
+mail:x:12:mail
+news:x:13:news
+uucp:x:14:uucp
+man:x:15:man
+cron:x:16:cron
+console:x:17:
+audio:x:18:
+cdrom:x:19:
+dialout:x:20:root
+ftp:x:21:
+sshd:x:22:
+at:x:25:at
+tape:x:26:root
+video:x:27:root
+squid:x:31:squid
+gdm:x:32:gdm
+xfs:x:33:xfs
+games:x:35:
+named:x:40:named
+mysql:x:60:
+postgres:x:70:
+cdrw:x:80:
+apache:x:81:
+nut:x:84:
diff --git a/etc/hardware.sh b/etc/hardware.sh
new file mode 100755 (executable)
index 0000000..5441e1a
--- /dev/null
@@ -0,0 +1,167 @@
+#!/bin/ash
+
+. /etc/library.sh
+
+# -----------------------------------------------------------------------
+# load the output file created by the breakin program
+# -----------------------------------------------------------------------
+if [ -e /var/run/breakin.dat ]
+then
+       . /var/run/breakin.dat
+fi
+
+# FIXME:
+
+NET_MODULE_PATH="/lib/modules/`uname -r`/kernel/drivers/net"
+SCSI_MODULE_PATH="/lib/modules/`uname -r`/kernel/drivers/scsi"
+LIBATA_MODULE_PATH="/lib/modules/`uname -r`/kernel/drivers/ata"
+MD_MODULE_PATH="/lib/modules/`uname -r`/kernel/drivers/md"
+FUSIONMPT_MODULE_PATH="/lib/modules/`uname -r`/kernel/drivers/message/fusion"
+MODULE_PREFIX="/lib/modules/`uname -r`/kernel/drivers"
+SENSOR_ENABLE=0
+
+dhcp_on_interface() {
+       INTERFACE=${1}
+
+
+       # this is a stop gap for my laptop
+       if [ "${INTERFACE}" = "ath0" ]
+       then
+               return 1
+       fi
+
+       msg -n "Trying DHCP on ${i} interface"
+
+       /sbin/udhcpc -i ${INTERFACE} -n -s /etc/ifup.udhcp.sh \
+               -p /tmp/dhcp.${INTERFACE}.pid >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+       if [ "$?" = 0 ]
+       then
+               . /tmp/network.dhcp
+               ok_msg
+               return 0
+       else
+               fail_msg
+               return 1
+       fi
+}
+
+
+
+header "Loading network card modules"
+for i in `find ${NET_MODULE_PATH} -name \*.ko`
+do
+       load_module "${i}"
+done
+
+header "Finding ethernet devices"
+
+if [ "${spantree}" != "" ]
+then
+       msg "Sleeping for ${spantree} seconds for spanning tree"
+       sleep ${spantree}
+fi
+
+
+NET_DEVICES=`/sbin/ifconfig -a | grep "^[a-z]" | cut -d" " -f1`
+NET_DEVICE_COUNT=0
+NET_DEVICE=""
+
+for i in ${NET_DEVICES}
+do
+
+       # we want to skip the loopback interfaces since they don't really count
+       if [ "${i}" = "lo" ]
+       then
+               continue
+       fi
+
+       NET_DEVICE_COUNT=`expr ${NET_DEVICE_COUNT} + 1`
+
+       msg -n "Checking link status for ${i}"
+       /bin/mii-diag -s ${i} >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+       if [ "$?" != "0" ];
+       then
+               fail_msg
+       else
+               ok_msg
+               dhcp_on_interface ${i}
+               if [ "$?" = "0" ]
+               then
+                       NET_DEVICE="${i}"
+               fi
+       fi
+done
+
+if [ "${NET_DEVICE}" = "" ];
+then
+       msg ""
+       msg "Unable to find interface with link, manually trying each interface"
+       for i in ${NET_DEVICES}
+       do
+               if [ "${i}" = "lo" ]
+               then
+                       continue
+               fi
+
+               dhcp_on_interface ${i}
+               if [ "$?" = "0" ]
+               then
+                       NET_DEVICE="${i}"
+                       break
+               fi
+       done
+fi
+
+#msg -n "Setting hostname to be HW address  "
+#HOST=`echo ${NET_MACADDR} | sed 's/://g'`
+#msg -n " ${NET_MACADDR}"
+#hostname ${HOST} >> /tmp/stdout.log 2> /tmp/stderr.log
+#if [ "$?" = 0 ]
+#then
+       #ok_msg
+#else
+       #fail_msg
+#fi
+
+for i in /lib/modules/`uname -r`/kernel/drivers/edac/*
+do
+       MOD_NAME=`basename ${i} | cut -d"." -f1`
+       modprobe_module ${MOD_NAME}
+done
+
+for i in /lib/modules/`uname -r`/kernel/drivers/i2c/busses/*
+do
+       MOD_NAME=`basename ${i} | cut -d"." -f1`
+       modprobe_module ${MOD_NAME}
+done
+
+for i in /lib/modules/`uname -r`/kernel/drivers/hwmon/*
+do
+       MOD_NAME=`basename ${i} | cut -d"." -f1`
+       modprobe_module ${MOD_NAME}
+done
+
+# XXX: this may cause lockups, if so we need a better way
+header "Loading all SCSI/SATA disk modules"
+
+for i in `find ${SCSI_MODULE_PATH} ${LIBATA_MODULE_PATH} ${FUSIONMPT_MODULE_PATH} ${MD_MODULE_PATH} -name \*.ko`
+do
+       MOD_NAME=`basename ${i} | cut -d"." -f1`
+       modprobe_module ${MOD_NAME}
+done
+
+header "Loading other modules"
+for i in `cat /etc/modules_other.conf`
+do
+       modprobe_module ${i}    
+done
+
+msg "Waiting 10 seconds for block devices to settle."
+sleep 10
+
+# mount a logging device
+. /etc/logdev.sh
+
+. /etc/hardware_output.sh
diff --git a/etc/hardware_output.sh b/etc/hardware_output.sh
new file mode 100755 (executable)
index 0000000..99b10ed
--- /dev/null
@@ -0,0 +1,116 @@
+#!/bin/ash
+
+. /etc/library.sh
+
+
+disk_list() {
+
+       DISK_COUNT=0
+
+       for i in `ls -1 /proc/ide/hd* | grep "/proc/ide/hd[a-z]$" 2>> /tmp/stderr.log`
+       do
+               dev=`basename $i`
+               size=`disk_size $dev`
+               model=`cat /proc/ide/$dev/model | head -1`
+               echo "DISK_${DISK_COUNT}_DEV=\"$dev\""
+               echo "DISK_${DISK_COUNT}_SIZE=\"$size\""
+               echo "DISK_${DISK_COUNT}_MODEL=\"$model\""
+               DISK_COUNT=`expr ${DISK_COUNT} + 1`
+       done
+
+       for i in `ls -1 /dev/sd* | grep "/dev/sd[a-z]$`
+       do
+               dev=`basename $i`
+               exists=`cat /proc/partitions | awk '{print  $4}' | grep $dev`
+               if [ "${exists}" != "" ]
+               then
+                       size=`disk_size $dev`
+                       model=`cat /sys/block/$dev/device/model`
+                       vendor=`cat /sys/block/$dev/device/vendor`      
+                       scsi="${scsi} ### $dev:$size:$vendor $model"
+
+                       echo "DISK_${DISK_COUNT}_DEV=\"$dev\""
+                       echo "DISK_${DISK_COUNT}_SIZE=\"$size\""
+                       echo "DISK_${DISK_COUNT}_MODEL=\"$vendor $model\""
+                       DISK_COUNT=`expr ${DISK_COUNT} + 1`
+               fi
+       done
+       echo "DISK_COUNT=\"${DISK_COUNT}\""
+}
+
+disk_size() {
+       dev=$1
+       
+       size=`cat /proc/partitions | awk '{ print $3, $4 }' | grep "${dev}$" | awk '{print $1}'`
+       echo $size
+}
+
+network_list() {
+
+       NIC_COUNT=0
+
+       for dev in `ls -1 /sys/class/net`
+       do
+               driver=""
+               pci_dev=""
+               dev_vend=""
+               dev_dev=""
+
+               hwaddr=`cat /sys/class/net/${dev}/address`
+
+               if [ "${dev}" = "lo" ]
+               then
+                   continue
+               fi
+               echo "NIC_${NIC_COUNT}_DEV=\"${dev}\""
+               echo "NIC_${NIC_COUNT}_HWADDR=\"${hwaddr}\""
+
+               if [ -e /sys/class/net/${dev}/driver ]
+               then
+                       driverlnk=`readlink /sys/class/net/${dev}/driver`
+                       driver=`basename $driverlnk`
+               fi
+
+               if [ -e /sys/class/net/${dev}/device ]
+               then
+                       dev_vend=`cat /sys/class/net/${dev}/device/vendor`
+                       dev_dev=`cat /sys/class/net/${dev}/device/device`
+               fi
+               #driver=`basename ${driverlnk}`
+               echo "NIC_${NIC_COUNT}_DRIVER=\"${driver}\""
+               echo "NIC_${NIC_COUNT}_PCIDEV=\"${dev_dev}\""
+               echo "NIC_${NIC_COUNT}_PCIVENDOR=\"${dev_vend}\""
+
+               NIC_COUNT=`expr ${NIC_COUNT} + 1`
+       done
+       echo "NIC_COUNT=\"${NIC_COUNT}\""
+
+}
+
+pci_list() {
+       PCI_COUNT=0
+       for i in /sys/bus/pci/devices/*
+       do
+               busid=`basename $i`
+               device=`cat ${i}/device`
+               vendor=`cat ${i}/vendor`
+               irq=`cat ${i}/irq`
+               class=`cat ${i}/class`
+
+               echo "PCI_${PCI_COUNT}_BUSID=\"$busid\""
+               echo "PCI_${PCI_COUNT}_DEVICE=\"$device\""
+               echo "PCI_${PCI_COUNT}_VENDOR=\"$vendor\""
+               echo "PCI_${PCI_COUNT}_CLASS=\"$class\""
+               echo "PCI_${PCI_COUNT}_IRQ=\"$irq\""
+
+               PCI_COUNT=`expr ${PCI_COUNT} + 1`
+       done
+
+       echo "PCI_COUNT=\"${PCI_COUNT}\""
+}
+
+/usr/bin/dmidecode     > /tmp/hardware.dat
+disk_list              >> /tmp/hardware.dat
+network_list   >> /tmp/hardware.dat
+pci_list               >> /tmp/hardware.dat
+
diff --git a/etc/ifup.udhcp.sh b/etc/ifup.udhcp.sh
new file mode 100755 (executable)
index 0000000..4a08608
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/ash
+
+[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
+
+RESOLV_CONF="/etc/resolv.conf"
+[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+[ -n "$subnet" ] && NETMASK="netmask $subnet"
+
+case "$1" in
+       deconfig)
+               /sbin/ifconfig $interface 0.0.0.0
+               ;;
+
+       renew|bound)
+               /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
+
+               if [ -n "$router" ] ; then
+                       while /sbin/route del default gw 0.0.0.0 dev $interface ; do
+                               :
+                       done
+
+                       for i in $router ; do
+                               /sbin/route add default gw $i dev $interface
+                       done
+               fi
+
+               echo -n > $RESOLV_CONF
+               [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
+               for i in $dns ; do
+                       echo adding dns $i
+                       echo nameserver $i >> $RESOLV_CONF
+               done
+               ;;
+esac
+
+echo "NET_INTERFACE=$interface"        > /tmp/network.dhcp
+echo "NET_IPADDR=$ip"                  >> /tmp/network.dhcp
+echo "NET_SUBNET=$subnet"              >> /tmp/network.dhcp
+echo "NET_BROADCAST=$broadcast"        >> /tmp/network.dhcp
+echo "NET_ROUTER=$router"              >> /tmp/network.dhcp
+
+MAC=`/sbin/ifconfig $interface | grep HWaddr | cut -d ' ' -f 11 | tr [A-H] [a-h]`
+echo "NET_MACADDR=$MAC"                >> /tmp/network.dhcp
+
+
+exit 0
diff --git a/etc/init.d/rcS b/etc/init.d/rcS
new file mode 100755 (executable)
index 0000000..d0f16ab
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/ash
+
+. /etc/library.sh
+
+header "${PRODUCT_NAME} ${PRODUCT_VER} startup"
+
+msg -n "Mounting /proc filesystem"
+mount -t proc none /proc > /dev/null 2>&1
+if [ "$?" = "0" ];
+then
+       ok_msg
+else
+       fatal_error "Unable to mount /proc can't continue"
+fi
+
+msg -n "Mounting /sys filesystem"
+mount -t sysfs none /sys > /dev/null 2>&1
+if [ "$?" = "0" ];
+then
+       ok_msg
+else
+       fatal_error "Unable to mount /sys can't continue"
+fi
+
+msg -n "Mounting tmpfs on /dev for udev"
+mount -n -t tmpfs none /dev > /dev/null 2>&1
+if [ "$?" = "0" ];
+then
+       ok_msg
+else
+       fatal_error "Unable to mount /dev can't continue"
+fi
+
+msg -n "Setting udev as hotplug agent and triggering events"
+#echo "/usr/sbin/udev" > /proc/sys/kernel/hotplug
+/usr/sbin/udevd --daemon
+/usr/bin/udevtrigger
+ok_msg
+
+msg -n "brining up the loopback interface"
+/sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0 up > /dev/null 2>&1
+ok_or_fail $?
+
+for i in `cat /proc/cmdline`
+do
+       case ${i}
+       in
+               syslog=*)
+                       RSYSLOG=`echo ${i} | sed 's/syslog=//'`
+               ;;
+       esac
+done
+
+msg -n "Starting the syslog daemon"
+if [ "${SYSLOG}" != "" ]
+then
+       /sbin/syslogd -m 0 -L -R ${RSYSLOG} > /dev/null 2>&1
+else
+       /sbin/syslogd -m 0 > /dev/null 2>&1
+fi
+ok_or_fail $?
+
+msg -n "Starting the kernel log daemon"
+/sbin/klogd -c 1 > /dev/null 2>&1
+ok_or_fail $?
+
+msg -n "Disabling console blanking"
+echo -en "\033[9;0]"
+ok_msg
+
+export PATH=$PATH:/usr/bin
diff --git a/etc/inittab b/etc/inittab
new file mode 100644 (file)
index 0000000..a67a00c
--- /dev/null
@@ -0,0 +1,91 @@
+# /etc/inittab init(8) configuration for BusyBox
+#
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+#
+#
+# Note, BusyBox init doesn't support runlevels.  The runlevels field is
+# completely ignored by BusyBox init. If you want runlevels, use sysvinit.
+#
+#
+# Format for each entry: <id>:<runlevels>:<action>:<process>
+#
+# <id>: WARNING: This field has a non-traditional meaning for BusyBox init!
+#
+#      The id field is used by BusyBox init to specify the controlling tty for
+#      the specified process to run on.  The contents of this field are
+#      appended to "/dev/" and used as-is.  There is no need for this field to
+#      be unique, although if it isn't you may have strange results.  If this
+#      field is left blank, it is completely ignored.  Also note that if
+#      BusyBox detects that a serial console is in use, then all entries
+#      containing non-empty id fields will _not_ be run.  BusyBox init does
+#      nothing with utmp.  We don't need no stinkin' utmp.
+#
+# <runlevels>: The runlevels field is completely ignored.
+#
+# <action>: Valid actions include: sysinit, respawn, askfirst, wait, once,
+#                                  restart, ctrlaltdel, and shutdown.
+#
+#       Note: askfirst acts just like respawn, but before running the specified
+#       process it displays the line "Please press Enter to activate this
+#       console." and then waits for the user to press enter before starting
+#       the specified process.
+#
+#       Note: unrecognised actions (like initdefault) will cause init to emit
+#       an error message, and then go along with its business.
+#
+# <process>: Specifies the process to be executed and it's command line.
+#
+# Note: BusyBox init works just fine without an inittab. If no inittab is
+# found, it has the following default behavior:
+#         ::sysinit:/etc/init.d/rcS
+#         ::askfirst:/bin/sh
+#         ::ctrlaltdel:/sbin/reboot
+#         ::shutdown:/sbin/swapoff -a
+#         ::shutdown:/bin/umount -a -r
+#         ::restart:/sbin/init
+#
+# if it detects that /dev/console is _not_ a serial console, it will
+# also run:
+#         tty2::askfirst:/bin/sh
+#         tty3::askfirst:/bin/sh
+#         tty4::askfirst:/bin/sh
+#
+# Boot-time system configuration/initialization script.
+# This is run first except when booting in single-user mode.
+#
+::sysinit:/etc/init.d/rcS
+
+# /bin/sh invocations on selected ttys
+#
+# Note below that we prefix the shell commands with a "-" to indicate to the
+# shell that it is supposed to be a login shell.  Normally this is handled by
+# login, but since we are bypassing login in this case, BusyBox lets you do
+# this yourself...
+#
+# Start an "askfirst" shell on the console (whatever that may be)
+
+
+tty0::respawn:/usr/bin/screen -c /etc/screenrc /etc/startup.sh
+#tty1::respawn:/bin/ash -l
+tty2::respawn:/usr/bin/tail -f /var/log/messages
+tty3::respawn:/usr/bin/tail -f /tmp/stdout.log
+tty4::respawn:/usr/bin/tail -f /tmp/stderr.log
+tty5::askfirst:/bin/ash -l
+tty6::askfirst:/bin/ash -l
+
+
+# Example of how to put a getty on a serial line (for a terminal)
+#::respawn:/sbin/getty -L ttyS0 9600 vt100
+#::respawn:/sbin/getty -L ttyS1 9600 vt100
+#
+# Example how to put a getty on a modem line.
+#::respawn:/sbin/getty 57600 ttyS2
+
+# Stuff to do when restarting the init process
+::restart:/sbin/init
+
+# Stuff to do before rebooting
+ca::ctrlaltdel:/sbin/shutdown -r -t 4 now
+::shutdown:/bin/umount -a -r
+::shutdown:/sbin/swapoff -a
+
diff --git a/etc/ld.so.conf b/etc/ld.so.conf
new file mode 100644 (file)
index 0000000..1eee485
--- /dev/null
@@ -0,0 +1,9 @@
+/lib
+/lib32
+/lib64
+/usr/lib
+/usr/lib32
+/usr/lib64
+/usr/lib
+/usr/lib32
+/usr/lib64
diff --git a/etc/library.sh b/etc/library.sh
new file mode 100755 (executable)
index 0000000..5a0e80e
--- /dev/null
@@ -0,0 +1,259 @@
+#!/bin/ash
+
+eval `stty size 2>/dev/null | (read L C; echo LINES=${L:-24} COLUMNS=${C:-80})`
+
+PRODUCT_NAME="Break-in"
+PRODUCT_VERSION="0.01"
+
+
+ANSI_GREEN="\033[1;32m"
+ANSI_RED="\033[1;31m"
+ANSI_BLUE="\033[1;34m"
+ANSI_PURPLE="\033[1;35m"
+ANSI_LEFT="\033[${COLUMNS}G\033[10D"
+ANSI_DONE="\033[0m"
+
+PRINT_OK=`echo -n ${ANSI_LEFT}${ANSI_GREEN} [ OK ] ${ANSI_DONE}`
+PRINT_FAIL=`echo -n ${ANSI_LEFT}${ANSI_RED} [ FAIL ] ${ANSI_DONE}`
+
+if [ -e /tmp/servers.conf ]
+then
+       . /tmp/servers.conf
+fi
+
+if [ -e /tmp/hardware.conf ]
+then
+       . /tmp/hardware.conf
+fi
+
+if [ -e /tmp/breakin.conf ]
+then
+       . /tmp/breakin.conf
+fi
+
+if [ -e /tmp/network.dhcp ]
+then
+       . /tmp/network.dhcp
+fi
+
+
+msg() {
+       ARG1=$1
+       ARG2=$2
+
+       if [ "$ARG1" = "-n" ]
+       then
+               echo -en ${ARG2} 
+       else 
+               echo -e ${ARG1} 
+       fi
+}
+
+fail_msg() {
+       MSG=$1
+
+       # echo wget a error message to the server
+       msg "  ${PRINT_FAIL}"
+}
+
+ok_msg() {
+       MSG=$1
+
+       # echo wget a error message to the server
+       msg "  ${PRINT_OK}"
+}
+
+ok_or_fail() {
+       RETURN=$1
+
+       if [ "$RETURN" = "0" ]
+       then
+               ok_msg
+       else
+               fail_msg
+       fi
+}
+
+header() {
+       MSG=$1
+
+        msg -n "${ANSI_GREEN}"
+        msg "================================="
+        msg -n "${ANSI_BLUE}"
+        msg " ${MSG}"
+        msg -n "${ANSI_GREEN}"
+        msg "================================="
+        msg -n ${ANSI_DONE}
+
+}
+
+fatal_error() {
+       MSG=$1
+
+        msg ""
+        msg -n "${ANSI_RED}"
+        msg "========================================================"
+        msg "           Fatal Error - halting ${PRODUCT_NAME} ${PRODUCT_VERSION}"
+        msg "========================================================"
+        msg -n "${ANSI_BLUE}"
+        msg " ${MSG}"
+        msg -n "${ANSI_RED}"
+        msg "========================================================"
+        msg -n ${ANSI_DONE}
+        msg ""
+        exit 1
+}
+
+modprobe_module() {
+
+       MODULE_NAME=${1}
+
+       msg -n "Trying to load ${ANSI_BLUE}${MODULE_NAME}${ANSI_DONE}"
+       /sbin/modprobe "${MODULE_NAME}"  >> /tmp/stdout.log 2>> /tmp/stderr.log
+       if [ "$?" = "1" ];
+       then
+               fail_msg
+               return 1
+       else
+               ok_msg
+               return 0
+       fi
+}
+
+load_module() {
+
+       MODULE_PATH=${1}
+       MODULE_NAME=`basename ${MODULE_PATH}`
+
+       msg -n "Trying to load ${MODULE_NAME}"
+       /sbin/insmod "${MODULE_PATH}"  >> /tmp/stdout.log 2>> /tmp/stderr.log
+       if [ "$?" = "1" ];
+       then
+               fail_msg
+               return 1
+       else
+               ok_msg
+               return 0
+       fi
+}
+
+post_file_to_server() {
+
+       MSG=${1}
+       URIPATH=${2}
+       FILENAME=${3}
+
+       if [ "${BREAKIN_ID}" -lt 0 ]
+       then
+               return 1
+       fi
+
+       msg -n "$MSG -> ${HTTP_SERVER}:${HTTP_PORT}"
+
+       URL="http://${HTTP_SERVER}:${HTTP_PORT}/${URIPATH}/${NET_MACADDR}/${BREAKIN_ID}"
+
+       wget --server-response -O /tmp/post.out --post-file=${FILENAME} --timeout=10 \
+               --tries=3 ${URL} >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+       if [ "$?" = 0 ]
+       then
+               ok_msg  
+               return 0
+       else
+               fail_msg
+               return 1
+       fi
+}
+
+breakin_start() {
+
+       msg -n "Notifing server that we've started the breakin process"
+       URL="http://${HTTP_SERVER}:${HTTP_PORT}/cgi-bin/breakin/start/${NET_MACADDR}"
+
+       wget --server-response -O /tmp/post.out --timeout=10 \
+               --output-document=/tmp/breakin.conf \
+               --tries=3 ${URL} 2>> /tmp/stderr.log
+
+       . /tmp/breakin.conf
+
+       if [ "$?" = 0 ]
+       then
+               ok_msg  
+               return 0
+       else
+               fail_msg
+               return 1
+       fi
+}
+
+breakin_stop() {
+
+       msg -n "Notifing server that we're stoping the breakin process"
+       URL="http://${HTTP_SERVER}:${HTTP_PORT}/cgi-bin/breakin/stop/${NET_MACADDR}/${BREAKIN_ID}"
+
+       wget --server-response -O /tmp/post.out --timeout=10 \
+               --tries=3 ${URL} >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+       if [ "$?" = 0 ]
+       then
+               ok_msg  
+               return 0
+       else
+               fail_msg
+               return 1
+       fi
+}
+
+breakin_update() {
+
+       if [ "${BREAKIN_ID}" -lt 0 ]
+       then
+               return 0
+       fi
+
+       LOADAVG=0
+       TEMPS=""
+
+       if [ -e /proc/loadavg ]
+       then
+               LOADAVG=`cat /proc/loadavg | awk '{print $1}'`
+       fi
+
+       if [ "${SENSOR_ENABLE}" != "" ]
+       then
+               TEMPS=""
+               if [ -e "/etc/sensors.conf" ]
+               then
+                       for temp_i in `sensors | grep "^CPU[0-9] Temp" | cut -d":" -f2 | awk '{print $1 $2}' 2> /dev/null`
+                       do
+                               TEMPS="${TEMPS} ${temp_i}"      
+                       done
+               fi
+       fi
+
+       echo "LOADAVG=${LOADAVG}" > /tmp/update.dat
+       echo "TEMPERATURE=${TEMPS}" >> /tmp/update.dat
+
+       URL="http://${HTTP_SERVER}:${HTTP_PORT}/cgi-bin/breakin/update/${NET_MACADDR}/${BREAKIN_ID}"
+       wget --server-response -O /tmp/post.out --post-file=/tmp/update.dat --timeout=10 \
+               --tries=3 ${URL} >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+       if [ "$?" = 0 ]
+       then
+               return 0
+       else
+               return 1
+       fi
+}
+
+
+
+
+
+log_burnin_error() {
+       MSG=$1
+
+       # create a file to notify the LED process there is an error
+       touch /tmp/error_led
+       echo "${MSG}" >> /var/log/breakin.log
+}
diff --git a/etc/logdev.sh b/etc/logdev.sh
new file mode 100755 (executable)
index 0000000..d80facb
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/ash
+
+# mount a logging device
+for i in `ls -1d /sys/block/sd[a-z] /sys/block/hd[a-z] 2>/dev/null`
+do
+       REMOVABLE=$(< ${i}/removable)
+       if [ "${REMOVABLE}" != 1 ]
+       then
+               ls -l ${i}/device | grep usb > /dev/null
+               if [ $? != 0 ]
+               then
+                       continue # skip non-removable, non-usb devices
+               fi
+       fi
+       DEV_NAME=`basename ${i}`
+       vol_id -x /dev/${DEV_NAME} > /tmp/vol_id.tmp
+       if [ $? != 0 ] # no file system found
+       then
+               for j in `ls -1d ${i}/?d?[0-9] 2>/dev/null`
+               do
+                       DEV_NAME=`basename ${j}`
+                       vol_id -x /dev/${DEV_NAME} > /tmp/vol_id.tmp
+                       if [ $? = 0 ]
+                       then
+                               #source /tmp/vol_id.tmp # might use these variables some day
+                               mount /dev/${DEV_NAME} /var/logdev
+                               touch /var/logdev/breakin.log
+                               echo "Logging device found at ${DEV_NAME}."
+                               exit 0
+                       fi
+               done
+       else # found file system
+               #source /tmp/vol_id.tmp # might use these variables some day
+               mount /dev/${DEV_NAME} /var/logdev
+               touch /var/logdev/breakin.log
+               echo "Logging device found at ${DEV_NAME}."
+               exit 0
+       fi
+done
+
+echo "No logging device found."
+
diff --git a/etc/lvm/lvm.conf b/etc/lvm/lvm.conf
new file mode 100644 (file)
index 0000000..8fc3e53
--- /dev/null
@@ -0,0 +1,288 @@
+# This is an example configuration file for the LVM2 system.
+# It contains the default settings that would be used if there was no
+# /etc/lvm/lvm.conf file.
+#
+# Refer to 'man lvm.conf' for further information including the file layout.
+#
+# To put this file in a different directory and override /etc/lvm set
+# the environment variable LVM_SYSTEM_DIR before running the tools.
+
+
+# This section allows you to configure which block devices should
+# be used by the LVM system.
+devices {
+
+    # Where do you want your volume groups to appear ?
+    dir = "/dev"
+
+    # An array of directories that contain the device nodes you wish
+    # to use with LVM2.
+    scan = [ "/dev" ]
+
+    # A filter that tells LVM2 to only use a restricted set of devices.
+    # The filter consists of an array of regular expressions.  These
+    # expressions can be delimited by a character of your choice, and
+    # prefixed with either an 'a' (for accept) or 'r' (for reject).
+    # The first expression found to match a device name determines if
+    # the device will be accepted or rejected (ignored).  Devices that
+    # don't match any patterns are accepted.
+
+    # Be careful if there there are symbolic links or multiple filesystem 
+    # entries for the same device as each name is checked separately against
+    # the list of patterns.  The effect is that if any name matches any 'a'
+    # pattern, the device is accepted; otherwise if any name matches any 'r'
+    # pattern it is rejected; otherwise it is accepted.
+
+    # Remember to run vgscan after you change this parameter to ensure 
+    # that the cache file gets regenerated (see below).
+
+    # By default we accept every block device:
+    filter = [ "a/.*/" ]
+
+    # Exclude the cdrom drive
+    # filter = [ "r|/dev/cdrom|" ]
+
+    # When testing I like to work with just loopback devices:
+    # filter = [ "a/loop/", "r/.*/" ]
+
+    # Or maybe all loops and ide drives except hdc:
+    # filter =[ "a|loop|", "r|/dev/hdc|", "a|/dev/ide|", "r|.*|" ]
+
+    # Use anchors if you want to be really specific
+    # filter = [ "a|^/dev/hda8$|", "r/.*/" ]
+
+    # The results of the filtering are cached on disk to avoid
+    # rescanning dud devices (which can take a very long time).  By
+    # default this cache file is hidden in the /etc/lvm directory.
+    # It is safe to delete this file: the tools regenerate it.
+    cache = "/etc/lvm/.cache"
+
+    # You can turn off writing this cache file by setting this to 0.
+    write_cache_state = 1
+
+    # Advanced settings.
+
+    # List of pairs of additional acceptable block device types found 
+    # in /proc/devices with maximum (non-zero) number of partitions.
+    # types = [ "fd", 16 ]
+
+    # If sysfs is mounted (2.6 kernels) restrict device scanning to 
+    # the block devices it believes are valid.
+    # 1 enables; 0 disables.
+    sysfs_scan = 1     
+
+    # By default, LVM2 will ignore devices used as components of
+    # software RAID (md) devices by looking for md superblocks.
+    # 1 enables; 0 disables.
+    md_component_detection = 1
+}
+
+# This section that allows you to configure the nature of the
+# information that LVM2 reports.
+log {
+
+    # Controls the messages sent to stdout or stderr.
+    # There are three levels of verbosity, 3 being the most verbose.
+    verbose = 0
+
+    # Should we send log messages through syslog?
+    # 1 is yes; 0 is no.
+    syslog = 1
+
+    # Should we log error and debug messages to a file?
+    # By default there is no log file.
+    #file = "/var/log/lvm2.log"
+
+    # Should we overwrite the log file each time the program is run?
+    # By default we append.
+    overwrite = 0
+
+    # What level of log messages should we send to the log file and/or syslog?
+    # There are 6 syslog-like log levels currently in use - 2 to 7 inclusive.
+    # 7 is the most verbose (LOG_DEBUG).
+    level = 0
+    
+    # Format of output messages
+    # Whether or not (1 or 0) to indent messages according to their severity
+    indent = 1
+
+    # Whether or not (1 or 0) to display the command name on each line output
+    command_names = 0
+
+    # A prefix to use before the message text (but after the command name,
+    # if selected).  Default is two spaces, so you can see/grep the severity
+    # of each message.
+    prefix = "  "
+
+    # To make the messages look similar to the original LVM tools use:
+    #   indent = 0
+    #   command_names = 1
+    #   prefix = " -- "
+
+    # Set this if you want log messages during activation.
+    # Don't use this in low memory situations (can deadlock).
+    # activation = 0
+}
+
+# Configuration of metadata backups and archiving.  In LVM2 when we
+# talk about a 'backup' we mean making a copy of the metadata for the
+# *current* system.  The 'archive' contains old metadata configurations.
+# Backups are stored in a human readeable text format.
+backup {
+
+    # Should we maintain a backup of the current metadata configuration ?
+    # Use 1 for Yes; 0 for No.
+    # Think very hard before turning this off!
+    backup = 1
+
+    # Where shall we keep it ?
+    # Remember to back up this directory regularly!
+    backup_dir = "/etc/lvm/backup"
+
+    # Should we maintain an archive of old metadata configurations.
+    # Use 1 for Yes; 0 for No.
+    # On by default.  Think very hard before turning this off.
+    archive = 1
+
+    # Where should archived files go ?
+    # Remember to back up this directory regularly!
+    archive_dir = "/etc/lvm/archive"
+    
+    # What is the minimum number of archive files you wish to keep ?
+    retain_min = 10
+
+    # What is the minimum time you wish to keep an archive file for ?
+    retain_days = 30
+}
+
+# Settings for the running LVM2 in shell (readline) mode.
+shell {
+
+    # Number of lines of history to store in ~/.lvm_history
+    history_size = 100
+}
+
+
+# Miscellaneous global LVM2 settings
+global {
+    
+    # The file creation mask for any files and directories created.
+    # Interpreted as octal if the first digit is zero.
+    umask = 077
+
+    # Allow other users to read the files
+    #umask = 022
+
+    # Enabling test mode means that no changes to the on disk metadata
+    # will be made.  Equivalent to having the -t option on every
+    # command.  Defaults to off.
+    test = 0
+
+    # Whether or not to communicate with the kernel device-mapper.
+    # Set to 0 if you want to use the tools to manipulate LVM metadata 
+    # without activating any logical volumes.
+    # If the device-mapper kernel driver is not present in your kernel
+    # setting this to 0 should suppress the error messages.
+    activation = 1
+
+    # If we can't communicate with device-mapper, should we try running 
+    # the LVM1 tools?
+    # This option only applies to 2.4 kernels and is provided to help you
+    # switch between device-mapper kernels and LVM1 kernels.
+    # The LVM1 tools need to be installed with .lvm1 suffices
+    # e.g. vgscan.lvm1 and they will stop working after you start using
+    # the new lvm2 on-disk metadata format.
+    # The default value is set when the tools are built.
+    # fallback_to_lvm1 = 0
+
+    # The default metadata format that commands should use - "lvm1" or "lvm2".
+    # The command line override is -M1 or -M2.
+    # Defaults to "lvm1" if compiled in, else "lvm2".
+    # format = "lvm1"
+
+    # Location of proc filesystem
+    proc = "/proc"
+
+    # Type of locking to use. Defaults to file-based locking (1).
+    # Turn locking off by setting to 0 (dangerous: risks metadata corruption
+    # if LVM2 commands get run concurrently).
+    locking_type = 1
+
+    # Local non-LV directory that holds file-based locks while commands are
+    # in progress.  A directory like /tmp that may get wiped on reboot is OK.
+    locking_dir = "/var/lock/lvm"
+
+    # Other entries can go here to allow you to load shared libraries
+    # e.g. if support for LVM1 metadata was compiled as a shared library use
+    #   format_libraries = "liblvm2format1.so" 
+    # Full pathnames can be given.
+
+    # Search this directory first for shared libraries.
+    #   library_dir = "/lib"
+}
+
+activation {
+    # Device used in place of missing stripes if activating incomplete volume.
+    # For now, you need to set this up yourself first (e.g. with 'dmsetup')
+    # For example, you could make it return I/O errors using the 'error' 
+    # target or make it return zeros.
+    missing_stripe_filler = "/dev/ioerror"
+
+    # Size (in KB) of each copy operation when mirroring
+    mirror_region_size = 512
+
+    # How much stack (in KB) to reserve for use while devices suspended
+    reserved_stack = 256
+
+    # How much memory (in KB) to reserve for use while devices suspended
+    reserved_memory = 8192
+
+    # Nice value used while devices suspended
+    process_priority = -18
+
+    # If volume_list is defined, each LV is only activated if there is a
+    # match against the list.
+    #   "vgname" and "vgname/lvname" are matched exactly.
+    #   "@tag" matches any tag set in the LV or VG.
+    #   "@*" matches if any tag defined on the host is also set in the LV or VG
+    #
+    # volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
+}
+
+
+####################
+# Advanced section #
+####################
+
+# Metadata settings
+#
+# metadata {
+    # Default number of copies of metadata to hold on each PV.  0, 1 or 2.
+    # You might want to override it from the command line with 0 
+    # when running pvcreate on new PVs which are to be added to large VGs.
+
+    # pvmetadatacopies = 1
+
+    # Approximate default size of on-disk metadata areas in sectors.
+    # You should increase this if you have large volume groups or
+    # you want to retain a large on-disk history of your metadata changes.
+
+    # pvmetadatasize = 255
+
+    # List of directories holding live copies of text format metadata.
+    # These directories must not be on logical volumes!
+    # It's possible to use LVM2 with a couple of directories here,
+    # preferably on different (non-LV) filesystems, and with no other 
+    # on-disk metadata (pvmetadatacopies = 0). Or this can be in
+    # addition to on-disk metadata areas.
+    # The feature was originally added to simplify testing and is not
+    # supported under low memory situations - the machine could lock up.
+    #
+    # Never edit any files in these directories by hand unless you
+    # you are absolutely sure you know what you are doing! Use
+    # the supplied toolset to make changes (e.g. vgcfgrestore).
+
+    # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ]
+#}
+
+
diff --git a/etc/modules_other.conf b/etc/modules_other.conf
new file mode 100644 (file)
index 0000000..50fc190
--- /dev/null
@@ -0,0 +1,6 @@
+uhci_hcd
+ohci_hcd
+ehci_hcd
+usbhid
+usb_storage
+vfat
diff --git a/etc/mtab b/etc/mtab
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/etc/nsswitch.conf b/etc/nsswitch.conf
new file mode 100644 (file)
index 0000000..1c291d5
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# /etc/nsswitch.conf
+#
+# An example Name Service Switch config file. This file should be
+# sorted with the most-used services at the beginning.
+#
+# The entry '[NOTFOUND=return]' means that the search for an
+# entry should stop if the search in the previous entry turned
+# up nothing. Note that if the search failed due to some other reason
+# (like no NIS server responding) then the search continues with the
+# next entry.
+#
+# Legal entries are:
+#
+#       compat                  Use compatibility setup
+#       nisplus                 Use NIS+ (NIS version 3)
+#       nis                     Use NIS (NIS version 2), also called YP
+#       dns                     Use DNS (Domain Name Service)
+#       files                   Use the local files
+#       [NOTFOUND=return]       Stop searching if not found so far
+#
+# For more information, please read the nsswitch.conf.5 manual page.
+#
+
+# passwd: files nis
+# shadow: files nis
+# group:  files nis
+
+passwd:        files
+group: files
+
+hosts: files dns
+networks:      files
+
+services:      files 
+protocols:     files
+rpc:   files
+ethers:        files
+netmasks:      files
+netgroup:      files
+publickey:     files
+
+bootparams:    files
+automount:     files
+aliases:       files
diff --git a/etc/passwd b/etc/passwd
new file mode 100644 (file)
index 0000000..3bed777
--- /dev/null
@@ -0,0 +1,31 @@
+root::0:0:root:/root:/bin/ash
+bin:x:1:1:bin:/bin:/bin/false
+daemon:x:2:2:daemon:/sbin:/bin/false
+adm:x:3:4:adm:/var/adm:/bin/false
+lp:x:4:7:lp:/var/spool/lpd:/bin/false
+sync:x:5:0:sync:/sbin:/bin/sync
+shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
+halt:x:7:0:halt:/sbin:/sbin/halt
+mail:x:8:12:mail:/var/spool/mail:/bin/false
+news:x:9:13:news:/usr/lib/news:/bin/false
+uucp:x:10:14:uucp:/var/spool/uucppublic:/bin/false
+operator:x:11:0:operator:/root:/bin/bash
+man:x:13:15:man:/usr/man:/bin/false
+postmaster:x:14:12:postmaster:/var/spool/mail:/bin/false
+cron:x:16:16:cron:/var/spool/cron:/bin/false
+ftp:x:21:21::/home/ftp:/bin/false
+sshd:x:22:22:sshd:/dev/null:/bin/false
+at:x:25:25:at:/var/spool/cron/atjobs:/bin/false
+squid:x:31:31:Squid:/var/cache/squid:/bin/false
+gdm:x:32:32:GDM:/var/lib/gdm:/bin/false
+xfs:x:33:33:X Font Server:/etc/X11/fs:/bin/false
+games:x:35:35:games:/usr/games:/bin/bash
+named:x:40:40:bind:/var/bind:/bin/false
+mysql:x:60:60:mysql:/var/lib/mysql:/bin/false
+postgres:x:70:70::/var/lib/postgresql:/bin/bash
+apache:x:81:81:apache:/home/httpd:/bin/false
+nut:x:84:84:nut:/var/state/nut:/bin/false
+cyrus:x:85:12::/usr/cyrus:/bin/false
+vpopmail:x:89:89::/var/vpopmail:/bin/false
+alias:x:200:200::/var/qmail/alias:/bin/false
+ssh:x:0:0:Remote SSH user:/home/ssh:/etc/resumescreen
diff --git a/etc/profile b/etc/profile
new file mode 100755 (executable)
index 0000000..440242f
--- /dev/null
@@ -0,0 +1,5 @@
+# /etc/profile: system-wide .profile file for the Bourne shells
+
+
+PATH=$PATH:/usr/bin
+export PATH
diff --git a/etc/rescue/startup.sh b/etc/rescue/startup.sh
new file mode 100755 (executable)
index 0000000..a5a4ccc
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/ash 
+
+exec /bin/ash -l
diff --git a/etc/resumescreen b/etc/resumescreen
new file mode 100755 (executable)
index 0000000..9f1a4a3
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/ash
+
+/usr/bin/screen -c /etc/screenrc -x 
diff --git a/etc/screenrc b/etc/screenrc
new file mode 100644 (file)
index 0000000..673fb2e
--- /dev/null
@@ -0,0 +1,2 @@
+term xterm
+acladd ssh
diff --git a/etc/shells b/etc/shells
new file mode 100644 (file)
index 0000000..fc0d1cf
--- /dev/null
@@ -0,0 +1,2 @@
+/bin/ash
+/etc/resumescreen
diff --git a/etc/startup.sh b/etc/startup.sh
new file mode 100755 (executable)
index 0000000..f61cb22
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/ash -l
+
+. /etc/library.sh
+
+# only really run this once, if the file exists we drop to a shell instead
+# this allows us to respawn from inittab
+if [ -e /tmp/ranonce ];
+then
+       exec /bin/ash
+fi
+
+touch /tmp/ranonce
+
+
+ARGS=""
+
+echo "" > /tmp/cmdline.dat
+for i in `cat /proc/cmdline`
+do
+       case ${i}
+       in
+               *=*)
+                       KEY=`echo ${i} | cut -d"=" -f1`
+                       VALUE=`echo ${i} | cut -d"=" -f2`
+
+                       if [ "${KEY}" != "" ];
+                       then
+                               export _${KEY}="${VALUE}"
+                               echo "_${KEY}='${VALUE}'" >> /tmp/cmdline.dat
+                       fi
+               ;;
+       esac
+done
+
+if [ "${_sshpasswd}" != "" ]
+then
+       #echo "root:${_sshpasswd}" | /usr/sbin/chpasswd
+       echo "ssh:${_sshpasswd}" | /usr/sbin/chpasswd
+
+       /usr/sbin/dropbear -p :22 > /var/log/sshd.log 2>&1
+fi
+
+. /etc/hardware.sh
+
+if [ "${_startup}" = "" ]
+then
+       echo "A startup option must be specified on the kernel command line"
+       exit
+fi
+
+/etc/${_startup}/startup.sh
diff --git a/etc/syscheck/startup.sh b/etc/syscheck/startup.sh
new file mode 100755 (executable)
index 0000000..2321790
--- /dev/null
@@ -0,0 +1,271 @@
+#!/bin/ash -l
+
+. /etc/library.sh
+. /tmp/cmdline.dat
+
+HTTP_SERVER="172.16.0.31"
+HTTP_PORT="80"
+
+post_file_to_server() {
+
+    MSG=${1}
+    URIPATH=${2}
+    FILENAME=${3}
+
+    if [ "${BREAKIN_ID}" -lt 0 ]
+    then
+        return 1
+    fi
+
+       URL="http://${HTTP_SERVER}:${HTTP_PORT}${URIPATH}"
+
+    msg -n "$MSG -> ${HTTP_SERVER}:${HTTP_PORT}"
+
+    /usr/bin/wget --server-response -O /tmp/post.out --post-file=${FILENAME} --timeout=10 \
+        --tries=3 ${URL} >> /tmp/stdout.log 2>> /tmp/stderr.log
+
+    if [ "$?" = 0 ]
+    then
+        ok_msg
+        return 0
+    else
+        fail_msg
+        return 1
+    fi
+}
+
+check_values() {
+
+       . /tmp/hardware.dat
+
+       
+       header "CPU information"
+       i=0
+       while [ "${i}" -lt "${CPU_COUNT}" ]
+       do
+                       eval "speed=\$CPU_${i}_SPEED"
+                       eval "manuf=\$CPU_${i}_MANUFACTURER"
+                       eval "family=\$CPU_${i}_FAMILY"
+                       eval "version=\$CPU_${i}_VERSION"
+                       echo "  CPU ${i}   : $version - ${manuf} ${family} ${speed}"
+                       i=`expr ${i} + 1`
+       done
+       echo ""
+       echo -n "Correct (y/n) [y] > "
+       read confirm
+
+       if [ "${confirm}" != "y" -a "${confirm}" != "Y" -a "${confirm}" != "" ]
+       then
+               return 1
+       fi
+
+       header "DIMM information"
+       i=0
+       while [ "${i}" -lt "${DIMM_COUNT}" ]
+       do
+                       eval "name=\$DIMM_${i}_NAME"
+                       eval "size=\$DIMM_${i}_SIZE"
+                       eval "locator=\$DIMM_${i}_LOCATOR"
+                       echo "  DIMM ${i}   : ${name} / ${locator} ${size}"
+                       i=`expr ${i} + 1`
+       done
+       echo ""
+       echo -n "Correct (y/n) [y] > "
+       read confirm
+
+       if [ "${confirm}" != "y" -a "${confirm}" != "Y" -a "${confirm}" != "" ]
+       then
+               return 1
+       fi
+
+       header "DISK information"
+       i=0
+       while [ "${i}" -lt "${DISK_COUNT}" ]
+       do
+                       eval "name=\$DISK_${i}_DEV"
+                       eval "size=\$DISK_${i}_SIZE"
+                       eval "model=\$DISK_${i}_MODEL"
+                       echo "  DISK ${i}   : ${name} ${model} (${size}MB)"
+                       i=`expr ${i} + 1`
+       done
+       echo ""
+       echo -n "Correct (y/n) [y] > "
+       read confirm
+
+       if [ "${confirm}" != "y" -a "${confirm}" != "Y" -a "${confirm}" != "" ]
+       then
+               return 1
+       fi
+
+
+       header "NIC information"
+       i=0
+       while [ "${i}" -lt "${NIC_COUNT}" ]
+       do
+                       eval "name=\$NIC_${i}_DEV"
+                       eval "driver=\$NIC_${i}_DRIVER"
+                       eval "device=\$NIC_${i}_PCIDEV"
+                       eval "vendor=\$NIC_${i}_PCIVENDOR"
+                       echo "  NIC ${i}   : ${name} ${driver} (${device}:${vendor})"
+                       i=`expr ${i} + 1`
+       done
+       echo ""
+       echo -n "Correct (y/n) [y] > "
+       read confirm
+
+       if [ "${confirm}" != "y" -a "${confirm}" != "Y" -a "${confirm}" != "" ]
+       then
+               return 1
+       fi
+
+}
+
+
+header "Checking system against master"
+
+CONTINUE=0
+COUNT=0
+
+while [ "${CONTINUE}" != 1 ]
+do
+       echo -n "Enter system serial number > "
+       read serialnumber
+
+       echo "SERIALNUMBER=\"$serialnumber\"" >> /tmp/submit.$$
+
+       post_file_to_server "Sending serial number to server" "/cgi-bin/syscheck/check" /tmp/submit.$$
+       if [ "$?" = "1" ]
+       then
+               fatal_error "Can't communicate with server!"
+               exit
+       fi
+
+       if [ -e /tmp/post.out ]
+       then
+               . /tmp/post.out
+               rm /tmp/post.out >> /tmp/stdout.log 2>> /tmp/stderr.log
+       else
+               fatal_error "Didn't get expected response back from server!"
+       fi
+
+       rm /tmp/submit.$$ >> /tmp/stdout.log 2>>/tmp/stderr.log
+
+       if [ "${RESULT}" != "1" ]
+       then
+               msg ""
+               msg "${ANSI_RED}${ERROR_MSG}${ANSI_DONE}"
+               msg ""
+               continue;
+       fi
+
+       header "Verify information is correct"
+       
+       echo "  Serial #    :  ${serialnumber}"
+       echo "  Item name   :  ${ITEM_NAME}"
+       echo "  Item type   :  ${GROUP_NAME}"
+       echo "  Order       :  #${ORDER_ID} - ${ORDER_NAME}"
+       echo "  Customer    :  ${CUSTOMER_NAME}"
+
+       if [ "${MASTER_NAME}" != "" ]
+       then
+               echo "  Master      :  ${MASTER_NAME} / ${MASTER_SERIAL}"
+       fi
+
+       echo ""
+       echo -n "Are the above values correct (y/n) [y] > "
+       read confirm
+
+       if [ "${confirm}" != "y" -a "${confirm}" != "Y" -a "${confirm}" != "" ]
+       then
+               continue
+       fi
+
+       if [ "${IS_MASTER}" = "1" ]
+       then
+               msg ""
+               msg "${ANSI_RED}This serial # is a 'master' and can't be re-checked in.${ANSI_DONE}"
+               msg ""
+               continue
+       fi
+
+       if [ "${SYSCHECK_ID}" != "" ]
+       then
+               echo -n "The system has already been checked in, re-checkin (y/n) [y] > "
+               read confirm
+               if [ "${confirm}" != "y" -a "${confirm}" != "Y" -a "${confirm}" != "" ]
+               then
+                       continue
+               fi
+       fi
+
+       cp /tmp/hardware.dat /tmp/submit.$$ >> /tmp/stdout.log 2>> /tmp/stderr.log
+       echo "SERIALNUMBER=\"$serialnumber\"" >> /tmp/submit.$$
+
+       if [ "${MASTER_SERIAL}" = "" -o "${MASTER_SERIAL}" = "0"  ]
+       then
+               echo -n "No master found for this type of machine, use this one (y/n) [y] > "
+               read confirm
+               if [ "${confirm}" != "y" -a "${confirm}" != "Y" -a "${confirm}" != "" ]
+               then
+                       continue
+               fi
+               check_values
+               if [ "$?" = "1" ]
+               then
+                       continue
+               fi
+               echo "MASTER=\"1\"" >> /tmp/submit.$$
+       fi
+
+       post_file_to_server "Sending hardware data to server" "/cgi-bin/syscheck/verified" /tmp/submit.$$
+> /tmp/stdout.log 2>>/tmp/stderr.log
+
+
+       if [ -e "/tmp/post.out" ]
+       then
+               . /tmp/post.out
+       fi      
+
+       if [ "${RESULT}" != "1" ]
+       then
+               msg "${ANSI_RED}"
+               msg "${ERROR_MSG}"
+
+               if [ "${CMP_ERROR_COUNT}" -gt 0 ]
+               then
+                       i=0     
+                       while [ "${i}" -lt "${CMP_ERROR_COUNT}" ]
+                       do
+                               eval "MSG=\$CMP_ERROR_$i"
+                               msg "  $MSG"
+                               i=`expr ${i} + 1`
+                       done
+               fi
+               msg "${ANSI_DONE}"
+               continue
+       else
+
+               if [ "${_startcloner}" = "1" ]
+               then
+                       exec /etc/cloner/startup.sh
+               elif [ "${_startbreakin}" = "1" ]
+               then
+                       exec /etc/breakin/startup.sh
+               else 
+                       msg "${ANSI_GREEN}"     
+                       echo ""
+                       echo "***************************************************************"
+                       echo "*                                                             *"
+                       echo "*               System checked into sysman                    *"
+                       echo "*                                                             *"
+                       echo "***************************************************************"
+                       msg "${ANSI_DONE}"
+                       echo "Either reboot system or press [ENTER] for prompt: "
+                       echo ""
+                       read line
+
+               fi
+       fi
+       break
+done
+exit
diff --git a/etc/udev/rules.d/cd-awesomeness.rules b/etc/udev/rules.d/cd-awesomeness.rules
new file mode 100644 (file)
index 0000000..ab477db
--- /dev/null
@@ -0,0 +1,8 @@
+# import optical drive properties
+
+KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", IMPORT{program}="/usr/bin/cdrom_id --export $tempnode"
+
+ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \
+        SUBSYSTEMS!="usb|ieee1394", \
+        PROGRAM="/etc/udev/scripts/find_next_cd", SYMLINK+="%c"
+
diff --git a/etc/udev/scripts/find_next_cd b/etc/udev/scripts/find_next_cd
new file mode 100755 (executable)
index 0000000..582fb7d
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh -e
+
+# This script is run if an optical drive lacks a rule for persistent naming.
+#
+# It adds symlinks for optical drives based on the device class determined
+# by cdrom_id and used ID_PATH to identify the device.
+#
+# (C) 2006 Marco d'Itri <md@Linux.IT>
+# (C) 2008 Advanced Clustering Technologies, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation version 2 of the License.
+#
+# Don't blame Marco for our lameness--if you think this is lame, anyway...
+
+find_next_available() {
+    local links="$1"
+
+    local basename=${links%%[ 0-9]*}
+    local max=-1
+    for name in $links; do
+        local num=${name#$basename}
+        [ "$num" ] || num=0
+        [ $num -gt $max ] && max=$num
+    done
+
+    local max=$(($max + 1))
+    # "name0" actually is just "name"
+    [ $max -eq 0 ] && return
+    echo "$max"
+}
+
+link_num=$(find_next_available "/dev/cdrom*")
+link="cdrom$link_num"
+
+echo $link
+
+exit 0
+
diff --git a/etc/udev/udev.conf b/etc/udev/udev.conf
new file mode 100644 (file)
index 0000000..41902c4
--- /dev/null
@@ -0,0 +1,7 @@
+# udev.conf
+
+# The initial syslog(3) priority: "err", "info", "debug" or its
+# numerical equivalent. For runtime debugging, the daemons internal
+# state can be changed with: "udevcontrol log_priority=<value>".
+udev_log="err"
+
diff --git a/var/run/utmp b/var/run/utmp
new file mode 100644 (file)
index 0000000..e69de29