Web lists-archives.com

Re: A "Where am I" routine

On Fri, Jul 06, 2018 at 06:25:43AM -0500, Richard Owlett wrote:
> I multi-boot several configurations &/or releases of Debian.
> I will run identical test scripts on each.
> I want to store the results in a common logging file.
> I can set up an appropriate environment with a custom fstab containing:
> >
> > # create a common area
> > LABEL=owlcommon /home/richard/Documents/tst_common vfat user,rw,umask=000 0 0
> > # a dummy mount labeled to show which instance
> > LABEL=dummy /home/richard/Documents/where/sda14 ext4 user,ro 0 0
> >
> >
> The first statement gives me a directory usable by all.
> The second tells me where I am by using:
>    ls /home/richard/Documents/where
> in any test script.

Facing a similar problem of several distributions on one machine I
took a different approach.
I use a separate partition for data '/mc' accessable from all
This little script tells me where I'm running from:

#   /mc/bin/set_dist    set the variable DIST   071512  Mc
#   source this file and DIST will transfer to the calling file

#   which distribution (based on partition label)
if [ $(grep -c UUID /proc/cmdline) -gt 0 ]; then
    bid=$(cut -d'=' -f4 /proc/cmdline | cut -d' ' -f1);
    rline=$(blkid | grep $bid) ;
    unset bid rline rstr;
    DIST=$( e2label $(mount | grep " / " | cut -d" " -f1 ) );

The various partitions are labeled for the Debian version.

This may or may not help you but works for me.

Have fun,
"Beauty without grace is a hook without a bait."
    - Ninon de Lenclos