#!/bin/sh # # 1) set hostname # 2) fill in the IP address of the box and the default route # 3) disable/change software raid settings # export PATH=/sbin:/bin:/usr/sbin:/usr/bin # mount stuff /bin/mount -n -t proc none /proc /bin/mount -n -t sysfs none /sys /bin/mount -n -t devpts none /dev/pts -o gid=5,mode=620 /bin/mount -n -t tmpfs none /dev/shm CMDLINE=`cat /proc/cmdline` # mount root RW /bin/mount -n -o remount,defaults,rw / # rm old boot file /bin/rm -f /tmp/READY_TO_BOOT # set hostname /sbin/hostname HOSTNAME # network /sbin/ifconfig eth0 X.X.X.X netmask Y.Y.Y.Y. broadcast Z.Z.Z.Z #/sbin/route add -host A.A.A.A gw B.B.B.B /sbin/route add default gw B.B.B.B # assemble raid /sbin/mdadm -Ac partitions -m 0 /dev/md_d0 --auto=part10 # ssh /usr/sbin/sshd >/dev/null 2>&1 # wait for real root to become ready while [ 1 ]; do if [ ! -f /tmp/READY_TO_BOOT ]; then echo "waiting for root file system to become ready, sleeping 30 seconds" sleep 30 else echo "ready" break fi done # kill ssh killall -9 sshd killall -9 /usr/sbin/sshd sleep 1 # umount umount -n /dev/shm umount -n /proc umount -n /sys umount -n /dev/pts # mount new_root mount -n /dev/mapper/root /new_root # pivot root cd /new_root mkdir old_root pivot_root . old_root # start init on new_root exec chroot . /bin/sh <<- EOF >/dev/console 2>&1 umount old_root exec /sbin/init ${CMDLINE} EOF