Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cat <<EOF > /etc/init.d/reinit
- #!/bin/sh
- # Copyright (c) 2011 Bios Syna
- # All rights reserved.
- #
- # Author: Bios Syna, 2011
- # email: synapse@videobank.it
- # change this to your boot device
- boot_dev="/dev/sda2"
- # change this to your root directory
- root_dir="/mnt/rom"
- # change this to your module path
- mod_path="/lib/modules/2.6.35.9/"
- for module in scsi_mod sd_mod nls_base usbcore usb-storage ehci-hcd uhci-hcd ohci-hcd jbd ext3 ; do
- insmod $mod_path$module".ko"
- done
- # this may need to be higher if your disk is slow to initialize
- sleep 5
- mount $boot_dev $root_dir
- if ! [ -d $root_dir ]; then mkdir $root_dir ; fi
- if ! [ -d $boot_dev$root_dir ]; then mkdir $boot_dev$root_dir ; fi
- # if everything looks ok, do the pivot root
- if [ -f $root_dir/sbin/init ];
- then
- mount -o move /proc $root_dir/proc
- mount -o move /dev $root_dir/dev
- mount -o move /sys $root_dir/sys
- pivot_root . $root_dir
- kill -QUIT 1
- else
- # Is something go wrong unload Kernel Module
- for module in scsi_mod sd_mod nls_base usbcore usb-storage ehci-hcd uhci-hcd ohci-hcd jbd ext3 ; do
- rmmod $mod_path$module".ko"
- done
- fi
- EOF
- chmod +x /etc/init.d/reinit
- ln -s /etc/init.d/reinit /etc/etc/rc.d/S10reinit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement