jdtommy
04-13-2004, 06:15 PM
I add a peace of script to /etc/rcS.d/S00knoppix-autoconfig to search for a specific file on the rott of a partition. What is does is it mounts all possible partitions and then searches root for a file. When the file is found it will mount that partition as /mnt/hda1. It works, but there is 2 problems
1-after it goes through the process of searching the partitions it re-runs the auto config process again where it will re-search for devices and usb devices and configure them again.
2-I get an error every time it tries to mount a non existent partition. I have it forwarding the messages to /dev/null, and it does not get the messages when I test run just my code alone. But when it is run with the boot process it gets this message about 30 times:
modprobe: modprobe: Can't locate module block-major-34
here is the code I added:
# Locate Config File CONFPART.F
findconf(){
LOC=0
# search all partitions for a file in the root directory
for i in /mnt/tmp ; do
# See if it's already mounted
[ -f "$i/$1" ] && { echo "$i/$1"; return 0; }
if [ -d "$i" ] && mount -r "$i" 2>/dev/null; then
[ -f "$i/$1" ] && LOC=0
umount -l "$i" 2>/dev/null
[ -n "$LOC" ] && { echo "$LOC"; return 0; }
fi
done
}
searchdrv(){
DRIVES="/dev/[h-s]d[a-z][0-9]"
CONFDRV=""
LOC=0
for drv in $DRIVES ; do
if (mount $drv /mnt/tmp 2>/dev/null) ; then
LOC="$(findconf CONFPART.F)"
if test "$LOC"; then
CONFDRV=$drv
return 0
fi
umount /mnt/tmp
fi
done
return 0
}
.
.
.
.
.
mkdir /mnt/tmp
mkdir /mnt/hda1
searchdrv
echo Found CONFPART.F file in $CONFDRV
mount -rw $CONFDRV /mnt/hda1
let me know if anyone has an idea
1-after it goes through the process of searching the partitions it re-runs the auto config process again where it will re-search for devices and usb devices and configure them again.
2-I get an error every time it tries to mount a non existent partition. I have it forwarding the messages to /dev/null, and it does not get the messages when I test run just my code alone. But when it is run with the boot process it gets this message about 30 times:
modprobe: modprobe: Can't locate module block-major-34
here is the code I added:
# Locate Config File CONFPART.F
findconf(){
LOC=0
# search all partitions for a file in the root directory
for i in /mnt/tmp ; do
# See if it's already mounted
[ -f "$i/$1" ] && { echo "$i/$1"; return 0; }
if [ -d "$i" ] && mount -r "$i" 2>/dev/null; then
[ -f "$i/$1" ] && LOC=0
umount -l "$i" 2>/dev/null
[ -n "$LOC" ] && { echo "$LOC"; return 0; }
fi
done
}
searchdrv(){
DRIVES="/dev/[h-s]d[a-z][0-9]"
CONFDRV=""
LOC=0
for drv in $DRIVES ; do
if (mount $drv /mnt/tmp 2>/dev/null) ; then
LOC="$(findconf CONFPART.F)"
if test "$LOC"; then
CONFDRV=$drv
return 0
fi
umount /mnt/tmp
fi
done
return 0
}
.
.
.
.
.
mkdir /mnt/tmp
mkdir /mnt/hda1
searchdrv
echo Found CONFPART.F file in $CONFDRV
mount -rw $CONFDRV /mnt/hda1
let me know if anyone has an idea