Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 19 Dec 2014, 18:48
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to utilise pre-made, empty save-file in latest pups
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [9 Posts]  
Author Message
MinHundHettePerro


Joined: 05 Feb 2009
Posts: 856
Location: SE

PostPosted: Tue 13 Nov 2012, 21:24    Post subject:  How to utilise pre-made, empty save-file in latest pups  

Hello Smile!

The long-lost ability of a fresh pup to utilise a pre-made, empty, savefile is restored. Cool

Cannot remember exactly when it got lost - 4.3.1?, was definitely there in the 2-series, most likely also in 3-series (and 4.1.2?).

Anyway, I did miss this ability for a long time and have thought, on and off, for a few years to re-instate this function. Today, I finally got around to it Cool.

Why?
- For a tester, or a frequent installer, it saves one reboot ...
- Makes it much easier for a user to implement usage of savefile file-systems other than ext?, not requiring pup-shutdown to create the savefile ...

For pupmode 12, it was easy - just some small changes in /etc/rc.d/rc.update ...

For pupmode 13 (pmedia=ataflash and usbflash), there were kernel panics until a small change in initrd.gz, inhibiting the sourcing of a non-existant file (in pup_ro_1) ...

Diffs of changes to /etc/rc.d/rc.update and initrd.gz_/init are provided for slacko-5.3.7.1 (slacko beta 4).

EDIT 130818 with improvements to the rc.update patch. (Diffed against Slacko-56_4G)
Code:
--- rc.update.orig   2013-08-18 14:29:09.000000000 +0200
+++ rc.update   2013-08-18 17:02:23.286719035 +0200
@@ -71,6 +71,17 @@
  fi
 }
 
+# MHHP 130818, For to, again, allow for a pre-made, empty, pupsave-file in PUPOMODEs 12 &13 without loosing desktop icons etc.
+S_LAYER=`grep '^SAVE_LAYER=' /etc/rc.d/PUPSTATE | cut -f 2 -d '='|cut -f 2 -d "'"`
+case $PUPMODE in
+  "12"|"13")
+    [ ! -d /initrd"$S_LAYER"/root ] && [ ! -d /initrd"$S_LAYER"/usr ] && [ ! -d /initrd"$S_LAYER"/var ] && PUPMODE_org="$PUPMODE" && PUPMODE="5"
+  ;;
+  *)
+  ;;
+esac
+# /MHHP
+
 case $PUPMODE in
  "7") #tmpfs (pup_rw), hd for persistent storage (pup_ro1), ${DISTRO_PUPPYSFS} (pup_ro2).
   NEWFILESMNTPT="/initrd/pup_ro2"
@@ -198,6 +209,8 @@
  ;;
 esac
 
+[ $PUPMODE_org ] && PUPMODE="$PUPMODE_org" && unset PUPMODE_org && unset S_LAYER # MHHP 130818
+
 . $NEWFILESMNTPT/etc/DISTRO_SPECS #w020 has DISTRO_VERSION, DISTRO_BINARY_COMPAT, DISTRO_FILE_PREFIX
 
 NEWPVERSION="`grep '^DISTRO_VERSION' $NEWFILESMNTPT/etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 2 -d '"' | cut -f 2 -d "'" | cut -f 1 -d ' '`" #110422


Code:
--- initrd-tree_org/init   2012-11-13 23:57:00.000000000 +0100
+++ initrd-tree_new/init   2012-11-14 02:18:29.000000000 +0100
@@ -1490,7 +1490,11 @@
 #older ${DISTRO_FILE_PREFIX}save.2fs <v2.16 will not have this file...
 [ ! -f $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG ] && touch $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG
 #note, OLDFILESMNTPT can also be "" so BOOTCONFIG needs to exist in initrd also.
-. $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG #can have EXTRASFSLIST variable.
+
+# . $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG #can have EXTRASFSLIST variable. # MHHP 121113
+# In case a pre-made, empty save-file is supplied, for PUPMODE 13, it cannot be touched by the previous command; sourcing a non-existant file in the following line results in kernel-panic, so let's test if $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG exists, and skip sourcing if non-existant.
+[  -f $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG ] && . $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG #can have EXTRASFSLIST variable.
+# /MHHP
 
 #110217 very bad hack, see /etc/rc.d/rc.update, rc.shutdown.
 [ ! -f $OLDFILESMNTPT/var/local/etc_profile_at_shutdown ] && cp -f $OLDFILESMNTPT/etc/profile $OLDFILESMNTPT/var/local/etc_profile_at_shutdown


EDIT:
Yes, I should probably have mentioned that this is mainly for woofers to use, or for those wanting to play around extensively with a certain version of puppy (unsquashing - patching - re-squashing your pupxxx.sfs) Smile.


Cheers Smile/ MHHP

_________________
Celeron 2.8 GHz, 1 GB, i82845, many ptns, modes 12, 13
Dual Xeon 3.2 GHz, 1 GB, nvidia quadro nvs 285

Slackos & 214X, ... and Q6xx
Nämen, vaf.... ln -s /dev/null MHHP

Last edited by MinHundHettePerro on Sun 18 Aug 2013, 11:24; edited 1 time in total
Back to top
View user's profile Send private message 
MinHundHettePerro


Joined: 05 Feb 2009
Posts: 856
Location: SE

PostPosted: Wed 14 Aug 2013, 19:20    Post subject:  

There's been some interest in this topic as of lately, and the problem with a dd'ed savefile is mentioned here.

So, to update my above post with a simpler, scripted solution that does not involve any editing of puppy_*.sfs, nor of initrd.gz follows ... Cool

Save the two files below in the directory of your puppy_*.sfs (for non-optical medium booted pupmodes 12 &13), edit the first file for filename, filetype and size, run & done Smile. (or, continue with implementing puppy-support for your fs of choice and add it here ... Wink)

make_empty_savefile
Code:
#!/bin/sh
# Create an empty savefile, copy over /etc/rc.d/rc.update and patch that file for to auto-set icons, backdrop etc. as is done in pupmode 5.
# Also create an empty /etc/rc.d/BOOTCONFIG for to avoid kernel panic with empty savefile in pupmode 13 caused by a problem in initrd.gz_init, no need to edit initrd.gz_init, cff http://www.murga-linux.com/puppy/viewtopic.php?p=664566#664566
# To be run in the directory of puppy_******_*.*.sfs and rc.update_slacko-56_MHHP_130818.diff
# MHHP 2013-08-18

# ********************* Please edit *********************
FILENAME="slackosave-56_4g" # name of savefile without extension
FILETYPE="ext2" # ext2|3|4, reiser[fs], make sure your chosen FS is supported by your puppy ...
FILESIZE="512" # in MB
# *******************************************************

PUPFILE=`ls puppy*.sfs`

# FILE_EXTENSION
case "$FILETYPE" in
  ext2)
    FILE_EXT="2fs"
  ;;
  ext3)
    FILE_EXT="3fs"
  ;;
  ext4)
    FILE_EXT="4fs"
  ;;
  reiser|reiserfs)
    FILE_EXT="rfs"
  ;;
    *)
  ;;
esac

dd if=/dev/zero of=./"$FILENAME"."$FILE_EXT" bs=1M count=$FILESIZE
case "$FILETYPE" in
  ext*)
    yes|mkfs."$FILETYPE" "$FILENAME"."$FILE_EXT"
  ;;
  reiser)
    yes|mkfs."$FILETYPE" "$FILENAME"."$FILE_EXT"
  ;;
    *)
  ;;
esac
 
mkdir PUPSAVE
mkdir PUPSFS

mount -t "$FILETYPE" "$FILENAME"."$FILE_EXT" PUPSAVE
mount "$PUPFILE" PUPSFS

mkdir -p PUPSAVE/etc/rc.d

touch PUPSAVE/etc/rc.d/BOOTCONFIG # For to avoid kernel panic with empty savefile in pupmode 13
cp PUPSFS/etc/rc.d/rc.update PUPSAVE/etc/rc.d/

patch PUPSAVE/etc/rc.d/rc.update rc.update_slacko-56_MHHP_130818.diff

umount PUPSFS
umount PUPSAVE

rm -rf PUPSFS
rm -rf PUPSAVE


rc.update_slacko-56_MHHP_130818.diff
Code:
--- rc.update.orig   2013-08-18 14:29:09.000000000 +0200
+++ rc.update   2013-08-18 17:02:23.286719035 +0200
@@ -71,6 +71,17 @@
  fi
 }
 
+# MHHP 130818, For to, again, allow for a pre-made, empty, pupsave-file in PUPOMODEs 12 &13 without loosing desktop icons etc.
+S_LAYER=`grep '^SAVE_LAYER=' /etc/rc.d/PUPSTATE | cut -f 2 -d '='|cut -f 2 -d "'"`
+case $PUPMODE in
+  "12"|"13")
+    [ ! -d /initrd"$S_LAYER"/root ] && [ ! -d /initrd"$S_LAYER"/usr ] && [ ! -d /initrd"$S_LAYER"/var ] && PUPMODE_org="$PUPMODE" && PUPMODE="5"
+  ;;
+  *)
+  ;;
+esac
+# /MHHP
+
 case $PUPMODE in
  "7") #tmpfs (pup_rw), hd for persistent storage (pup_ro1), ${DISTRO_PUPPYSFS} (pup_ro2).
   NEWFILESMNTPT="/initrd/pup_ro2"
@@ -198,6 +209,8 @@
  ;;
 esac
 
+[ $PUPMODE_org ] && PUPMODE="$PUPMODE_org" && unset PUPMODE_org && unset S_LAYER # MHHP 130818
+
 . $NEWFILESMNTPT/etc/DISTRO_SPECS #w020 has DISTRO_VERSION, DISTRO_BINARY_COMPAT, DISTRO_FILE_PREFIX
 
 NEWPVERSION="`grep '^DISTRO_VERSION' $NEWFILESMNTPT/etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 2 -d '"' | cut -f 2 -d "'" | cut -f 1 -d ' '`" #110422


EDITED 130818 with improvements

Cheers Smile/
MHHP

_________________
Celeron 2.8 GHz, 1 GB, i82845, many ptns, modes 12, 13
Dual Xeon 3.2 GHz, 1 GB, nvidia quadro nvs 285

Slackos & 214X, ... and Q6xx
Nämen, vaf.... ln -s /dev/null MHHP

Last edited by MinHundHettePerro on Sun 18 Aug 2013, 11:19; edited 1 time in total
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 4452
Location: Gatineau (Qc), Canada

PostPosted: Thu 15 Aug 2013, 23:01    Post subject:  

Hello, MinHundHettePerro.

Thanks for suggesting a solution to the problem I reported at http://www.murga-linux.com/puppy/viewtopic.php?p=719239#719239.

Just so it is clear in my mind:
Must your three scripts above be used only with slacko 5.6_4G, or is your solution valid for any Puppy?

Thanks in advance and best regards.

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
MinHundHettePerro


Joined: 05 Feb 2009
Posts: 856
Location: SE

PostPosted: Sat 17 Aug 2013, 17:27    Post subject:  

musher0 wrote:
Hello, MinHundHettePerro.

Thanks for suggesting a solution to the problem I reported at http://www.murga-linux.com/puppy/viewtopic.php?p=719239#719239.

Just so it is clear in my mind:
Must your three scripts above be used only with slacko 5.6_4G, or is your solution valid for any Puppy?

Thanks in advance and best regards.

musher0

Hello, musher0!

Thanks for asking, ...

There's nothing slacko-specific to this workaroundy trick of allowing for a pre-made empty savefile. The script being patched is one of Puppy's start-up-scripts, /etc/rc.d/rc.update. The trick is to let Puppy's standard start-up-scripts run and decide what pupmode is appropriate, then, if an empty savefile is supplied, go back to pupmode 5 and do the first-run routines, after which the previously decided pupmode is resumed.
The naming of the patch-files just reflects the pup I diffed rc.update against. Should apply to "modern" pups, haven't investigated how far backwards, though Smile...

Hth Smile/
MHHP

_________________
Celeron 2.8 GHz, 1 GB, i82845, many ptns, modes 12, 13
Dual Xeon 3.2 GHz, 1 GB, nvidia quadro nvs 285

Slackos & 214X, ... and Q6xx
Nämen, vaf.... ln -s /dev/null MHHP
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3982
Location: Kiel,Germany

PostPosted: Sat 17 Aug 2013, 21:05    Post subject:  

Interesting thing MHHP !

The initrd.gz /init tends to change unexpectedly .
It writes all possible dirs and files into the savefile .

My question is about that line :
Code:
+    [ ! -d /initrd"$SAVE_LAYER"/root ] && [ ! -d /initrd"$SAVE_LAYER"/usr ] && [ ! -d /initrd"$SAVE_LAYER"/var ] && PUPMODE_org="$PUPMODE" && PUPMODE="5"

If there is only /PUPSAVE/etc/rc.d/BOOTCONFIG and PUPSAVE/etc/rc.d/rc.update in the savefile , why the check for three directories ?
Is it "just in case" ?
What if tomorrow Barry comes to the conclusion that because Ubuntu had invented /var/ubuntu/update directory, the /init must touch that ?

BTW grouping might be more accurate like
Code:
+   ( [ ! -d /initrd"$SAVE_LAYER"/root ] && [ ! -d /initrd"$SAVE_LAYER"/usr ] && [ ! -d /initrd"$SAVE_LAYER"/var ] ) && ( PUPMODE_org="$PUPMODE" && PUPMODE="5" )

or
Code:
+    [ ! -d /initrd"$SAVE_LAYER"/root -a ! -d /initrd"$SAVE_LAYER"/usr -a ! -d /initrd"$SAVE_LAYER"/var ] && { PUPMODE_org="$PUPMODE"; PUPMODE="5"; }
Back to top
View user's profile Send private message Visit poster's website 
MinHundHettePerro


Joined: 05 Feb 2009
Posts: 856
Location: SE

PostPosted: Sun 18 Aug 2013, 05:22    Post subject:  

Karl Godt wrote:
Interesting thing MHHP !

The initrd.gz /init tends to change unexpectedly .
It writes all possible dirs and files into the savefile .

My question is about that line :
Code:
+    [ ! -d /initrd"$SAVE_LAYER"/root ] && [ ! -d /initrd"$SAVE_LAYER"/usr ] && [ ! -d /initrd"$SAVE_LAYER"/var ] && PUPMODE_org="$PUPMODE" && PUPMODE="5"

If there is only /PUPSAVE/etc/rc.d/BOOTCONFIG and PUPSAVE/etc/rc.d/rc.update in the savefile , why the check for three directories ?
Is it "just in case" ?]

Just my simplistic way of testing if the supplied savefile is "empty".
Now changed in the two first posts ...

Quote:
What if tomorrow Barry comes to the conclusion that because Ubuntu had invented /var/ubuntu/update directory, the /init must touch that ?

That'd be a bummer, wouldn't it? Smile

Quote:

BTW grouping might be more accurate like
Code:
+   ( [ ! -d /initrd"$SAVE_LAYER"/root ] && [ ! -d /initrd"$SAVE_LAYER"/usr ] && [ ! -d /initrd"$SAVE_LAYER"/var ] ) && ( PUPMODE_org="$PUPMODE" && PUPMODE="5" )

or
Code:
+    [ ! -d /initrd"$SAVE_LAYER"/root -a ! -d /initrd"$SAVE_LAYER"/usr -a ! -d /initrd"$SAVE_LAYER"/var ] && { PUPMODE_org="$PUPMODE"; PUPMODE="5"; }

Perhaps not more accurate but, I agree that it would give a more grouped appeareance ...

Cheers Smile /MHHP

_________________
Celeron 2.8 GHz, 1 GB, i82845, many ptns, modes 12, 13
Dual Xeon 3.2 GHz, 1 GB, nvidia quadro nvs 285

Slackos & 214X, ... and Q6xx
Nämen, vaf.... ln -s /dev/null MHHP

Last edited by MinHundHettePerro on Sun 18 Aug 2013, 11:26; edited 1 time in total
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3982
Location: Kiel,Germany

PostPosted: Sun 18 Aug 2013, 08:55    Post subject:  

Perro , Thanks for the clarification !
Back to top
View user's profile Send private message Visit poster's website 
MinHundHettePerro


Joined: 05 Feb 2009
Posts: 856
Location: SE

PostPosted: Sun 18 Aug 2013, 11:28    Post subject:  

Hello!

First two posts edited with improvements to the rc.update patch ...

Cheers Smile /MHHP

_________________
Celeron 2.8 GHz, 1 GB, i82845, many ptns, modes 12, 13
Dual Xeon 3.2 GHz, 1 GB, nvidia quadro nvs 285

Slackos & 214X, ... and Q6xx
Nämen, vaf.... ln -s /dev/null MHHP
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 4452
Location: Gatineau (Qc), Canada

PostPosted: Wed 21 Aug 2013, 13:08    Post subject:  

MinHundHettePerro wrote:
Hello!

First two posts edited with improvements to the rc.update patch ...

Cheers Smile /MHHP


Thanks!

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [9 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0979s ][ Queries: 11 (0.0051s) ][ GZIP on ]