summaryrefslogtreecommitdiffstats
path: root/rescue/tree/ka/make_initrd
diff options
context:
space:
mode:
Diffstat (limited to 'rescue/tree/ka/make_initrd')
-rwxr-xr-xrescue/tree/ka/make_initrd64
1 files changed, 42 insertions, 22 deletions
diff --git a/rescue/tree/ka/make_initrd b/rescue/tree/ka/make_initrd
index 84425d77c..d6f15a951 100755
--- a/rescue/tree/ka/make_initrd
+++ b/rescue/tree/ka/make_initrd
@@ -1,29 +1,49 @@
#!/bin/bash
echo Looking for default kernel
-IMG=`cat /etc/lilo.conf | grep default | cut -d "=" -f 2`
+CHROOT=/mnt/disk
+IMG=`cat $CHROOT/etc/lilo.conf | grep default | cut -d "=" -f 2`
KERN="x"
INITRD=""
LABEL="x"
-for i in `cat /etc/lilo.conf`; do
-if echo $i | grep image >/dev/null; then
- KERN=`echo $i | cut -d "=" -f 2`
-fi
-if echo $i | grep label >/dev/null; then
- LABEL=`echo $i | cut -d "=" -f 2`
-fi
-if echo $i | grep initrd >/dev/null; then
- INITRD=`echo $i | cut -d "=" -f 2`
-fi
-
-if [ ${LABEL} == ${IMG} ] && [ ! -z ${INITRD} ]; then
- echo "Kernel name is $KERN"
- echo "Initrd name is $INITRD"
- KERN_VERSION=`strings $KERN | grep "^2\.[2.4]"| cut -d " " -f 1`
- if [ -z $KERN_VERSION ]; then
- echo "No kernel version found !"
- read
+
+modprobe loop
+
+for i in `cat $CHROOT/etc/lilo.conf`; do
+
+ if echo $i | grep image >/dev/null; then
+ KERN=$CHROOT`echo $i | cut -d "=" -f 2`
+ INITRD=""
+ LABEL="x"
+
+ fi
+
+ if echo $i | grep label >/dev/null; then
+ LABEL=`echo $i | cut -d "=" -f 2`
+ fi
+
+ if echo $i | grep initrd >/dev/null; then
+ INITRD=`echo $i | cut -d "=" -f 2`
+ fi
+
+ if [ ${LABEL} == ${IMG} ] && [ ! -z ${INITRD} ]; then
+ echo "Kernel name is $KERN"
+ echo "Initrd name is $INITRD"
+ KERN_VERSION=`strings $KERN | grep "^2\.[2.4]"| cut -d " " -f 1`
+ if [ -z $KERN_VERSION ]; then
+ echo "No kernel version found !"
+ read
+ fi
+
+ chroot $CHROOT mount /proc
+ chroot $CHROOT MAKEDEV loop
+ chroot $CHROOT MAKEDEV fd
+ chroot $CHROOT MAKEDEV hd
+ chroot $CHROOT MAKEDEV sd
+ chroot $CHROOT MAKEDEV md
+ chroot $CHROOT MAKEDEV zero
+ chroot $CHROOT mkinitrd -f $INITRD $KERN_VERSION
+ chroot $CHROOT umount /proc
+
+ exit
fi
- echo Running mkinitrd -f $INITRD $KERN_VERSION
- exit
-fi
done