Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: qopit on May 22, 2012, 02:14:04 PM

Title: Identifying which mount holds a frugal instal
Post by: qopit on May 22, 2012, 02:14:04 PM
Is there a clean way to quickly/automatically determine which mount holds the frugal install?

To explain: I'm running Core within a VM, and the Core files normally exist under /mnt/sda1/tce.  However, when I add a few extra drives to the system, Core is now mounting the "main" drive as /mnt/sdc1 instead, which is breaking a few scripts that were hard linked to /mnt/sda1 paths.  I never did like my hard paths for exactly this reason, and now I'm bitten by it.  What I'm doing now is trying to set up bootlocal.sh to figure out which mount is the right one.  A crude script for prowling the mounts and looking for a certain signature (eg: existence of tce/boot off the root) works well enough, but is too klugey.

I figure there must be a quick way to identify the location of the kernel file (vmlinuz) in extlinux (or grub or whatever), or something along that lines, but can't find it.
Title: Re: Identifying which mount holds a frugal instal
Post by: qopit on May 22, 2012, 02:22:54 PM
Ok - using fdisk -l to get the boot device seems to work...

Code: [Select]
BOOT_MNT=`fdisk -l | grep /dev/.*[*] | cut -f 1 -d " " | sed "s|dev|mnt|"`
not sure how robust that is yet.  The grep is dicy with matching any asterisk after a /dev, not that I know of anything that would violate that.
Title: Re: Identifying which mount holds a frugal instal
Post by: gerald_clark on May 22, 2012, 03:00:35 PM
readlink /etc/sysconfig/tcedir
Title: Re: Identifying which mount holds a frugal instal
Post by: curaga on May 22, 2012, 03:11:42 PM
Quote
I figure there must be a quick way to identify the location of the kernel file (vmlinuz) in extlinux (or grub or whatever), or something along that lines, but can't find it.

Yep, no such thing. This is why it's recommended to use UUID or LABEL to detect drives.
Title: Re: Identifying which mount holds a frugal instal
Post by: qopit on May 22, 2012, 03:13:01 PM
readlink /etc/sysconfig/tcedir

Ahh... much cleaner.  Thank you!  I should have thought of how the system identifies the extension dir.
Title: Re: Identifying which mount holds a frugal instal
Post by: qopit on May 22, 2012, 03:31:16 PM
Ouch.  I went on an expedition to figure out how Core figures out what to link /etc/sysconfig/tcedir to behind the scenes (it is done in /usr/bin/tce-setdrive)... but now I have a headache.  There is some serious shell scripting wizardry in these Core scripts.

In short: Core rocks.  I just wish I could follow it better!!
Title: Re: Identifying which mount holds a frugal instal
Post by: curaga on May 23, 2012, 07:30:15 AM
Given a lack of tce= bootcode, it's a simple loop of all drives checking for /tce.