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 Wed 27 May 2015, 02:01
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Remove some inappropriate code from the 'init' script
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
gyro

Joined: 28 Oct 2008
Posts: 730
Location: Brisbane, Australia

PostPosted: Wed 18 Mar 2015, 09:42    Post subject:  Remove some inappropriate code from the 'init' script
Subject description: Return "pfix=fsck" to it's original meaning.
 

Here is a patch to the 'init' script in 'initrd.gz':
Code:
--- init.orig   2015-02-08 22:04:18.591866000 +1000
+++ init   2015-03-18 07:01:59.074300604 +1000
@@ -1022,17 +1025,6 @@
    esac
   fi
   if [ -d /mnt/dev_save$PUPSAVEFILE ]; then
-   # Check partition if user calls for savefile check
-   if [ "$PFSCK" = "yes" ]; then
-    umount /mnt/dev_save
-    MOUNTED=$(cat /proc/mounts | grep $PUPSAVEDEV |cut -f 2 -d ' ')
-    MNTOPT=$(cat /proc/mounts | grep $PUPSAVEDEV |cut -f 4 -d ' ')
-    umount  $MOUNTED
-    FSCKME="$(echo $PUPSAVE | tr ',' ' ')"
-    fsckme_func $FSCKME
-    mntfunc $PUPSAVEFS /dev/$PUPSAVEDEV $MOUNTED $MNTOPT
-    mntfunc $PUPSAVEFS /dev/$PUPSAVEDEV /mnt/dev_save noatime
-   fi
    rm -r -f $CREATEPUPSAVE2FS
    ln -s /mnt/dev_save${PUPSAVEFILE} $CREATEPUPSAVE2FS
   elif [ "$CRYPTO" != "" ] ; then

It removes some code that in my view is the wrong code in the wrong place.
This code is now in woof-ce and hence Tahrpup 6.0.2 and similar puppies.

Reasoning:

From the source code:
Code:
   fsck)    PFSCK="yes";;         #do a fsck of ${DISTRO_FILE_PREFIX}save file.

I interpret this to mean "fsck the filesystem that is contained within the savefile" on every boot.
Some of us use this facility for savefiles since it doesn't take long, (savefiles are usually not very big compared to the size of partitions). And puppy has a history of not cleanly unmounting savefiles.
With the installed code, if you convert your savefile to a savefolder, suddenly "pfix=fsck" means fsck the whole partition on every boot.
Applying the patch reverts the meaning of "pfix=fsck" to it's original meaning.

With a savefile there are 2 appropriate filesystems, the filesystem in the partition and the filesystem in the savefile.
With a savefolder there is only 1 appropriate filesystem, the filesystem in the partition. The savefolder is just another directory in the partition.
So if we assume that the "fsckme.flg" mechanism provides integretity to the filesystem in the partition, then with a savefolder there is no filesystem for "pfix=fsck" to fsck.

if we don't assume that the "fsckme.flg" mechanism is adaquate, then we need to provide the best possible facility to fsck the partition on every boot.
I suggest that http://www.murga-linux.com/puppy/viewtopic.php?t=97235 is a more appropriate base for providing such a facility.
Any facility to fsck the partition should be independent of "pfix=fsck", so it is available to all puppies not just those that use savefolder.

Note1: I run my puppies on an ext4 partition with a "pfix=fsck4,fsck" boot parameter, so that if I am using a savefile both filesystems get fscked, and if I'm using a savefolder then the partition is fscked.

Note2: The 'init' script can only fsck ext2, ext3 and ext4 filesystems, since 'initrd.gz' contains only 'e2fsck'.

To use the patch:
Cut and paste the patch into a text editor and save it as 'init.diff'
Uncompress the current 'initrd.gz'
Patch the 'init' file with the saved 'init.diff' file.
Compress a new 'initrd.gz' file.

Tahrpup 6.0.2 "initrd.gz" files that contain both tihs and the 'always fsck ext4' patch, can be downloaded from here:
noPAE: http://www.fishprogs.info/puppy/tahr602nopae/initrd.gz
PAE: http://www.fishprogs.info/puppy/tahr602pae/initrd.gz

gyro

Last edited by gyro on Sun 17 May 2015, 00:28; edited 1 time in total
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 2261

PostPosted: Wed 18 Mar 2015, 11:26    Post subject:  

I do not want to argue the logic or anything, just to point out that what is in woof-CE is a bit different.
If interested see commits f6702f4, 5f56e6e and 37c1b46.

_________________
Kids all over the world go around with an XO laptop. They deserve one puppy (or many) too Very Happy
Back to top
View user's profile Send private message 
Karl Godt


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

PostPosted: Fri 20 Mar 2015, 10:07    Post subject:  

Instead of commenting code or removing code , I would suggest to wrap that code into an unused function.

This looks nicer and code logic does not get lost .

Like so :

Code:
   esac
   fi
   if [ -d /mnt/dev_save$PUPSAVEFILE ]; then
 
  #====================
  # REM : wrap code into function .
  # TODO : remove that function if confirmed unneeded in 1-5 years
  # DRAWBACKS : compatibility problems with older Puppies
   __unused_fsckme_function_old__(){
   # Check partition if user calls for savefile check
   if [ "$PFSCK" = "yes" ]; then
    umount /mnt/dev_save
    MOUNTED=$(cat /proc/mounts | grep $PUPSAVEDEV |cut -f 2 -d ' ')
    MNTOPT=$(cat /proc/mounts | grep $PUPSAVEDEV |cut -f 4 -d ' ')
    umount  $MOUNTED
    FSCKME="$(echo $PUPSAVE | tr ',' ' ')"
    fsckme_func $FSCKME
    mntfunc $PUPSAVEFS /dev/$PUPSAVEDEV $MOUNTED $MNTOPT
    mntfunc $PUPSAVEFS /dev/$PUPSAVEDEV /mnt/dev_save noatime
   fi
   }
  #==================

    rm -r -f $CREATEPUPSAVE2FS
    ln -s /mnt/dev_save${PUPSAVEFILE} $CREATEPUPSAVE2FS
   elif [ "$CRYPTO" != "" ] ; then

_________________
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal Razz
Back to top
View user's profile Send private message 
gyro

Joined: 28 Oct 2008
Posts: 730
Location: Brisbane, Australia

PostPosted: Fri 20 Mar 2015, 14:48    Post subject:  

In relation to mavrothal's comment:
Yes, the code in the testing branch has changed.
But that just means the patch as is won't apply, but the code should still be deactivated. My reasoning for deactivating this code still apply.

@Karl Godt,
Doesn't matter how it's done, just ensure that this code is not active.

gyro
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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.0572s ][ Queries: 11 (0.0031s) ][ GZIP on ]