So long story short, I have a live CD remaster that can either be running off CD (/dev/srX) or USB stick (/dev/sdX). My application is embedded in the initrd, but I have large files on the device that my application reads off of; therefore, I need to access it. For ease of access, I simply symlink a directory in /opt/dirlink that points to the device folder I need access to. Currently, in my bootlocal.sh, I have:
if grep -qs '/mnt/sr0' /proc/mounts; then
ln -s /mnt/sr0/dir /opt/dirlink
elif grep -qs '/mnt/sdb' /proc/mounts; then
ln -s /mnt/sdb/dir /opt/dirlink
else
...
fi
Problem with this is the mount points can change depending on the hardware (i.e. user may have no HDD in the system so it'd be sda instead or user may be using an external DVD device so sr0 may not even exist). So what is the best foolproof way to do this? If I can detect what the device the user is booting from (does TC have knowledge of this in one of its hooks?), it'd be a lot easier.