New save.dat every time ports is booted [SOLVED]
New save.dat every time ports is booted [SOLVED]
Hello,
I have a use case where I need the save.dat from a previous session to be archived and a new/empty save.dat to used every time porteus is booted.
basically i am looking for:
On boot of Porteus:
1. Rename current save.dat to save[last updated time/date].dat
2. cp save_tmp.dat to save.dat
3. Start new save.dat
4. User logins
save_tmp.dat is a previously created file using the create .dat tool
I thought that I could do something with grub, but I don't think that I can cp or mv files using the grub cli
Any help would be awesome.
Cheers
R
I have a use case where I need the save.dat from a previous session to be archived and a new/empty save.dat to used every time porteus is booted.
basically i am looking for:
On boot of Porteus:
1. Rename current save.dat to save[last updated time/date].dat
2. cp save_tmp.dat to save.dat
3. Start new save.dat
4. User logins
save_tmp.dat is a previously created file using the create .dat tool
I thought that I could do something with grub, but I don't think that I can cp or mv files using the grub cli
Any help would be awesome.
Cheers
R
- brokenman
- Site Admin
- Posts: 6104
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
- Contact:
Re: New save.dat every time ports is booted
I think the easiest way to accomplish this would be with a linux file sytem, avoiding the need for a save.dat file. You could then use a shutdown script that moves the changes FOLDER to whatever name you desire. A new fresh changes folder will be generated upon next boot. The other option involves unpacking the initrd.xz and writing something into linuxrc which does the file shuffling before handing over to init.
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
- francois
- Contributor
- Posts: 6315
- Joined: 28 Dec 2010, 14:25
- Distribution: xfce plank porteus nemesis
- Location: Le printemps, le printemps, le printemps... ... l'hiver s'essoufle.
Re: New save.dat every time ports is booted
Welcome to porteus NevaAlone.
Presently, what is the set up of your hdd. Can you give us the output of fdisk -l? Then just tell us what you intend to do with each partition. For sure linux filesystem is better with linux os. Less restrictive, more simple to manage.

Presently, what is the set up of your hdd. Can you give us the output of fdisk -l? Then just tell us what you intend to do with each partition. For sure linux filesystem is better with linux os. Less restrictive, more simple to manage.
Prendre son temps, profiter de celui qui passe.
-
- Contributor
- Posts: 657
- Joined: 26 Jun 2013, 14:03
- Distribution: x64 Openbox
- Location: against russian attacks and lies
- Contact:
Re: New save.dat every time ports is booted
I think it would be better to do it at shutdown - I can try to do it, if you want. It seems to be simple.
You have mind and feelings. Be wise and clever.
Re: New save.dat every time ports is booted
Thank you for your replies! Awesome 
If it was able to be done at boot time, that would be great, that way if the system was powered off without proper shut down then I can capture any changes. I need to have the save.dat or a changes folder archived for each session so it can be forensically reviewed if there was a problem.
francois: hello, I don't have a very complicated layout.
Device Boot System
/dev/sda1 * Linux
/dev/sda2 Linux
I would like to move the dated changes folder to /sda2 as I have a decent amount of storage there.
Cheers
Reuben

If it was able to be done at boot time, that would be great, that way if the system was powered off without proper shut down then I can capture any changes. I need to have the save.dat or a changes folder archived for each session so it can be forensically reviewed if there was a problem.
francois: hello, I don't have a very complicated layout.
Device Boot System
/dev/sda1 * Linux
/dev/sda2 Linux
I would like to move the dated changes folder to /sda2 as I have a decent amount of storage there.
Cheers
Reuben
- brokenman
- Site Admin
- Posts: 6104
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
- Contact:
Re: New save.dat every time ports is booted
Changes are 'real time' so if the system is powered off you will still have access at next boot. If it is essential to be done during boot then editing linuxrc may still be possible.if the system was powered off without proper shut down then I can capture any changes.
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
Re: New save.dat every time ports is booted
Hello,
Thank you,
I have been able to get most of my changes working apart from appending the date_time to the newly moved folder.
It looks like that date isn't available at this stage of the boot. I checked the bin folder with in initrd.xz and isn't date in the folder. I have tried to create a ln -s to busy box and repackage initrd.xz but it doesn't seem to work. I am doing something wrong with the sym linking.
Cheers
R
Thank you,
I have been able to get most of my changes working apart from appending the date_time to the newly moved folder.
It looks like that date isn't available at this stage of the boot. I checked the bin folder with in initrd.xz and isn't date in the folder. I have tried to create a ln -s to busy box and repackage initrd.xz but it doesn't seem to work. I am doing something wrong with the sym linking.
Cheers
R
- brokenman
- Site Admin
- Posts: 6104
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
- Contact:
Re: New save.dat every time ports is booted
bin/busybox --list shows that date hasn't been compiled in. Perhaps try taking the date binary from /bin/date from standard porteus (001-core.xzm) and put it in initrd.xz.
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
Re: New save.dat every time ports is booted
Hello,
Thank everyone that helped!
I got it going by updating the busybox version in the initrc.xz with the latest, symlinked 'date' to busybox and every worked like a charm!!
I have learned a lot about the boot process
Thank you again, you guys rock!
Cheers
R
Thank everyone that helped!

I got it going by updating the busybox version in the initrc.xz with the latest, symlinked 'date' to busybox and every worked like a charm!!
I have learned a lot about the boot process

Thank you again, you guys rock!
Cheers
R
- brokenman
- Site Admin
- Posts: 6104
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
- Contact:
Re: New save.dat every time ports is booted
Excellent. Good to see a Kiwi onboard. 

How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.