savefile2dir 1.6 - Convert savefile to savefolder

Core libraries and systems
Message
Author
gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

savefile2dir 1.6 - Convert savefile to savefolder

#1 Post by gyro »

Edit:
There is now a savefile2dir-1.6.pet, specifically for older puppies whose savefile contains "/dev/null". It uses "tar" to copy the files, not "cp".
Please see the post on the next page announcing this.
There is no sfs file for this version.

Edit:
There is now a savefile2dir-1.5.pet, specifically for older puppies where "df" does not support the "--output=" option.
Please see the post on the next page announcing this.
There is no sfs file for this version.

Edit:
Please see post below announcing savefile2dir 1.4.
This is now the preferred version.

Edit:
Please see post below announcing savefile2dir 1.3.
Version 1.1 has been withdrawn, please use either 'savefile2dir-1.3.pet' or 'savefile2dir-1.3.sfs.gz', below.

The attached pet installs a console script 'savefile2dir'.
This script converts a savefile into a savefolder.
It is useful when you have a puppy that supports the savefolder facility, but you already have a savefile containing lots of stuff you don't want to just throw away.

When the script is executed on an unmounted savefile, it does the following:
1) Checks that the savefile meets the criteria for a savefolder.
2) Does an fsck of the savefile, to ensure it's integrity.
3) Mounts the savefile.
4) Creates the directory for the savefolder.
5) Copies the contents of the savefile into the savefolder.
6) Renames the savefile by appending '.bak' to it's name.
Once it is finished the target puppy is ready to be rebooted to use the savefolder.

Although savefile2dir now supports converting a mounted savefile, it is preferred that it be used to convert unmounted savefiles. Preferably from a puppy installation other than the target puppy.

Note1: 'savefile2dir' does not add the savefolder facility to the target puppy.
Note2: 'savefile2dir' does not require the savefolder facility to be present in the puppy on which it is executed.

gyro
Last edited by gyro on Mon 13 Jul 2015, 11:33, edited 10 times in total.

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

running 'savefile2dir' in pupmode=5

#2 Post by gyro »

1) Download 'savefile2dir-1.1.pet' and move it to the root of the partition containing the target savefile.
2) Boot a puppy in pupmode=5, ('pfix=ram'). This can be the target puppy. Don't bother changing anything in the first setup screen.
3) Mount the partition containing the savefile.
4) Click on 'savefile2dir-1.1.pet' to install it.
5) Open a console and enter a command like the following:

Code: Select all

savefile2dir /mnt/sda3/tahr/tahrsave.3fs
6) Unmount the partition containing the new savefolder.
7) Reboot, but choose not to "save". Your previously saved data is not part of this session.
The next normal boot of the target puppy should find the savefolder and all the data previously saved in the old savefile.

gyro
Last edited by gyro on Sun 16 Nov 2014, 09:39, edited 1 time in total.

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

savefile2dir - sfs file

#3 Post by gyro »

Edit:
Version 1.1 has been withdrawn. Please use 'savefile2dir-1.2.sfs.gz', below.

I've attached 'savefile2dir-1.1.sfs here because I find it very useful to use a command like:

Code: Select all

unsquashfs -f -d ./ydrv-tahr-sfs/ /mnt/home/savefile2dir-1.1.sfs
to merge it's files into another pet or sfs directory. The content is the same as the pet.

gyro
Last edited by gyro on Fri 21 Nov 2014, 10:02, edited 2 times in total.

User avatar
rek769
Posts: 84
Joined: Thu 15 Jul 2010, 04:55

Could this be used...

#4 Post by rek769 »

...to deploy an identical encrypted savefile onto several machines and then change the password of each savefile to something unique?

If possible, how could it be done?

Thanks

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

Re: Could this be used...

#5 Post by gyro »

rek769 wrote:...to deploy an identical encrypted savefile onto several machines and then change the password of each savefile to something unique?

If possible, how could it be done?

Thanks
No idea.
It's certain that this utility has nothing to contribute to such a scenario.
gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

Announcing savefile2dir 1.2

#6 Post by gyro »

This represents a significant rewrite of the code.

Main change is that it now supports converting a currently mounted savefile. So you can use it without booting 'pfix=ram'. But of course it cannot do an 'fsck' of the savefile, or rename it.
If the savefile is not currently mounted, it is checked by 'fsck' before it is mounted. The savefile also gets renamed by appending ".bak", so it will not be found by the next normal boot of the target puppy.

Both '/etc/.XLOADED' and '/etc/rc.d/BOOTCONFIG' are modified to improve the smoothness of the next normal boot.

Just like the previous version, it does not require 'savefolder' to be implemented in the host puppy. It should run on just about any puppy.

I have attached both a .pet and a .sfs.

gyro
Attachments
savefile2dir-1.2.sfs.gz
Just 'gunzip' it to get the .sfs file
(3.83 KiB) Downloaded 506 times
savefile2dir-1.2.pet
A normal pet file
(3.89 KiB) Downloaded 532 times

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

Announcing savefile2dir 1.3

#7 Post by gyro »

This is a small fix, now supports "/root/.XLOADED" as well as "/etc/.XLOADED".

gyro
Attachments
savefile2dir-1.3.sfs.gz
Just 'gunzip' it to produce sfs file
(3.85 KiB) Downloaded 456 times
savefile2dir-1.3.pet
Ordinary .pet file
(3.91 KiB) Downloaded 508 times

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#8 Post by sunburnt »

Hi gyro; Don`t think Ive ever talked to you before.
I was not aware any Puppy version supported Save folders.
I suggested this many years ago to Barry and others, but little interest.

I think Barry never used it because it takes longer to do a Save folder fsck.
Where as a Save file or partition is no bigger than the actual Save space.
.

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#9 Post by gyro »

sunburnt wrote:I was not aware any Puppy version supported Save folders.
It's only been developed this year, http://murga-linux.com/puppy/viewtopic.php?t=93559 and http://murga-linux.com/puppy/viewtopic.php?t=95922.
The first version is currently in woof-ce and hence native in TahrPup 6.0 CE.
The newer implementation using symbolic links, is available in patching mechanisms for a number of puppies.

Edit: I think "FatDog" also has the facility.

gyro

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#10 Post by bigpup »

The save folder (directory) has to be put on a partition that is formatted with a Linux format. (ext 2, 3 ,or 4)
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

Updated to savefile2dir 1.4

#11 Post by gyro »

This script checks the file-system containing the source savefile.
If it's not a Linux file-system then it aborts with an error message.
If it is a Linux file-system then it creates a savefolder in the same directory.

If the created savefolder is moved, make sure the destination partition contains a Linux file-system, (ext2|ext3|ext4|reiserfs|minix|f2fs|tmpfs).

I have attached a pet and sfs of savefile2dir 1.4.
This version contains a more reliable method of determining the file-system type. (Uses "df --output=fstype FILE | tail -1")

gyro
Attachments
savefile2dir-1.4.sfs.gz
gunzip file to produce sfs file
(3.79 KiB) Downloaded 404 times
savefile2dir-1.4.pet
normal .pet file
(3.81 KiB) Downloaded 412 times

User avatar
Griot
Posts: 131
Joined: Fri 12 Sep 2014, 18:10
Location: Serbia

#12 Post by Griot »

Hello, gyro.

I'm trying to convert Slacko 5.7.0 (NoN PAE k.3.4.82) savefile to savedir... Success=0 :(

(RAM mode)

Code: Select all

savefile2dir /mnt/sda1/slacko-570/slackosave-k15.3fs
df-FULL: unrecognized option '--output=fstype'
Try 'df-FULL --help' for more information.
(mounted savefile)

Code: Select all

savefile2dir /mnt/home/slacko-570/slackosave-k15.3fs
df-FULL: unrecognized option '--output=fstype'
Try 'df-FULL --help' for more information.
All partitions are ext3 and I'm not using wine/virtual box.
Any tip how to do this without fresh install?

Thanx!

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#13 Post by gyro »

@Griot,
It appears the script is using a "df" option that your "df" might not support.
What is the output from the following command?

Code: Select all

df --help
If it doesn't contain any reference to "--output" then I will have to find a different of determining the fstype of the partition.

Or:
Since you assure me that it is an ext3 partition,
the fstype test can be fudged by replacing line 63:

Code: Select all

FSTYP="`df --output=fstype \"$imgFile\" | tail -1`"
with

Code: Select all

FSTYP="ext3"
gyro

User avatar
Griot
Posts: 131
Joined: Fri 12 Sep 2014, 18:10
Location: Serbia

#14 Post by Griot »

Thanks for the tip, gyro.
FWIW here's a complete info.

a) You're spot on. No reference about df --output.
Here's a terminal output:

Code: Select all

df --help
Usage: df-FULL [OPTION]... [FILE]...
Show information about the file system on which each FILE resides,
or all file systems by default.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all             include dummy file systems
  -B, --block-size=SIZE  scale sizes by SIZE before printing them.  E.g.,
                           '-BM' prints sizes in units of 1,048,576 bytes.
                           See SIZE format below.
      --total           produce a grand total
  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
  -H, --si              likewise, but use powers of 1000 not 1024
  -i, --inodes          list inode information instead of block usage
  -k                    like --block-size=1K
  -l, --local           limit listing to local file systems
      --no-sync         do not invoke sync before getting usage info (default)
  -P, --portability     use the POSIX output format
      --sync            invoke sync before getting usage info
  -t, --type=TYPE       limit listing to file systems of type TYPE
  -T, --print-type      print file system type
  -x, --exclude-type=TYPE   limit listing to file systems not of type TYPE
  -v                    (ignored)
      --help     display this help and exit
      --version  output version information and exit

Display values are in units of the first available SIZE from --block-size,
and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).

Report df-FULL bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'df-FULL invocation'
b) Terminal output after changing line 63 of the script 'savefile2dir' /root/my-applications/bin/ :

Code: Select all

# savefile2dir /mnt/home/slacko-570/slackosave-k15.3fs
Success:
/initrd/mnt/dev_save/slacko-570/slackosave-k15 created, with contents from /initrd/mnt/dev_save/slacko-570/slackosave-k15.3fs
Thanks again. Rebooting with savedir.

EDIT: Nope, it doesn't recognize newly created savedir.
Rebooted twice after creating savedir (created from mounted savefile, look for term-out above). Jumped off to RAM, renamed savefile, no luck.
Then I deleted savedir (in RAM mode), tried the same procedure from the beginning and this time savefile iz renamed to .bak and savedir is created but Slacko doesn't recognize it.

Any usefull commands/logs to look for?
Thanks.

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#15 Post by gyro »

@Griot
You have installed the "savefolder" facility for Slacko 5.7, http://www.murga-linux.com/puppy/viewto ... 368#809368?
Slacko 5.7 does not support "savefolder" by default.

gyro

User avatar
Griot
Posts: 131
Joined: Fri 12 Sep 2014, 18:10
Location: Serbia

#16 Post by Griot »

Yes I did. :) Slacko 5.7 came before save2dir, dumba$$ me! :?
I'm not sure what to do next, though.
I guess loading of 'ydrv_slacko_5.7.sfs' should do the trick?

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#17 Post by seaside »

gyro,

Code: Select all

FSTYP="`df --output=fstype \"$imgFile\" | tail -1`"
Another way to get the filesystem type

Code: Select all

file "$imgFile"|awk '{print $5}'
Cheers,
s

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#18 Post by gyro »

@Griot,

If the ydrv sfs file is in the frugal install directory, then rebooting should automatically load it.

I assume that you have followed these instructions:
1) Download both files.
2) Rename current 'initrd.gz' as a backup.
3) Move both downloaded files into directory containing the frugal install.
4) Reboot.

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#19 Post by gyro »

@seaside,
Thanks, but I've already settled on :

Code: Select all

stat -f -c %T "${imgFile}"
gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

update to savefile2dir 1.5 - runs on older puppies

#20 Post by gyro »

I have attached savefile2dir-1.5.pet.
This an update for older puppies.
savefile2dir-1.4 depends on a relatively new feature of the "df" command to find the filesystem type that the savefile is stored upon.
This version uses the "stat" command, which works in my old dpup squeeze.

If savefile2dir-1.4 works for you, then there is no value in downloading this one.

gyro
Attachments
savefile2dir-1.5.pet
ordinary .pet file
(3.84 KiB) Downloaded 329 times

Post Reply