Here's the new init script that I used for builder_bigdisk_v3. This also eliminates the scrawl and make-drives utilities, as they have been rolled into this one instead to save some execution time RAM.

Attached and inline (We really need a <pre> tag!!):
Code:
#!/bin/sh

log() {
        echo "$1"
        echo "POPUP 9999 $1" > /proc/empeg_notify
}

failed() {
        log "$1 failed"
        /bin/swapoff /dev/hda3
        /bin/swapoff /dev/hda6
        sync
        exec /bin/bash --login
}

makedrive() {
        dev="/dev/$1"
        log "Making $1 filesystem"
        /bin/mkfs.ext2 -v -s 1 -i 131072 -m 0 $dev || failed "mkfs $1"
        log "Tuning $1"
        /bin/tune2fs -c -1 -i0 $dev || failed "tune2fs $1"
        /bin/sync
        /bin/sync
        log "Mounting $1"
        /bin/mount -n -o rw,nocheck $dev $2 || failed "mount $1"
        /bin/sync
        /bin/sync
        log "Making directories"
        /bin/mkdir $2/fids || failed "mkdir /fids"
        /bin/mkdir $2/var || failed "mkdir /var"
        echo "[hijack]" > $2/var/config.ini || failed "config.ini"
        log "Remounting ro"
        /bin/mount -n -o remount,ro $dev $2 || failed "remount"
        /bin/sync
        /bin/sync
        log "$1 completed"
}

# echo everything to the serial console:
set -x

/bin/mount -n /proc
log "Builder image"

DRIVE1=""
if [ -e /proc/ide/hdb -a -e /proc/ide/hdc ]; then
        log 'hdb,hdc both exist?'
        exec /bin/bash --login
fi
[ -e /proc/ide/hdb ] && DRIVE1=hdb
[ -e /proc/ide/hdc ] && DRIVE1=hdc

/bin/mount -n -t ext2 -o ro,nocheck /dev/hda4 /drive0
if [ -d /drive0/fids ]; then
        log "Drives already built"
else
        /bin/umount /drive0

        /bin/mkswap  /dev/hda6
        /bin/swapon  /dev/hda6
        /bin/mkswap  /dev/hda3
        /bin/swapon  /dev/hda3

        log "Tuning hda5"
        /bin/tune2fs -c -1 -i0 /dev/hda5 || failed "tune2fs hda5"

        makedrive hda4 /drive0

        if [ "$DRIVE1" != "" ]; then
                log "partitioning second drive"
                init_drive /dev/$DRIVE1 || failed "init $DRIVE1"
                DRIVE1="${DRIVE1}4"
                makedrive $DRIVE1 /drive1 || failed "init $DRIVE1"
        fi

        /bin/swapoff /dev/hda3
        log "Zeroing hda3"
        /bin/cat /dev/zero > /dev/hda3

        /bin/swapoff /dev/hda6
        log 'Done!  Testing disk..'

        /sbin/hdstress
fi

exec /bin/bash --login


Attachments
init (494 downloads)
Description: The new bigdisk_builder script. This is really the only important thing that's special about a builder image.