Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
866
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. # email: synapse@videobank.it
  8.  
  9. # change this to your boot device
  10. boot_dev="/dev/sda2"
  11. # change this to your root directory
  12. root_dir="/mnt/rom"
  13. # change this to your module path
  14. mod_path="/lib/modules/2.6.35.9/"
  15.  
  16. for module in scsi_mod sd_mod nls_base usbcore usb-storage ehci-hcd uhci-hcd ohci-hcd jbd ext3 ; do
  17. insmod $mod_path$module".ko"
  18. done
  19.  
  20. # this may need to be higher if your disk is slow to initialize
  21. sleep 5
  22. mount $boot_dev $root_dir
  23. if ! [ -d $root_dir ]; then mkdir $root_dir ; fi
  24. if ! [ -d $boot_dev$root_dir ]; then mkdir $boot_dev$root_dir ; fi
  25.  
  26. # if everything looks ok, do the pivot root
  27. if [ -f $root_dir/sbin/init ];
  28. then
  29. mount -o move /proc $root_dir/proc
  30. mount -o move /dev $root_dir/dev
  31. mount -o move /sys $root_dir/sys
  32. cd $root_dir
  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