#!/bin/sh
# Root DISK1
export DISK1=/mnt/HD_a2
# Second disk
export DISK2=/mnt/HD_b2
export PATH=$PATH:$DISK1/lnx_bin:
cd $DISK1
# Check for lnx_bin - updated busybox - from KRH
if [ ! -d lnx_bin ]
then
exit 0
fi
# Start Telnet - from KRH
if [ -f starttelnet.sh ]
then
./starttelnet.sh
fi
# Unpack etch base if it exists
if [ ! -d etch ]
then
if [ -f etch.tar ]
then
busybox3 tar -xf etch.tar
else
exit 0
fi
fi
# Bind mount disk1
mkdir etch/$DISK1
mount --bind $DISK1 etch/$DISK1
# Bind mount disk2
mkdir etch/$DISK2
mount --bind $DISK2 etch/$DISK2
# Bind mount rootfs
mkdir etch/mnt/root
mount --bind / etch/mnt/root
# Bind mount etch/dev
mkdir etch/dev
mount --bind /dev etch/dev
# Bind mount etch/sys
mkdir etch/sys
mkdir etch/sys/crfs
mount --bind /sys etch/sys
mount --bind /sys/crfs etch/sys/crfs
# Bind mount etch/web
mkdir etch/web
mount --bind /web etch/web
# Bind mount etch/proc
mkdir etch/proc
mount --bind /proc etch/proc
#
# Mounts
cp -f /proc/mounts etch/etc/mtab
busybox3 rm -f etch/etc/fstab
busybox3 touch etch/etc/fstab
# Copy resolv.conf
busybox3 cp -f /etc/resolv.conf etch/etc
# Set hostname to disk
busybox3 hostname disk
busybox3 hostname >etch/etc/hostname
# Copy hosts
busybox3 cp -f /etc/hosts etch/etc
busybox3 chroot $DISK1/etch ./linuxrc