Guest User

Untitled

a guest
Jul 21st, 2017
871
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. cat <<EOF > /etc/init.d/reinit
  2. #!/bin/sh
  3. # Copyright (c) 2011 Bios Syna
  4. # All rights reserved.
  5. #
  6. # Author: Bios Syna, 2011
  7.  
  8. # change this to your boot device
  9. boot_dev="/dev/sda2"
  10. # change this to your root directory
  11. root_dir="/mnt/rom"
  12. # change this to your module path
  13. mod_path="/lib/modules/2.6.35.9/"
  14.  
  15. for module in scsi_mod sd_mod nls_base usbcore usb-storage ehci-hcd uhci-hcd ohci-hcd jbd ext3 ; do
  16. insmod $mod_path$module".ko"
  17. done
  18.  
  19. # this may need to be higher if your disk is slow to initialize
  20. sleep 5
  21. mount $boot_dev $root_dir
  22. if ! [ -d $root_dir ]; then mkdir $root_dir ; fi
  23. if ! [ -d $boot_dev$root_dir ]; then mkdir $boot_dev$root_dir ; fi
  24.  
  25. # if everything looks ok, do the pivot root
  26. if [ -f $root_dir/sbin/init ];
  27. then
  28. mount -o move /proc $root_dir/proc
  29. mount -o move /dev $root_dir/dev
  30. mount -o move /sys $root_dir/sys
  31. cd $root_dir
  32. pivot_root . $root_dir
  33. kill -QUIT 1
  34. else
  35. # Is something go wrong unload Kernel Module
  36. for module in scsi_mod sd_mod nls_base usbcore usb-storage ehci-hcd uhci-hcd ohci-hcd jbd ext3 ; do
  37. rmmod $mod_path$module".ko"
  38. done
  39. fi
  40. EOF
  41.  
  42. chmod +x /etc/init.d/reinit
  43. ln -s /etc/init.d/reinit /etc/etc/rc.d/S10reinit
Advertisement
Add Comment
Please, Sign In to add comment