Tiny Core Linux
Tiny Core Base => TCB Talk => Topic started by: littlebat on December 17, 2011, 03:32:26 AM
-
I try to customize file "/usr/sbin/rebuildfstab" and add "mount -a" into "/opt/bootlocal.sh" to mount all mountable device automatically. So, I changed 'OPTIONS="noauto,users,exec"' to 'OPTIONS="users,exec"'. But, when test the customized tinycore on an ASUS P5QL PRO motherboard machine, it stop booting because no floppy device or no media in a MARVELL PATA COMBO R/W DVD.
I found a way to only mount those device can be determined its file system by "blkid"(/usr/sbin/fstype). I added some code into /usr/sbin/rebuildfstab as below:
DEVNAME=`echo "$i" | awk 'BEGIN{FS="/"}{print $(NF-1)}'`
DEVMAJOR="$(cat $i|cut -f1 -d:)"
# Check file system for auto mounting
FSTYPE="$(fstype "/dev/$DEVNAME")"
if [ -z "$FSTYPE" ]; then
OPTIONS="noauto,users,exec"
else
OPTIONS="users,exec"
fi
Is there a better way to do this job? Is there any problem in my code?
Thanks.
-
You can use udev. Search Forum, it was discussed.
-
I just searched for "udev" and was surprised to find only one hit, this thread.
:-\
Not believing the search results I tried a second time, Voila!! so many hits this time round, now to find the one where ths topic has been discussed before..
-
Hi coreplayer2
Try changing the By user field on the search page from * to gutmensch when searching for udev.
I seem to remember he provided an in depth discussion on the subject somewhere.
-
Not sure if this thread was the one referred too http://forum.tinycorelinux.net/index.php/topic,9037.msg49256.html#msg49256 (http://forum.tinycorelinux.net/index.php/topic,9037.msg49256.html#msg49256)
Thanks Rich, wait USER field? that must be an advanced feature or something maybe from the menu...?
However Just realized the issue here, searches from the quick search field above (top right) are not global, ie the quick search only searches the current thread, to search the whole forum db one has to search from the home page or possibly use the search menu
;)
-
Hi coreplayer2
Yes, that was the main one, there might have been others.
Thanks Rich, wait USER field? that must be an advanced feature or something maybe from the menu...?
Look at the top of the page where it says Home Help Search Moderate ..... and click on search.
-
I've always assumed that the quick search (top right) searches the entire db, only today realized it's searches are relative to the current thread only..
Got it now thanks
-
Your code is fine.
-
Your code is fine.
I test the code again, when the floppy device doesn't exist, "fstype /dev/fd0" will still cause system stop booting. So, I changed the code as below:
[ -s "$CDROMSF" ] && read CDROMS < "$CDROMSF"
# Delete invalid fstab entries and mount point, force to umount invalid mounting
# Borrowed idea for CDlinux (http://www.cdlinux.info/ (http://www.cdlinux.info/))
for fstabitems in `grep "$ADDEDBY" /etc/fstab | awk '{print $1"$"$2}'`; do
FSTABDEV=`echo $fstabitems | cut -d '$' -f1`
FSTABDIR=`echo $fstabitems | cut -d '$' -f2`
[ -e $FSTABDEV ] || {
sed -i "\@^$FSTABDEV @d" /etc/fstab
/bin/umount -f $FSTABDIR >/dev/null 2>&1
rmdir $FSTABDIR
}
done
grep -v "$ADDEDBY" /etc/fstab > "$TMP"
DEVNAME=`echo "$i" | awk 'BEGIN{FS="/"}{print $(NF-1)}'`
DEVMAJOR="$(cat $i|cut -f1 -d:)"
# Check file system for auto mounting
FSTYPE=""
[ "$DEVMAJOR" != 2 ] && FSTYPE="$(fstype "/dev/$DEVNAME")"
if [ -z "$FSTYPE" ]; then
OPTIONS="noauto,users,exec"
else
OPTIONS="users,exec"
fi
# If another copy tried to run while we were running, rescan.
if [ -e /var/run/rebuildfstab.rescan ]; then
rm -f /var/run/rebuildfstab.rescan
exec $0 "$@"
fi
# Mount all mountable devices
/bin/mount -a >/dev/null 2>&1
This can work well on usb disk. But it can't mount a cdrom disc automatically when insert it into cdrom driver, it seems udev rules can't deal with the events about cdrom disc inserting or ejecting.
-
Why would fstype /dev/fd0 be called if the device doesn't exist? Do you have a funny bios?
-
Why would fstype /dev/fd0 be called if the device doesn't exist? Do you have a funny bios?
Maybe, an ASUS P5QL PRO motherboard machine, has a floppy slot but has no a floppy driver connected. Maybe its BIOS don't disable floppy. I will confirm it next week.
-
Yes, the floppy option doesn't be disabled in BIOS while the floppy driver doesn't exist.