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 16 Sep 2014, 09:37
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Creatiing a new iso: new pinstall.sh scripts
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [8 Posts]  
Author Message
papaschtroumpf


Joined: 17 Jun 2005
Posts: 250

PostPosted: Wed 22 Jun 2005, 01:27    Post subject:  Creatiing a new iso: new pinstall.sh scripts  

the "configuring fvwm95 menu" step of creating a new iso takes forever(over an hour), and several other steps that loop on every keyword also take a long time.
Maybe it's because I'm running under Virtual PC rather than a real machine but everything else seems to run at decent speed (the host machine is an Athlon XP3200+ with 1G of RAM, although the virtual machine only gets 256M).
Procesor usage is at close to 100% during that time.

I'm trying to understand what the psinstall.sh for fvwm95 does.

it looks like given a list of keywords it searches for the pattern :#+ "KEYWORD and removes the #

I don't understand why it is processed one line at a time by creating a new process for each line, etc...

unless the version of sed in puppy has limitations that one wouldn't expect, you should be able to process the entire file in one command. For example for the keyword Mozilla:

sed -e 's/^#+ "Mozilla/+ "Mozilla/' fvwm95rc >txt
mv -f txt fvwm95rc

this would uncomment the 4 instances of Mozilla (browser, address book, ...)

You would still need to run the command for every keyword but there are at most 300 of them so it shouldn't take an hour:

#!/bin/sh
for ONEKEY in $KEYWORDS
do
sed -e "s/^#+ \"$ONEKEY /+ \"$ONEKEY /" .fwvm95rc >txt
cp -f txt .fwvm95rc
done

you might be able to use the -in-place option of sed rather than do a copy if puppy supports it but I'm not sure it would be faster.

_________________
Mandriva LE 2005 user and puppy newbie
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Wed 22 Jun 2005, 05:22    Post subject:  

yes, the "createpuppy" script does that awfully slowly.
At the time I was learning how to filter through a text file line-by-line using only Bash/Ash script. The method chosen is inefficient.

Well, you could rewrite it, if you can think of some better way.
I did come up with something better later on, but the thing is, when something is working, it gets placed lower on the priority list.
Back to top
View user's profile Send private message Visit poster's website 
papaschtroumpf


Joined: 17 Jun 2005
Posts: 250

PostPosted: Wed 22 Jun 2005, 10:08    Post subject:  

I'll give it a shot.I'm taking a "snpahot" of what the relevant files look like at the end of the process so I can compare it to the output of the one I intend to write.
I'll let you know if I come up with something good and you can decide if you want to incorporate it in future versions or not.

_________________
Mandriva LE 2005 user and puppy newbie
Back to top
View user's profile Send private message 
papaschtroumpf


Joined: 17 Jun 2005
Posts: 250

PostPosted: Wed 22 Jun 2005, 12:34    Post subject:  

What does the similar loop in 0rootfs_skeletton.... (starting around line 62) do exactly? I haven't fully "unwrapped" the script yet.

EDIT: looks like it builds the documentation index.html file but not sure what its input is yet.
EDIT AGAIN: OK I get it now, all it does is uncomment the right lines in index.html. I assume PupGet does something similar when you add a package, otherwise it waste less space to simply remove the line.

I'll see if I can speed up that one too.

_________________
Mandriva LE 2005 user and puppy newbie
Back to top
View user's profile Send private message 
papaschtroumpf


Joined: 17 Jun 2005
Posts: 250

PostPosted: Wed 22 Jun 2005, 17:47    Post subject:  

Barry, why don't you give this a try:

replace the pinstall.sh in 0root-skeleton-1.0.3 with the following and let me know if the resulting files are OK (It doesn't remove the spaces after "<!--")

I only changed the part that took a long time (rebuilding index.html) why touch the rest if it ain't broke?

Takes seconds instead of many minutes.

Code:

#!/bin/sh
#post-install script.
#Puppy Linux
#assume current directory is rootfs-complete, which has the final filesystem.
#this script is similar to the post-install scripts of the window managers.
#Keywords are located in the Help page and the lines uncommented.

WKGDIR="`pwd`"

CONFIGFILE="usr/share/doc/index.html"
CONFIGBASE="index.html"
echo "Configuring Puppy skeleton..."

#cleanup...
rm -f /tmp/fbvideomode.txt


#/tmp/keywords.txt has all the keywords read from file "keyword" in each package.
KEYWORDS="`cat /tmp/keywords.txt`"
NUMKEYS="`wc -w /tmp/keywords.txt | tr -s " " | cut -f 2 -d " "`"

#number lines in the config file...
NUMLINES="`wc -l $CONFIGFILE | tr -s " " | cut -f 2 -d " "`"

#update Puppy version number...
PUPPYVERSION="`cat root0/.etc/puppyversion`"
#echo
echo "Have read rootfs-complete/etc/puppyversion."
echo "The current version of Puppy is $PUPPYVERSION (3 digits, no dots)."
echo -n "Type a new value now, or only press ENTER to keep current: "
read nnnn
if [ ! "$nnnn" = "" ];then
 echo "Puppy version is now $nnnn"
 PUPPYVERSION="$nnnn"
fi
rm -f root0/.etc/puppyversion
echo -n "$PUPPYVERSION" > root0/.etc/puppyversion
DIGIT1="`echo "$PUPPYVERSION" | cut -b 1`"
DIGIT2="`echo "$PUPPYVERSION" | cut -b 2`"
DIGIT3="`echo "$PUPPYVERSION" | cut -b 3`"
RIGHTVER="${DIGIT1}.${DIGIT2}.${DIGIT3}"

echo "Configuring Puppy Help page..."

echo "Writing version number to Help page..."
#insert the version number into file...
EDITTEXT="s/PUPPYVERSION/$RIGHTVER/g"
cat $CONFIGFILE | sed -e "$EDITTEXT" > /tmp/puphelppage.htm
sync
cp -f /tmp/puphelppage.htm $CONFIGFILE
sync

#insert date into file...
echo "Writing the date to Help page..."
PUPPYDATE="`date | tr -s " " | cut -f 2,6 -d " "`"
EDITTEXT="s/PUPPYDATE/$PUPPYDATE/g"
cat $CONFIGFILE | sed -e "$EDITTEXT" > /tmp/puphelppage.htm
sync
cp -f /tmp/puphelppage.htm $CONFIGFILE
sync


REBUILDMENU="yes"
if [ -f /tmp/bypassmenurebuild ];then
 #bypassmenurebuild will only exist if previous execution of createpuppy had the
 #identical chosen packages.
 if [ -f ../$CONFIGBASE.bak ];then
  cp -f ../$CONFIGBASE.bak $CONFIGFILE
  REBUILDMENU="no"
 fi
fi

if [ "$REBUILDMENU" = "yes" ];then
 echo "The number of keywords to process is $NUMKEYS."
 echo "Processing keywords..."
 for ONEKEY in $KEYWORDS
 do
  echo -n " $ONEKEY"
  sync
  #remove the <!-- and --> markers if the line contains the keyword
  EDITTEXT="s/^<!--\(.\+$ONEKEY.\+\)-->/\1/"
  sed -e "$EDITTEXT" $CONFIGFILE > /tmp/0rootfs_skeleton.pinstall.temp
  sync
  mv -f /tmp/0rootfs_skeleton.pinstall.temp $CONFIGFILE
 done
 cp -f $CONFIGFILE ../$CONFIGBASE.bak
fi
rm -f /tmp/0rootfs_skeleton.pinstall.temp

echo
echo "...rootfs-complete/$CONFIGFILE file has been processed."

#echo "The default kernel for Puppy is vmlinuz."
echo -n "vmlinuz" > /tmp/vmlinuzforpup.txt
#note, createpuppy will read this.

#end#




I'm working on changing the pinstall.sh for fvm95 to make it faster too and I'll post it when I'm done.

_________________
Mandriva LE 2005 user and puppy newbie
Back to top
View user's profile Send private message 
papaschtroumpf


Joined: 17 Jun 2005
Posts: 250

PostPosted: Wed 22 Jun 2005, 19:40    Post subject:  

Here's the fast version of the pinstall.sh for fvwm95
(only changed the menu building which was taking forever)

Code:

#!/bin/sh
#post-install script.
#Puppy Linux
#assume current directory is rootfs-complete, which has the final filesystem.
WKGDIR="`pwd`"

####CHANGE THESE THREE LINES FOR ANOTHER W.M.#####
echo "Configuring menu for Fvwm95 window manager..."
CONFIGFILE="root0/.fvwm95rc"
CONFIGBASE="DOTfvwm95rc"

#...for example above line actually finds string:  #+ "Gcombust
#   replaces it with + "Gcombust, in case of keyword being Gcombust.
#   The above code is somewhat obfuscated. What we end up with below is:
#    sed -e 'g/#+ "Gcombust/+ "Gcombust/s'

#...well, this is simply removing a # in column 1 to uncomment the line.
#   an xml config file may have <!-- stuff in here --> so you will have to
#   do it a bit differently -- see JWM post-install script for an example.

#/tmp/keywords.txt has all the keywords read from file "keyword" in each package.
KEYWORDS="`cat /tmp/keywords.txt`"
NUMKEYS="`wc -w /tmp/keywords.txt | tr -s " " | cut -f 2 -d " "`"

REBUILDMENU="yes"
if [ -f /tmp/bypassmenurebuild ];then
 #bypassmenurebuild will only exist if previous execution of createpuppy had the
 #identical chosen packages.
 if [ -f ../$CONFIGBASE.bak ];then
  cp -f ../$CONFIGBASE.bak $CONFIGFILE
  REBUILDMENU="no"
 fi
fi

if [ "$REBUILDMENU" = "yes" ];then
 echo "The number of keywords to process is $NUMKEYS."
 echo "Processing keywords (this may take awhile!)..."

 for ONEKEY in $KEYWORDS
 do
  echo -n " $ONEKEY"
  #remove the # at the start of the line if it is #+ "ONEKEY
  EDITTEXT="s/^#+ \"$ONEKEY /+ \"$ONEKEY /"
  sync
  sed -e "$EDITTEXT" $CONFIGFILE > /tmp/fvwm95.pinstall.temp
  sync
  mv -f /tmp/fvwm95.pinstall.temp $CONFIGFILE
 done
 cp -f $CONFIGFILE ../$CONFIGBASE.bak
fi
rm /tmp/fvwm95.pinstall.temp
echo
echo "...rootfs-complete/$CONFIGFILE file has been processed."

#NOTE:
#This script is not complete. Unfortunately there is an inconsistency in the format
#of menu syntax in Fvwm config file, and curently have left the first item in each
#menu group permanently enabled. It is probably possible to rectify that, but will
#need some crafty code here. Basically, first item has a space or tab in column one,
#following items have a + character.
echo
echo "WARNING: Unfortunately there is an inconsistency in the /root/.fvwm95rc config"
echo "file such that the first item in each sub-menu cannot be commented-out."
echo "The items are:"
echo " Find menu: Gtkcat, Run menu: Xrun, Games menu: Bubbles, Multimedia: Xtmix,"
echo " Internet menu: Gftp, Graphics: Xpaint, Wordprocessing: Abiword, Calc: Xcalc,"
echo " Information menu: Xcalendar, File menu: ROX-Filer."
echo "This means that you MUST choose these packages, otherwise you need to manually"
echo "edit /root0/.fvwm95rc."
echo
echo -n "Press ENTER key to continue script: "
read mmnn

#end#


jwm script coming up soon

_________________
Mandriva LE 2005 user and puppy newbie
Back to top
View user's profile Send private message 
papaschtroumpf


Joined: 17 Jun 2005
Posts: 250

PostPosted: Wed 22 Jun 2005, 20:14    Post subject:  

as promised this is the pinstall.sh script for the jwm unleashed, rebuilds the menus in a fraction of the time.

I'll do more testing later to make sure it's all fine. Let me know if you find any issues.

Code:

#!/bin/sh
#post-install script.
#Puppy Linux
#assume current directory is rootfs-complete, which has the final filesystem.
WKGDIR="`pwd`"

####CHANGE THESE LINES FOR ANOTHER W.M.#####
CONFIGFILE="root0/.jwmrc"
CONFIGBASE="DOTjwmrc"
echo "Configuring menu for JWM window manager..."
####ALSO CHANGE CODE BELOW THAT UNCOMMENTS LINE####

#...JWM config file is in xml format, all menu items commented out:
#   <!--   <Program label="Gcombust" icon="gcombust.xpm">gcombust</Program> -->

#/tmp/keywords.txt has all the keywords read from file "keyword" in each package.
KEYWORDS="`cat /tmp/keywords.txt`"
NUMKEYS="`wc -w /tmp/keywords.txt | tr -s " " | cut -f 2 -d " "`"


REBUILDMENU="yes"
if [ -f /tmp/bypassmenurebuild ];then
 #bypassmenurebuild will only exist if previous execution of createpuppy had the
 #identical chosen packages.
 if [ -f ../$CONFIGBASE.bak ];then
  cp -f ../$CONFIGBASE.bak $CONFIGFILE
  REBUILDMENU="no"
 fi
fi

if [ "$REBUILDMENU" = "yes" ];then
 echo "The number of keywords to process is $NUMKEYS."
 echo "Processing keywords (this may take awhile!)..."
 for ONEKEY in $KEYWORDS
 do

  echo -n " $ONEKEY"
  sync
  #remove the <!-- and --> markers if the line contains the keyword
  EDITTEXT="s/^<!-- \+\(<Program label=\"$ONEKEY.\+\)-->/\1/"
  sed -e "$EDITTEXT" $CONFIGFILE > /tmp/jwm.pinstall.temp
  sync
  mv -f /tmp/jwm.pinstall.temp $CONFIGFILE
  sync
 done
 cp -f $CONFIGFILE ../$CONFIGBASE.bak
fi
  rm -f /tmp/jwm.pinstall.temp
echo
echo "...rootfs-complete/$CONFIGFILE file has been processed."

#v1.0.3
#case of fvwm95 not there...
if [ ! -f /usr/X11R6/bin/fvwm95 ];then
 echo -n "jwm" > ./etc/windowmanager
fi
sync

#end#


_________________
Mandriva LE 2005 user and puppy newbie
Back to top
View user's profile Send private message 
papaschtroumpf


Joined: 17 Jun 2005
Posts: 250

PostPosted: Thu 23 Jun 2005, 23:56    Post subject:  

I made the scripts available in one easy to apply path, see this thread: http://www.murga.org/~puppy/viewtopic.php?p=4123#4123
_________________
Mandriva LE 2005 user and puppy newbie
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [8 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
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.0968s ][ Queries: 11 (0.0192s) ][ GZIP on ]