Page 1 of 1
Finding Puppy's boot file directory using bash (SOLVED)
Posted: Mon Jan 03, 2022 12:37 am
by wizard
Edit: changed the post subject from: What is Puppy's boot file location variable?
The object was to find the boot file directory, here is the code I used to do it. The find command looks for an exact file name with an exact file size, so it should be pretty accurate. If there's a better method, please post.
Code: Select all
#calculate file size in bites /1048576
finddir=$(find /mnt/home/ -type f -name "puppy_fossapup64_9.5.sfs" -size 487M)
echo "$finddir"
pupdir=$(dirname "$finddir")
echo "$pupdir"
Thanks
wizard
Re: What is Puppy's boot file location variable?
Posted: Mon Jan 03, 2022 11:44 pm
by Clarity
Not sure if this will help but environment variables are shown via this terminal command: 'printenv'
Some/Much of what you may want could be in a boot log.
Hope this is helpful.
Re: Finding Puppy's boot file directory using bash
Posted: Tue Jan 04, 2022 6:55 pm
by wizard
@Clarity
Good info to know, but didn't find any that pointed to the directory
Thanks
wizard
Re: Finding Puppy's boot file directory using bash
Posted: Wed Jan 05, 2022 1:17 am
by MochiMoppel
@wizard You can find the information you need in /etc/rc.d/PUPSTATE. Just source this file and use its variables. In my case $PSUBDIR holds the requested directory (may depend on your boot parameters). The variable $PUPSFS may be more suited, but you would need to extract the directory from it.
If $PSUBDIR is what you are looking for, then try
Code: Select all
source /etc/rc.d/PUPSTATE
pupdir="/mnt/home$PSUBDIR"
echo "$pupdir"
If you need the path for your main sfs file:
Code: Select all
source /etc/rc.d/PUPSTATE
pupfile="/mnt/home/${PUPSFS#*/}"
echo "$pupfile"
Re: Finding Puppy's boot file directory using bash
Posted: Wed Jan 05, 2022 2:19 am
by Clarity
Re: Finding Puppy's boot file directory using bash
Posted: Thu Jan 06, 2022 1:03 am
by wizard
@MochiMoppel
Used your code and works perfect. Much better than mine since it will never have to be edited for a change in file size.
Thanks
wizard