Advertisement
Guest User

Untitled

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