#!/bin/bash
case $1 in make)
mkinitrd -v initrd.img `uname -r` --force-scsi-probe $(cat mkinitrd.opts ) ;;
extract) rm -rf iscsi.initrd initrd.img.gz
cp initrd.img initrd.img.gz file initrd.img.gz gunzip initrd.img.gz file initrd.img
mkdir iscsi.initrd cd iscsi.initrd
cpio -i --make-directories < ../initrd.img
;;
build) cd iscsi.initrd which ip lspci dhclient mknod fdisk bash cat chroot echo ifconfig insmod iscsistart mount sleep | xargs -i{} cp {} bin/
pushd bin for cmd in ip lspci dhclient fdisk bash cat chroot echo ifconfig insmod iscsistart mount sleep ; do ldd $cmd | while read fn extra ; do if [ -f $fn ] ; then cp $fn ../lib elif [ -f /lib/$fn ] ; then cp /lib/$fn ../lib else echo $fn ; fi done done popd ;;
publish) find ./ | cpio -H newc -o > ../iscsi.initrd.img
cd .. gzip -9 initrd.cpio mv initrd.cpio.gz $path/initrd.img1 ;; esac |