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 Tue 21 Oct 2014, 05:00
All times are UTC - 4
 Forum index » House Training » Beginners Help ( Start Here)
Basic Shell (Console) operation for beginners
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 21 of 24 [350 Posts]   Goto page: Previous 1, 2, 3, ..., 19, 20, 21, 22, 23, 24 Next
Author Message
rhadon


Joined: 27 Mar 2008
Posts: 1293
Location: Germany

PostPosted: Fri 24 Jun 2011, 05:58    Post subject:  

Thanks Mick,

got it. Nice to see you here.

Rolf

_________________
Ich verwende "frugal", und das ist gut so. Wink
Raspberry Pi without Puppy? No, thanks.
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11130
Location: The Peoples Republic of California

PostPosted: Fri 24 Jun 2011, 08:00    Post subject:  

rhadon wrote:
If I can't solve this for me, is it OK to post such questions here (maybe initrd isn't so interesting for others here) or should I post in a separate thread, maybe in Users ( For the regulars )?


Rhadon,

This is why I think couldn't follow. I did what you apparently want to do, and I used a different approach.

I you want to work on this together, please specify exactly what you want and we'll give it a try. But patience, it could take a few days between breaks and all.

Bruce

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
rhadon


Joined: 27 Mar 2008
Posts: 1293
Location: Germany

PostPosted: Fri 24 Jun 2011, 12:31    Post subject:  

Ok Bruce,

here is what I have:

Code:
#!/bin/sh
PSUBDIR="/lupu-525"      #given by init script
ONEPART="sda2"         #given by init script

ls /mnt/home/$PSUBDIR/boot-savefile>/dev/null
if [ "$?" = "0" ]
then
   TST1=`grep "time=" /mnt/home/$PSUBDIR/boot-savefile | cut -f 2 -d '='`
   TST2=`grep "default=" /mnt/home/$PSUBDIR/boot-savefile | cut -f 2 -d '='`
   echo "Savefile #" $TST2 "will start automatically in " $TST1 "seconds." # in init script >/dev/console must be added
   read -t $TST1 NUMSAVE
   [ -z "$NUMSAVE" ] && NUMSAVE=$TST2   
else
   read NUMSAVE         # this is the original place during boot where to select the savefile, ~ line#782 in init script
fi
echo "NUMSAVE="$NUMSAVE      # for testing


This works fine as a stand alone script. It fails in init script.. OK, it is clear, that /mnt/home/ doesn't work.

My first thought, if initrd is loading, I have access to PSUBDIR and everything is fine. Nice dream. Laughing

At this point of the init script it seems to me that nothing is mounted.
#mount gives nothing back. With #ls I can see that I'm in the init-tree.

My idea was/is to mount $ONEPART (here sda2), searching for boot-savefile in $PSUBDIR and to umount it later.
The way I know, #mount /dev/$ONEPART /mnt/$ONEPART doesn't work.

In the README.txt I find:
Code:
/initrd/pup_rw
This is the writable folder. Usually it is tmpfs (temporary filesystem) in ram.
However, a personal storage file (named "pup_save.2fs" or similar) or partition
could be mounted directly on here (in which case it won't be on /initrd/pup_ro1).

So this seems to be the right place to mount sda2 temporarily. But how? All commands in ini about mounting are looking so complicated, I don't understand.

At ~line 176 there's a function called mntfunc(). I assume, most mounting will be done with this function. It seems to check for different file systems. Maybe a better solution than trying myself?

For now I think I must at least specify more, like file system (here ext3) .

What do you think? Is it a workable way?

Opinions from others are also appreciated. Wink

Rolf

_________________
Ich verwende "frugal", und das ist gut so. Wink
Raspberry Pi without Puppy? No, thanks.
Back to top
View user's profile Send private message 
rhadon


Joined: 27 Mar 2008
Posts: 1293
Location: Germany

PostPosted: Sat 25 Jun 2011, 04:43    Post subject:  

Hi,

IT WORKS Very Happy Very Happy Laughing

Code:
    TST3=`echo $PUPSFS | cut -d , -f 2`
   mntfunc $TST3 /dev/$PDEV1 /mnt/dev_ro2
   ls /mnt/dev_ro2$PSUBDIR/boot-savefile >/dev/null
   if [ "$?" = "0" ]
   then
      TST1=$(grep "time=" /mnt/dev_ro2$PSUBDIR/boot-savefile | cut -f 2 -d '=')
      TST2=$(grep "default=" /mnt/dev_ro2$PSUBDIR/boot-savefile | cut -f 2 -d '=')
      echo "If no input +[ENTER], savefile #" $TST2 "will start automatically in " $TST1 "seconds." >dev/console
      umntfunc /mnt/dev_ro2
      read -t $TST1 NUMSAVE
      [ -z "$NUMSAVE" ] && NUMSAVE=$TST2
   else
      umntfunc /mnt/dev_ro2
      echo "To start automatically you can use a textfile named boot-savefile" >/dev/console
      echo "with time=n and default=n in PSUBDIR" >/dev/console
      read NUMSAVE
   fi


If you replace the original line read NUMSAVE in the init script (in Lupu-525 it's line #782) with the complete code above, you should be able to use a textfile named boot-save to boot automatically one of your savefiles or pfix=ram.

boot-savefile (in PSUBDIR) contains only
Code:
time=n
default=n
Replace n with your desired values.

It works for frugal installs on HD and with PSUBDIR.
I don't think it works from CD or without using a subdirectory (now).

I like to hear, what I could do better. Wink

Rolf

Edit:
Just tested a little bit more, it seems to work also fine with Icepuppy-013 and Spup-120.50 but not (now) with Puppy 4.31 or Puppy 4.20. The boot-savefile will not be detected.

_________________
Ich verwende "frugal", und das ist gut so. Wink
Raspberry Pi without Puppy? No, thanks.

Last edited by rhadon on Sat 25 Jun 2011, 13:33; edited 1 time in total
Back to top
View user's profile Send private message 
DaveS


Joined: 09 Oct 2008
Posts: 3726
Location: UK

PostPosted: Sat 25 Jun 2011, 11:42    Post subject:  

Replace read NUMSAVE with read boot-save?
_________________
Spup Frugal HD and USB
Root forever!
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11130
Location: The Peoples Republic of California

PostPosted: Sat 25 Jun 2011, 12:03    Post subject:  

Rolf,

I guess you have it fixed. Nice feeling of satisfaction huh?

Init is a file Barry has been working on and improving for years. I find it fascinating because it reveals how Puppy is so versatile.

Congratulations

Bruce

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
rhadon


Joined: 27 Mar 2008
Posts: 1293
Location: Germany

PostPosted: Sat 25 Jun 2011, 13:27    Post subject:  

DaveS wrote:
Replace read NUMSAVE with read boot-save?
Sorry for being not clear. I've edited my post.

You need to replace read NUMSAVE with the complete code above. It's looking for the boot-savefile and if it's not available, you can select as usual.

Just tested a little bit more, it seems to work also fine with Icepuppy-013 and Spup-120.50 but not (now) with Puppy 4.31 or Puppy 4.20. The boot-savefile will not be detected.

Another bug:
I've had Puppy 4.31 on sda2 and sda10 (the same name of psubdir). Booting from sda10 with Grub, initrd finds only the pupsave files from sda2 and boot from there.
Edit: Seems to be bug in the initscript of 4.31 itself and has nothing to do with my changes. Smile

@Bruce,

Thanks again. Yes it's a great feeling Very Happy , but high and low is very close Rolling Eyes It's a big step for me but far away from being sophisticated.

Rolf

_________________
Ich verwende "frugal", und das ist gut so. Wink
Raspberry Pi without Puppy? No, thanks.
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11130
Location: The Peoples Republic of California

PostPosted: Sun 26 Jun 2011, 09:17    Post subject:  

Rolf

Something like this, but this init is from Lupu 5.20

Quote:
PCPARTSALL="`probepart_init -k`"


Run probepart_init -k to see how it formats

Then for the value is the output for /sda10

In other words, you no longer run probepart for that install. Init thinks there is only one partition to search

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
rhadon


Joined: 27 Mar 2008
Posts: 1293
Location: Germany

PostPosted: Mon 27 Jun 2011, 16:53    Post subject:  

Thanks Bruce,

I appreciate your help.

Maybe it will take some days till I test, because I was running in serious problems and for now I have only 2 partitions.

I tried to get Lupu-525 running on sda6 with raiserfs. It worked. So I tried to get a savefile.rfs running.

Then I made some faults, I really should have known better.

Well, I have back my 2 main partitions, sda1 and sda2. All what I now really miss is one file (~7GB) which was on sda9. Maybe I must create new Partitions and restore this file with an old one, but if I do so, I have no more chance to restore the actual one. Will try it with testdisk again.

Rolf

_________________
Ich verwende "frugal", und das ist gut so. Wink
Raspberry Pi without Puppy? No, thanks.
Back to top
View user's profile Send private message 
Aitch


Joined: 04 Apr 2007
Posts: 6825
Location: Chatham, Kent, UK

PostPosted: Wed 29 Jun 2011, 14:41    Post subject:  

long thread, ....so these may have been posted already....

http://www.pixelbeat.org/cmdline.html#monitor

http://www.pixelbeat.org/docs/linux_commands.html

http://linuxcommand.org/index.php

http://www.linuxguide.it/linux_commands_line_en.htm

and, of course

http://puppylinux.org/wikka/BASH

Aitch Smile
Back to top
View user's profile Send private message 
rhadon


Joined: 27 Mar 2008
Posts: 1293
Location: Germany

PostPosted: Tue 05 Jul 2011, 13:11    Post subject:  

@ Bruce
Thanks again mate.

After playing with probepart_init, I found an older explanation from you here.

So I tested "PDEF1=sda8" in my menu.lst (that's my actual 2nd partition with PSUBDIR=lupu-525) and it works fine.

Rolf

_________________
Ich verwende "frugal", und das ist gut so. Wink
Raspberry Pi without Puppy? No, thanks.
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11130
Location: The Peoples Republic of California

PostPosted: Fri 08 Jul 2011, 01:28    Post subject:  

rhadon wrote:
So I tested "PDEF1=sda8"


May I accept PDEF1=sda8 as a typo meaning to say PDEV1=sda8 ?

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
rhadon


Joined: 27 Mar 2008
Posts: 1293
Location: Germany

PostPosted: Fri 08 Jul 2011, 03:54    Post subject:  

Bruce B wrote:
May I accept PDEF1=sda8 as a typo meaning to say PDEV1=sda8 ?
Yes. Embarassed

Rolf

_________________
Ich verwende "frugal", und das ist gut so. Wink
Raspberry Pi without Puppy? No, thanks.
Back to top
View user's profile Send private message 
Shep

Joined: 08 Nov 2008
Posts: 851
Location: GIRT-BY-SEA

PostPosted: Sat 08 Oct 2011, 01:38    Post subject:  

Very quiet in here ....

I'm trying to store a newline character in a shell variable, e.g.,

C=$(printf "a\nb")
printf "$C" | od -c

Works as expected, and stores the 3 characters.

But if I delete the b, to store just 2 characters, it also drops the \n and stores just one character. Why is this? Question Question

How to make it store a trailing newline? (EDIT: solved: C=$(printf "a\\\nb")

I know about
C='
'
but I'd like to make the printf method work.
Back to top
View user's profile Send private message 
grump


Joined: 10 Oct 2011
Posts: 103
Location: Melbourne, Oz

PostPosted: Sun 23 Oct 2011, 20:05    Post subject:  

All this makes my head hurt. I think you (meaning the main contributors to this thread) vastly over-estimate the abilities of a 'beginner', unless you think of a 'beginner' as a person who is already an experienced coder in other languages.

For example the 1st bit of code in this thread:

Code:
# for i in `ls *.deb`; do undeb $i; shift; done

has at least 3 programming concepts that would be meaningless to the average true 'beginner'.

However, the thread contains lots of good stuff for experienced ppl!
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 21 of 24 [350 Posts]   Goto page: Previous 1, 2, 3, ..., 19, 20, 21, 22, 23, 24 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Beginners Help ( Start Here)
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.0987s ][ Queries: 13 (0.0100s) ][ GZIP on ]