GetPupSave 3.0 Pet

Miscellaneous tools
Post Reply
Message
Author
User avatar
johnywhy
Posts: 879
Joined: Sat 20 Aug 2011, 14:52

GetPupSave 3.0 Pet

#1 Post by johnywhy »

What is it? this pet is a command which returns the partition, file-system, and path to your active PupSave file or folder.

Why use it? it's handy if you multiboot several frugal puppies, and you forgot which one you are booted into :P. the advantage of the getpupsave command is that it's a command-- more convenient than remembering and manually digging into system files.

requirements tested only on xSlacko so far.

you use it like this:

Code: Select all

# getpupsave
sample output:

Code: Select all

# getpupsave
PUPSAVE='sda1,ext2,/xSlacko/slackosave-My'
#
enjoy :)


Technical details

puppiness quotient: 1 line of code.

this pet puts a file in your bin containing the following script:

Code: Select all

#!/bin/bash
# read PUPSAVE value from file /etc/rc.d/PUPSTATE
cat /etc/rc.d/PUPSTATE | grep PUPSAVE
3.0 has been changed to safer code. Code base has been reduced by 50% -- from 2 lines to 1 line :wink:
Attachments
getpupsave-3.0.pet
(364 Bytes) Downloaded 221 times
Last edited by johnywhy on Thu 14 May 2015, 07:58, edited 12 times in total.

User avatar
nilsonmorales
Posts: 972
Joined: Fri 15 Apr 2011, 14:39
Location: El Salvador

#2 Post by nilsonmorales »

Nice job johnywhy
You're becoming a hacker :D
nice nice, congrat
[b][url=http://nilsonmorales.blogspot.com/]My blog |[/url][/b][b][url=https://github.com/woofshahenzup]| Github[/url][/b]
[img]https://i.postimg.cc/5tz5vrrX/imag018la6.gif[/img]
[img]http://s5.postimg.org/7h2fid8pz/botones_logos3.png[/img]

User avatar
johnywhy
Posts: 879
Joined: Sat 20 Aug 2011, 14:52

#3 Post by johnywhy »

thx Nilson!

i thought it might be cool if i attach the actual pet file :/

see OP
[b]Now[/b]: X-Tahr 2.0! StretchDog! DevuanDog!
[b]Tops[/b]: TarhNOP Vlina-R2 Racy
[b]Used[/b]: Puppeee Precise Lucid Wary Tahrpup Quirky Slacko MacPup Saluki Puppy Studio LxPupTarh Lina-Lite Lina
[i]i ♥ Puppy[/i]

User avatar
johnywhy
Posts: 879
Joined: Sat 20 Aug 2011, 14:52

#4 Post by johnywhy »

Version 3.0 released, changed to safer, shorter code:

Code: Select all

cat /etc/rc.d/PUPSTATE | grep PUPSAVE
pet in op
[b]Now[/b]: X-Tahr 2.0! StretchDog! DevuanDog!
[b]Tops[/b]: TarhNOP Vlina-R2 Racy
[b]Used[/b]: Puppeee Precise Lucid Wary Tahrpup Quirky Slacko MacPup Saluki Puppy Studio LxPupTarh Lina-Lite Lina
[i]i ♥ Puppy[/i]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#5 Post by musher0 »

Hello, johnywhy.

And it is important to do this because... ? (In other words: I'm a sceptic.) :)
There's already all sorts of info concerning the Puppy at
/etc/DISTRO_SPECS and at
/initrd/tmp/PUPSAVES

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
johnywhy
Posts: 879
Joined: Sat 20 Aug 2011, 14:52

#6 Post by johnywhy »

musher0 wrote: I'm a sceptic.) :)
There's already all sorts of info concerning the Puppy at
/etc/DISTRO_SPECS and at
/initrd/tmp/PUPSAVES
thx for pointers!

the purpose of my getpupsave command is that it's a command-- more convenient than remembering and manually digging into system files.

your suggestion, /etc/DISTRO_SPECS, does not contain the pupsave path. it contains:
#for the partition, path and actual files loaded, see PUPSFS and ZDRV in /etc/rc.d/PUPSTATE
so, it is is telling me i'm looking in the right place: /etc/rc.d/PUPSTATE

your suggestion, /initrd/tmp, is a temp directory, and i've always been taught to be skeptical about the contents of a temp directory-- it's a scrap dir, a throwaway dir, not a reliable source of system data.

so, i feel confident using /etc/rc.d/PUPSTATE. G agrees:
http://murga-linux.com/puppy/viewtopic. ... 608#844608

thx!

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#7 Post by musher0 »

Hi, johnywhy.

Yes, /etc/rc.d/PUPSTATE is a good source of info in this case.

Beware, though: not all temp files contain junk. Some temp files contain
very important information, some transient information for a particular
script or operation -- sometimes, but also some important info your entire
Puppy session.

Look in your /tmp directory and you'll find many temp files for Internet or
wifi connection, or for mounted partitions (usb and hard drives), for
example. They are temporary files, but you need them, they're not junk.

The same is true for the files at /initrd/tmp/. They contain usual
information about your Puppy and your partitions, among other things.

In console, type

Code: Select all

cd /initrd/tmp
more *
and see for yourself.

BFN

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
johnywhy
Posts: 879
Joined: Sat 20 Aug 2011, 14:52

#8 Post by johnywhy »

musher0 wrote:Beware, though: not all temp files contain junk. Some temp files contain
very important information
For sure, i understand that they are important. But they are transient, and serve specific applications. they are not intended for general use. There's no guarantee they will exist tomorrow, there's no guarantees they will be up-to-date. They are created as transient resources for specific apps, so i don't think it would be a save idea to use Temp dirs for any process that needs to be reliable. Temp files are not meant for that.

thx!
[b]Now[/b]: X-Tahr 2.0! StretchDog! DevuanDog!
[b]Tops[/b]: TarhNOP Vlina-R2 Racy
[b]Used[/b]: Puppeee Precise Lucid Wary Tahrpup Quirky Slacko MacPup Saluki Puppy Studio LxPupTarh Lina-Lite Lina
[i]i ♥ Puppy[/i]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#9 Post by musher0 »

johnywhy wrote:
musher0 wrote:Beware, though: not all temp files contain junk. Some temp files contain
very important information
(...) They are created as transient resources for specific apps, so i don't think it would be a save idea to use Temp dirs for any process that needs to be reliable. Temp files are not meant for that.

thx!
Hi, johnywhy.

I beg to differ. In addition to the folders that I mentioned earlier, /var is
full of temporary files that are quite reliable... But I don't want to get into
a verbal fight with you! Like the apprentice sorcerer who doesn't want to
believe what the master sorcerer is telling him ;), you'll have to discover
the true nature and usefulness of temporary files by yourself!!!

Now, for the purpose of education, please find, make a note of and then
delete ALL the temporary files on your Linux system, one after the other,
very methodically, and see what happens!!! :twisted: I guarantee you a
very reliable crash before you're finished!!! :lol:

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
johnywhy
Posts: 879
Joined: Sat 20 Aug 2011, 14:52

#10 Post by johnywhy »

master :P

you clearly have experience and knowledge, and i value that.

i don't want to have an argument either. but i value intellectual debate, or at least different perspectives. i appreciate your opinions -- you make me think.

i understand temp files can be very important. i did not say they are not important. yes, i agree with you, i think you're correct.

just saying that the owners of files in temp directories may do whatever they want to those files. Apps have no "contract" to fulfill any user expectations about files in temp. A new version of some app might have different temp files than the last version. Therefor, as a programmer, i would be inclined not to depend on them. Safer to use non-temp files -- just my opinion.
musher0 wrote:And it is important to do this [pet] because... ? (In other words: I'm a sceptic.) :)
i'm glad you're a skeptic! skeptics help me do things that are useful and sensible. mainly, i do what's useful and sensible for me, and if someone else finds it useful, great! if not, don't matter 8)

My theory is, if i make something because i need or want it, then it's more likely that someone else will also want it.

quoting my OP-
it's handy if you multiboot several frugal puppies, and you forgot which one you are booted into. the advantage of the getpupsave command is that it's a command-- more convenient than remembering and manually digging into system files.
You might not need it, but for me it's very helpful. Lately i've been multibooting like 10 different OS's, and sometimes forget which one i was booted into :oops:

cheers!
[b]Now[/b]: X-Tahr 2.0! StretchDog! DevuanDog!
[b]Tops[/b]: TarhNOP Vlina-R2 Racy
[b]Used[/b]: Puppeee Precise Lucid Wary Tahrpup Quirky Slacko MacPup Saluki Puppy Studio LxPupTarh Lina-Lite Lina
[i]i ♥ Puppy[/i]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#11 Post by musher0 »

Hello, apprentice ;)

Indeed, if you have 2 or 3 pupsave files, this little script can be useful
to refresh your memory.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply