Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. #! /bin/busybox sh
  2.  
  3. die() {
  4. echo "$@"
  5. exit 1;
  6. }
  7.  
  8. # Make sure busybox links are installed
  9. /bin/busybox --install
  10.  
  11. export PATH=/bin:/usr/bin
  12.  
  13. # Create standard fhs layout, in case any were missing
  14. 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
  15. mkdir -p $dname;
  16. done
  17. chmod 01777 /tmp
  18. chmod 01777 /var/tmp
  19.  
  20. # set up basic disk-independent mounts
  21. mount -t proc -o noatime proc /proc || die "Failed to mount /proc"
  22. mount -t sysfs -o noatime sysfs /sys || die "Failed to mount /sys"
  23.  
  24. # enable magic sysrq key
  25. echo "1" >/proc/sys/kernel/sysrq || echo "Failed to enable magic sysrq key"
  26.  
  27. # start up mdev, for automatic device node creation
  28. mount -t devpts devpts /dev/pts || exit 1
  29. echo /bin/mdev > /proc/sys/kernel/hotplug || exit 1
  30. mdev -s || die "Failed to run mdev -s" # populate initial nodes
  31.  
  32. # set up some basic networking settings
  33. ifconfig lo 127.0.0.0
  34. route add -net 127.0.0.0/8 lo
  35. ifconfig eth0 192.168.10.5
  36. route add -net 0.0.0.0 gw 192.168.10.1
  37.  
  38. # check for forced rescue mode
  39. if grep rescue /proc/cmdline >/dev/null; then
  40. die "[Rescue mode requested; deliberately failing startup script."]
  41. fi
  42.  
  43. # find the system partition
  44. for devname in hda hdb hdc sda sdb sdc sdd; do
  45. if mount -r /dev/${devname}2 /mnt_sysimg -o noatime,async; then
  46. [[ -f /mnt_sysimg/system.partition.tag ]] && break
  47. umount /mnt_sysimg
  48. fi
  49. done
  50. [[ -f /mnt_sysimg/system.partition.tag ]] || die "Failed to find system partition!";
  51.  
  52. # Now merge the system with tmpfs
  53. mount -t unionfs -o dirs=/fhs=rw:/mnt_sysimg/fhs=ro none /union || die "Failed to set up unionfs";
  54.  
  55. # assume the data partition is right next to it
  56. mount /dev/${devname}3 /mnt_data -o noatime || die "Failed to find data partition!";
  57.  
  58. # run any additional persistent fixups we've added (meant to be temporary)
  59. [[ -x /mnt_data/initialize-extras ]] && { /mnt_data/initialize-extras || exit 1; };
  60.  
  61. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement