Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #Update Zeroshell initrd.gz
- #30th May 2012
- #This code was written using :
- #http://edwidianto.wordpress.com/2010/06/04/instalasi-dan-update-zeroshell-1-0-beta12-retro/#
- #
- show_error() {
- echo"$1"
- exit
- }
- INITRD_TARGET_DIR=/mnt/initrd
- LOOP_MOD='loop.ko'
- LOOP_TARGET_DIR=/lib
- SATA_CHIP_MOD='sata_inic162x.ko sata_mv.ko sata_nv.ko sata_promise.ko sata_qstor.ko sata_sil24.ko sata_sil.ko sata_sis.ko sata_svw.ko sata_sx4.ko sata_uli.ko sata_via.ko sata_vsc.ko'
- SATA_CHIP_TARGET_DIR=/lib/sata/chipsets
- SATA_DEPS_MOD='libata.ko pata_sis.ko'
- SATA_DEPS_TARGET_DIR=/lib/sata/deps
- USB_HOST_MOD='ehci-hcd.ko isp116x-hcd.ko ohci-hcd.ko r8a66597-hcd.ko sl811-hcd.ko u132-hcd.ko uhci-hcd.ko'
- USB_HOST_TARGET_DIR=lib/usb/host
- USB_STORAGE_MOD='sr_mod.ko usb-storage.ko'
- USB_STORAGE_TARGET_DIR=/lib/usb/storage
- USB_DEPS_MOD='ftdi-elan.ko ssb.ko'
- USB_DEPS_TARGET_DIR=/lib/usb/deps
- echo "various module names and their target directories stored ..for future copy to target dirs in the initrd image..";#sleep 10
- #Mount initrd.gz
- cp ./initrd.gz /tmp/
- gzip -d /tmp/initrd.gz
- #Check if already mounted
- mount | grep -qe "$INITRD_TARGET_DIR" && umount $INITRD_TARGET_DIR
- mount /tmp/initrd -o loop $INITRD_TARGET_DIR
- #Copy to target
- copy_target() {
- for file in $1; do
- SRC_MOD="`find /lib/modules/2.6.39.4/ -type f -iname $file`"
- if [ "$SRC_MOD" == "" ];then
- echo "Warning: $file doesn't exist."
- continue # just give a warning
- else
- echo "$SRC_MOD FOUND";
- cp -af $SRC_MOD $INITRD_TARGET_DIR/$2
- fi
- done
- }
- echo "Copying loop modules..." ;#sleep 10
- copy_target $LOOP_MOD $LOOP_TARGET_DIR
- echo
- echo "Copying sata_chip modules..."
- copy_target "$SATA_CHIP_MOD" $SATA_CHIP_TARGET_DIR
- "Copying sata_deps modules..."
- copy_target "$SATA_DEPS_MOD" $SATA_DEPS_TARGET_DIR
- echo
- echo "Copying usb_host modules..."
- copy_target "$USB_HOST_MOD" $USB_HOST_TARGET_DIR
- echo "Copying usb_storage modules..."
- copy_target "$USB_STORAGE_MOD" $USB_STORAGE_TARGET_DIR
- echo "Copying usb_deps modules..."
- copy_target "$USB_DEPS_MOD" $USB_DEPS_TARGET_DIR
- #Umount initrd & create initrd.gz
- mount | grep -qe "$INITRD_TARGET_DIR" && umount $INITRD_TARGET_DIR
- echo "unmounted $INITRD_TARGET_DIR" ;
- gzip /tmp/initrd #compress it
- cp -f /tmp/initrd.gz ./
- echo "Done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement