# Is This Fiol in the Puppy Linux RAM Disk?
Console-only script, no GUI. Works in Lucid Puppy Linux 5.2.8-004 and Lighthouse 64 Puppy 6.02 Beta 2.
by Apollia - http://apollia.com/
License: GNU Affero GPL 3.0
Version 1 completed Jan. 17, 2017 at 5:38 PM EST.
Version 2 completed June 21, 2017 at 4:18 AM EDT. No longer mistakenly
assumes mountpoint folders are in the Puppy Linux RAM disk.
The word "fiol" refers to something that is either a file or a folder.
The purpose of this script is to quickly tell you whether or not a fiol
you're inquiring about resides somewhere inside the Puppy Linux RAM disk.
(The fiol may also be a symlink, and/or its fiolpath may contain one or
Works in Lucid Puppy Linux 5.2.8 version 004:
And Lighthouse 64 Puppy Linux 6.02 Beta 2:
Haven't yet tried it in any other Puppy Linux.
Accepts only one argument - a fiolpath (filepath or folderpath) or fiolname
(filename or foldername).
If the fiol is found in the Puppy Linux RAM disk:
The script returns exit code 0, and prints to STDOUT either of the
following, depending on where the fiol was found:
If Argument 1 is empty:
If the "realpath" command doesn't work on the fiolpath:
If the fiol is not found in the Puppy Linux RAM disk:
The script returns an exit code other than 0, and prints to STDERR
whatever went wrong.
Exit Code Meanings
0 - The fiol was found in the Puppy Linux RAM disk.
1 - Argument 1 was empty.
2 - The "realpath" command somehow didn't work on the fiolpath (which might
mean no fiol exists at that fiolpath).
3 - The fiol definitely exists, but wasn't found in the Puppy Linux RAM disk.
4 - The fiol is a mountpoint folder, so isn't in the Puppy Linux RAM disk.
More details on how this script works
The precise location Argument 1 refers to will (hopefully) be discovered by
running "realpath" on Argument 1, which should result in a canonicalized,
symlinks-dereferenced, absolute fiolpathstring (known below as
REAL_FIOLPATHSTRING or REAL_FIOLPATH).
Then, two more new fiolpathstrings are made by prefixing the
REAL_FIOLPATHSTRING with these folderpaths:
Contains the original, unmodified versions of the
files in the Puppy Linux RAM disk.
Contains any new additions to (or modified version of) the
files in the Puppy Linux RAM disk.
If something exists at either /initrd/pup_ro2/[REAL_FIOLPATH] or
/initrd/pup_rw/[REAL_FIOLPATH], and that fiolpath isn't found to be a
mountpoint folder, the answer to the question
"Is This Fiol in the Puppy Linux RAM Disk?"
...is assumed to be yes. So, this script returns exit code 0, and announces
via STDOUT which of the above folders the fiol was found in first.
(pup_rw is checked first, then if nothing's there, pup_ro2 is checked).
If nothing is found in either pup_ro2 or pup_rw, the answer is assumed to be
no, so the script returns exit code 3 and announces the results via STDERR.
If the fiol is a mountpoint folder, the script returns exit code 4
announces the results via STDERR.
Under the GNU Affero General Public License v3.0.
Copyright (C) 2017 Apollia
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact info: http://astroblahhh.com/contact-apollia.shtml