--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/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
+}
--- /dev/null
+#!/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/local/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/local/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
+
--- /dev/null
+#!/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
+}
--- /dev/null
+#!/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/local/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/local/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/local/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/local/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/local/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/local/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/local/bin/mke2fs -F -j ${FS_DEVICE}"
+ if [ "${FS_LABEL}" != "" ]
+ then
+ CMD="/usr/local/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/local/bin/mke2fs -F ${FS_DEVICE}"
+ if [ "${FS_LABEL}" != "" ]
+ then
+ CMD="/usr/local/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/local/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/local/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/local/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
+
+
--- /dev/null
+#!/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
+
--- /dev/null
+#!/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
--- /dev/null
+#!/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