Linux Script to restore savefile <Solved>

Booting, installing, newbie
Post Reply
Message
Author
dcung
Posts: 242
Joined: Sat 14 Jul 2018, 00:11
Location: Down Under - 3rd rock from Sun.

Linux Script to restore savefile <Solved>

#1 Post by dcung »

Hi,

I installed 2 flavour of Puppy Linux on a laptop (frugal install).
I made backup of the savefiles in another partition/dir. I already tested restoring them manually thru GUI (file manager). That is I restore savefile1, by selecting/running flavour-2 on GRUB4DOS menu, and do the restore. And vice versa.

Before I hand the laptop to a family member for use, I would like to create an icon (file) on desktop, sort of a script to restore should something happen. This script would help as they live 2 hours away (return trip).. :)

I'm not familiar with linux script, or at the most 'very rusty' and would take me ages. And a linux script person would be able to this in minutes.. :lol:

I'd like the script to open a window/terminal and runs following commands

wait "Hit a key to continue"
rm /installdir/currentsavefile
cp /backupdir/savefile /installdir/currentsavefile
wait "Hit a key to continue"


How do I go about doing this please?

Thanks.
Last edited by dcung on Thu 02 Aug 2018, 08:21, edited 1 time in total.

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#2 Post by rockedge »

here is something you can save somewhere and drag a link to the desktop as a shortcut. I put it in /root/my-applications/restore-savefile make it executable and using rox-filer drag an it as icon to the desktop.

Code: Select all

#!/bin/sh
gxmessage 'Do you want to Restore savefile?' \
	-buttons 'Cancel:1,Restore:2,Reboot:3,Shut Down:4' \
	-center


case $? in
    2)
	rm /root/spot/testsavefile.txt
	cp /root/ftpd/testsavefile.txt /root/spot/testsavefile.txt
    gxmessage 'Savefile Restored' -center -timeout 4
	;;
    3)
	reboot
	;;
    4)
	poweroff
	;;
esac

dcung
Posts: 242
Joined: Sat 14 Jul 2018, 00:11
Location: Down Under - 3rd rock from Sun.

#3 Post by dcung »

Thanks rockedge.!

That's what I need.
Tested and working!

In UpupBB, it presented popup.
No biggies, just another click. I'm sure they can handle that.
But if there's a way to bypass, that's even better.
Attachments
Screenshot.png
(11.09 KiB) Downloaded 220 times

ITSMERSH

#4 Post by ITSMERSH »

This looks like you are running a LxPup or even a file manager like PCManFM. I'm not sure, though I think you can't bypass/skip this GUI.

Except: you wold create a .desktop file for it in /usr/share/applications and starting the script via this .desktop file (from menu or placed at the Desktop if possible).

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

Backup Savefile and/or Pup partition

#5 Post by davids45 »

G'day dcung,

In case you want to try existing packages to save your Pups from family-tinkering, you could check packages in the 'Utilities' Menu. The screenshot shows these on one of my BionicPups as pinboard icons and as Menu items (if you can read the jpg text).

There is a savefile back-up - for regular backups of just one Pup's savefile (not the read-only fixed Puppy OS files). Or before trying anything 'risky' - if you know it's risky before you do it :D - that can wreck your savefile.

And a Puppy backup to mirror the Puppy partition, for when you have numerous Pups on a partition, or for your data partition(s) holding your important personal data, etc.

David S..
Attachments
savepup-options-bionic.jpg
pinboard icons and Menu listed options
(154.57 KiB) Downloaded 213 times

ITSMERSH

#6 Post by ITSMERSH »

@davids45

You got the Muppy filer running in Bionic Pup? :shock:

dcung
Posts: 242
Joined: Sat 14 Jul 2018, 00:11
Location: Down Under - 3rd rock from Sun.

Re: Backup Savefile and/or Pup partition

#7 Post by dcung »

davids45 wrote:There is a savefile back-up - for regular backups of just one Pup's savefile (not the read-only fixed Puppy OS files). Or before trying anything 'risky' - if you know it's risky before you do it :D - that can wreck your savefile.
Thanks for the tips David.
I'll keep that in mind when I'm tinkering, this will fit my need.

For my relative need, the codes from rockedge suited well for the purpose.
Just want to eliminate the extra 'click' if possible... :)

ITSMERSH

#8 Post by ITSMERSH »

Just want to eliminate the extra 'click' if possible
Just download the attached file, remove the fake .gz suffix and store it at /usr/share/applications. From that location drag and drop it onto the desktop.

Now it should bypass that extra GUI when clicked.
Attachments
rockedge-restore-savefile.desktop.gz
(281 Bytes) Downloaded 71 times

dcung
Posts: 242
Joined: Sat 14 Jul 2018, 00:11
Location: Down Under - 3rd rock from Sun.

#9 Post by dcung »

ITSMERSH wrote:Now it should bypass that extra GUI when clicked.
Thanks!

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

(Off-topic) Muppy-Filer in Bionics

#10 Post by davids45 »

G'day,

First apologies to dcung for going a little bit off-topic in his <Solved> thread :) , but this is a reply for RSH re his posted question about my screenshot from a Bionic Pup in my above post.

I re-booted this morning into another BionicPup (peebee breeds them so quickly it's hard to keep track!) and Muppy-Filer and Sfs-Combiner do run in these 32-bit Bionics as far as I can determine (screenshot).

The little arrow at the top-corner of the pinboard icon tells me Muppy-Filer is running as an sfs-ed link from this Bionic Pup on sda1 back to the actual Muppy-Filer package on my sda5 data partition. The same for SFS-Combiner. The same 'install' set-up as my earlier Bionic screenshot as both Bionic Pups would be using the same sfs on sda1.

I cannot recall any previous problem with Muppy-Filer not running in any Puppy (Slackos, Stretches, or Ubuntu-influenced).

David S.
Attachments
MuppyFiler-in-Bionic.jpg
(120.4 KiB) Downloaded 149 times

dcung
Posts: 242
Joined: Sat 14 Jul 2018, 00:11
Location: Down Under - 3rd rock from Sun.

#11 Post by dcung »

@David,

Also off-topic.
What is good about Muppy_Filer and where to get it from?

I want to have a screen like yours at some point... :)

Thanks.

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

Muppy Filer

#12 Post by davids45 »

G'day dcung,

Muppy Filer is a file manager written, now many years ago, by an early Puppy programming expert, Mark Ulrich.
He wrote it to suit his regular programming needs in Puppy so has many functions related to writing as well as using Puppy files.

It has two panels (so not quite as good as Rox with its as-many-as-you-like windows/panels).
Muppy-Filer has numerous Puppy-related buttons to work on/with files in either panel (screenshot).

I like it particularly to navigate to a directory/file by clicking in a panel, then click on a button , e.g. 'shell' to immediately open a terminal at that location - no typing necessary, unlike using just the terminal to move to a particular file.

Muppy-Filer is over ten years old so won't work in 64-bit Pups :cry: .
It also requires two other packages, PuppyBasic and GtkBasic.
The Puppy-Basic pet is as small as Muppy-Filer.pet but the GtkBasic pet is too big for me to attach to the forum (screenshot).
These three files may be available on one of the Puppy repositories held/maintained by some forum members but I don't know for sure. Maybe one of these, if they have the three Muppy-Filer files available, could reply?

There may be other file managers that will do the same things as Muppy-Filer, but it's the program I'm now very used to, so I haven't looked elsewhere.

David S.
Attachments
Muppy-Filer-panels.jpg
(88.37 KiB) Downloaded 93 times
Files-for-Muppy-Filer.jpg
(47.96 KiB) Downloaded 92 times

dcung
Posts: 242
Joined: Sat 14 Jul 2018, 00:11
Location: Down Under - 3rd rock from Sun.

#13 Post by dcung »

Thanks for taking time to explain, David.

When I have time I'll explore it.
For now I have many other tinkering to do... :)

User avatar
perdido
Posts: 1528
Joined: Mon 09 Dec 2013, 16:29
Location: ¿Altair IV , Just north of Eeyore Junction.?

#14 Post by perdido »

Some internet links for the packages davids45 referenced.

Muppy-Filer (August, 31, 2008)


GtkBasic003e.pet

PuppyBasic-2.6.pet

Muppy-Filer-0.2.pet

.

dcung
Posts: 242
Joined: Sat 14 Jul 2018, 00:11
Location: Down Under - 3rd rock from Sun.

#15 Post by dcung »

Thank you perdido.

Post Reply