Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/busybox sh
- die() {
- echo "$@"
- exit 1;
- }
- # Make sure busybox links are installed
- /bin/busybox --install
- export PATH=/bin:/usr/bin
- # Create standard fhs layout, in case any were missing
- for dname in bin boot dev dev/pts etc mnt mnt_data mnt_sysimg opt proc root sys tmp usr var var/lock var/log var/run var/tmp; do
- mkdir -p $dname;
- done
- chmod 01777 /tmp
- chmod 01777 /var/tmp
- # set up basic disk-independent mounts
- mount -t proc -o noatime proc /proc || die "Failed to mount /proc"
- mount -t sysfs -o noatime sysfs /sys || die "Failed to mount /sys"
- # enable magic sysrq key
- echo "1" >/proc/sys/kernel/sysrq || echo "Failed to enable magic sysrq key"
- # start up mdev, for automatic device node creation
- mount -t devpts devpts /dev/pts || exit 1
- echo /bin/mdev > /proc/sys/kernel/hotplug || exit 1
- mdev -s || die "Failed to run mdev -s" # populate initial nodes
- # set up some basic networking settings
- ifconfig lo 127.0.0.0
- route add -net 127.0.0.0/8 lo
- ifconfig eth0 192.168.10.5
- route add -net 0.0.0.0 gw 192.168.10.1
- # check for forced rescue mode
- if grep rescue /proc/cmdline >/dev/null; then
- die "[Rescue mode requested; deliberately failing startup script."]
- fi
- # find the system partition
- for devname in hda hdb hdc sda sdb sdc sdd; do
- if mount -r /dev/${devname}2 /mnt_sysimg -o noatime,async; then
- [[ -f /mnt_sysimg/system.partition.tag ]] && break
- umount /mnt_sysimg
- fi
- done
- [[ -f /mnt_sysimg/system.partition.tag ]] || die "Failed to find system partition!";
- # Now merge the system with tmpfs
- mount -t unionfs -o dirs=/fhs=rw:/mnt_sysimg/fhs=ro none /union || die "Failed to set up unionfs";
- # assume the data partition is right next to it
- mount /dev/${devname}3 /mnt_data -o noatime || die "Failed to find data partition!";
- # run any additional persistent fixups we've added (meant to be temporary)
- [[ -x /mnt_data/initialize-extras ]] && { /mnt_data/initialize-extras || exit 1; };
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement