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 Thu 18 Dec 2014, 23:58
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Help page update.
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
mavrothal


Joined: 24 Aug 2009
Posts: 1894

PostPosted: Mon 15 Dec 2014, 08:56    Post subject:  Help page update.  

Is not really a programming but rather a design question.
Working on "modernising" PPM a bit, I realised that when you install or remove a package in puppy at the end of each process it runs 2 rather slow scripts with tons of sed and gerp, fixmenus and indexgen.sh.
fixmenus we all know. indexgen.sh however, is checking all desktop apps and updates the "Applications available in the desktop menu" drop-down menu, of /usr/share/doc/index.html.
I hardly new that this menu exists Rolling Eyes so I was thinking to move the indexgen.sh call not after every package installation or removal but after PPM closes (or after we install a local package with petget). The upside is obvious, (perceived) speed. The downside is that this info will not be available immediately after installation but only after PPM is closed (and if it crashes till the next time PPM is closed or a local pet is installed).
As I said I never used this info so I do not think that is a major problem to make it available after PPM is closed, but I would like to here from others about it. Preferably on a usage base rather than philosophical...

_________________
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 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Mon 15 Dec 2014, 09:10    Post subject:  

Can you post the script or post a link to it on the github woof-ce repo? I've already rewritten that once - it was a hot mess and my changes didn't get integrated, so I assume it still is.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2610
Location: www.eussenheim.de/

PostPosted: Mon 15 Dec 2014, 09:34    Post subject: ondexgen.sh
Subject description: speed up
 

Source: /usr/sbin/indexgen.sh of puppy_precise_5.7.1.sfs
Code:
#!/bin/bash
#(c) Copyright Barry Kauler 2009, puppylinux.com.
#2009 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
#generates index.html master help page. called from petget, rc.update,
#  /usr/local/petget/installpreview.sh, 3builddistro (in Woof).
#w012 commented-out drop-down for all installed pkgs as too big in Ubuntu-Puppy.
#w016 support/find_homepages (in Woof) used to manually update HOMEPAGEDB variable.
#w019 now have /root/.packages/PKGS_HOMEPAGES
#w464 reintroduce dropdown help for all builtin packages.
#v423 file PKGS_HOMEPAGES is now a db of all known pkgs, not just in puppy.
#120225 copy from raw doc files.

export LANG=C
. /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION, DISTRO_PUPPYDATE
. /root/.packages/DISTRO_PKGS_SPECS

WKGDIR="`pwd`"

#120225 this is done in Woof by rootfs-skeleton/pinstall.sh, but do need to do it
#here to support language translations (see /usr/share/sss/doc_strings)...
if [ -f /usr/share/doc/index.html.top-raw ];then #see Woof rootfs-skeleton/pinstall.sh, also /usr/share/sss/doc_strings
 cp -f /usr/share/doc/index.html.top-raw /usr/share/doc/index.html.top
 cp -f /usr/share/doc/index.html.bottom-raw /usr/share/doc/index.html.bottom
 cp -f /usr/share/doc/home-raw.htm /usr/share/doc/home.htm

 cutDISTRONAME="`echo -n "$DISTRO_NAME" | cut -f 1 -d ' '`"
 cPATTERN="s/cutDISTRONAME/${cutDISTRONAME}/g"
 RIGHTVER="$DISTRO_VERSION"
 dPATTERN="s/PUPPYDATE/${DISTRO_PUPPYDATE}/g"
 PATTERN1="s/RIGHTVER/${RIGHTVER}/g"
 PATTERN2="s/DISTRO_VERSION/${DISTRO_VERSION}/g"
 nPATTERN="s/DISTRO_NAME/${DISTRO_NAME}/g"
 
 sed -i -e "$PATTERN1" -e "$PATTERN2" -e "$nPATTERN" -e "$dPATTERN" -e "$cPATTERN" /usr/share/doc/index.html.top
 sed -i -e "$PATTERN1" -e "$PATTERN2" -e "$nPATTERN" -e "$dPATTERN" /usr/share/doc/index.html.bottom
 #...note, /usr/sbin/indexgen.sh puts these together as index.html (normally via rc.update and 3builddistro).
 
 sed -i -e "$nPATTERN" /usr/share/doc/home.htm
fi

#search for installed pkgs with descriptions...

#search .desktop files...
PKGINFO1="`ls -1 /usr/share/applications | sed -e 's%^%/usr/share/applications/%' | xargs cat - | grep '^Name=' | cut -f 2 -d '='`"
#...normal format of each entry is 'name description', ex: 'Geany text editor'.

#w012 commented out...
##search pkg database...
##want to get entries 'nameonly|description', ex: 'abiword|A wonderful wordprocessor'
##user-installed...
#USER_INSTALLED_INFO="`cut -f 2,10 -d '|' /root/.packages/user-installed-packages`"
##builtin pet pkgs...
#if [ ! -f /tmp/petget_builtin_pet ];then
# BUILTIN_PET_NAMES="`echo "$PKGS_SPECS_TABLE" | grep '^yes' | cut -f 2,3 -d '|' | grep '|$' | sed -e 's%^%|%'`" #ex: '|abiword|'
# echo "$BUILTIN_PET_NAMES" > /tmp/petget_builtin_pet
#fi
#BUILTIN_PET_INFO="`grep --file=/tmp/petget_builtin_pet /root/.packages/Packages-puppy-* | cut -f 2-9 -d ':' | cut -f 2,10 -d '|'`"
##builtin compatible-distro pkgs...
#if [ ! -f /tmp/petget_builtin_system ];then #pkg_chooser.sh creates this.
# BUILTIN_COMPAT_NAMES="`echo "$PKGS_SPECS_TABLE" | grep '^yes' | cut -f 3 -d '|' | tr ',' '\n' | sort -u | grep -v '^$' | sed -e 's%[0-9]$%%' -e 's%\\-%\\\\-%g' -e 's%\\*%.*%g' -e 's%^%^%'`"
# echo "$BUILTIN_COMPAT_NAMES" >/tmp/petget_builtin_system
#fi
#BUILTIN_COMPAT_INFO="`grep --file=/tmp/petget_builtin_system /root/.packages/Packages-${DISTRO_BINARY_COMPAT}-*  | cut -f 2-9 -d ':' | cut -f 2,10 -d '|'`"
#PKGINFODB="${USER_INSTALLED_INFO}
#${BUILTIN_PET_INFO}
#${BUILTIN_COMPAT_INFO}"
##tidy it up...
#PKGINFODB="`echo "$PKGINFODB" | grep -v -E '_DEV|_DOC|_NLD' | sort --key=1 --field-separator='|' --unique | sed -e 's%|%||||||||||||||||||||||||||||||%' | uniq --check-chars=32 | tr -s '|'`"
##...code on end gets rid of multiple hits.

EXCLLISTsd=" 0rootfs_skeleton autologin bootflash burniso2cd cd/dvd check configure desktop format network pupdvdtool wallpaper pbackup pburn pcdripper pdict pdisk pdvdrsab pmetatagger pschedule pstopwatch prename pprocess pmirror pfind pcdripper pmount puppy pupctorrent pupscan pupx pwireless set text "

cp -f /usr/share/doc/index.html.top /tmp/newinfoindex.xml

#dropdown menu for apps in menu...
echo '<p>Applications available in the desktop menu:</p>' >>/tmp/newinfoindex.xml
echo '<center>
<form name="form">
<select name="site" size="1" onchange="javascript:formHandler()">
' >>/tmp/newinfoindex.xml
echo "$PKGINFO1" |
while read ONEINFO
do
 NAMEONLY="`echo "$ONEINFO" | cut -f 1 -d ' ' | tr [A-Z] [a-z]`"
 EXPATTERN=" $NAMEONLY "
 nEXPATTERN="^$NAMEONLY "
 [ "`echo "$EXCLLISTsd" | grep -i "$EXPATTERN"`" != "" ] && continue
 HOMESITE="http://en.wikipedia.org/wiki/${NAMEONLY}"
 REALHOME="`cat /root/.packages/PKGS_HOMEPAGES | grep -i "$nEXPATTERN" | head -n 1 | cut -f 2 -d ' '`"
 [ "$REALHOME" != "" ] && HOMESITE="$REALHOME"
 echo "<option value=\"${HOMESITE}\">${ONEINFO}" >> /tmp/newinfoindex.xml
done
echo '</select>
</form>
</center>
' >> /tmp/newinfoindex.xml

#w464 dropdown list of all builtin pkgs...
echo '<p>Complete list of packages (in Puppy or not):</p>' >>/tmp/newinfoindex.xml
echo '<center>
<form name="form2">
<select name="site2" size="1" onchange="javascript:formHandler2()">
' >>/tmp/newinfoindex.xml
sed -e 's% %|%' -e 's%$%|%' /root/.packages/PKGS_HOMEPAGES > /tmp/pkgs_homepages_mod
printcols /tmp/pkgs_homepages_mod 2 1 | sed -e 's%^%<option value="%' -e 's%|$%#%' -e 's%|%">%' -e 's%#$%%' >> /tmp/newinfoindex.xml
sync
echo '</select>
</form>
</center>
' >> /tmp/newinfoindex.xml

#w012 commented out...
##dropdown menu for all installed pkgs...
#echo '<p>All packages installed in Puppy:</p>' >>/tmp/newinfoindex.xml
#echo '<center>
#<form name="form2">
#<select name="site2" size="1" onchange="javascript:formHandler2()">
#' >>/tmp/newinfoindex.xml
#echo "$PKGINFODB" |
#while read ONEINFO
#do
# [ "$ONEINFO" = "" ] && continue
# NAMEONLY="`echo "$ONEINFO" | cut -f 1 -d '|' | tr [A-Z] [a-z]`"
# EXPATTERN=" $NAMEONLY "
# nEXPATTERN="^$NAMEONLY "
# [ "`echo "$EXCLLISTsd" | grep -i "$EXPATTERN"`" != "" ] && continue
# HOMESITE="http://en.wikipedia.org/wiki/${NAMEONLY}"
# REALHOME="`echo "$HOMEPAGEDB" | grep -i "$nEXPATTERN" | head -n 1 | cut -f 2 -d ' '`"
# [ "$REALHOME" != "" ] && HOMESITE="$REALHOME"
# xONEINFO="`echo -n "$ONEINFO" | sed 's%|%:  %'`"
# echo "<option value=\"${HOMESITE}\">${xONEINFO}" >> /tmp/newinfoindex.xml
#done
#echo '</select>
#</form>
#</center>
#' >> /tmp/newinfoindex.xml

##dropdown menu for all executables...
#echo '<p>All executable files in Puppy:</p>' >>/tmp/newinfoindex.xml
#echo '<center>
#<form name="form">
#<select name="site" size="1" onchange="javascript:formHandler()">
#' >>/tmp/newinfoindex.xml
#echo "$PKGINFONODESCR" |
#while read ONEINFO
#do
# [ "`echo "$ONEINFO" | grep -E 'NOTUSED|FULL|\.bin$|config$|README|OLD|\.glade$'`" != "" ] && continue
# EXPATTERN=" $ONEINFO "
# [ "`echo "$EXCLLISTsd" | grep -i "$EXPATTERN"`" != "" ] && continue
# echo "<option value=\"http://linux.die.net/man/${ONEINFO}\">${ONEINFO}</option>" >> /tmp/newinfoindex.xml
#done
#echo '</select>
#</form>
#</center>
#' >> /tmp/newinfoindex.xml

#now complete the index.html file...
cat /usr/share/doc/index.html.bottom >> /tmp/newinfoindex.xml
mv -f /tmp/newinfoindex.xml /usr/share/doc/index.html


###END###

speed up by change
Code:
REALHOME="`cat /root/.packages/PKGS_HOMEPAGES | grep -i "$nEXPATTERN" | head -n 1 | cut -f 2 -d ' '`"

to
Code:
REALHOME="`grep -i -m 1 "$nEXPATTERN" /root/.packages/PKGS_HOMEPAGES`"
REALHOME=${REALHOME#* }
and others....

and/or cache it and add changes to that cache
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 1894

PostPosted: Mon 15 Dec 2014, 10:26    Post subject:  

technosaurus wrote:
Can you post the script or post a link to it on the github woof-ce repo? I've already rewritten that once - it was a hot mess and my changes didn't get integrated, so I assume it still is.

There you go
https://github.com/puppylinux-woof-CE/woof-CE/blob/testing/woof-code/rootfs-skeleton/usr/sbin/indexgen.sh

_________________
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 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Mon 15 Dec 2014, 11:51    Post subject:  

I'm running fatdog64 ATM, so don't have $HOME/.packages, but here is a start (1st arg is the file you want it to go to)
Code:
#!/bin/sh

echo '<p>Applications available in the desktop menu:</p>
<center>
<form name="form">
<select name="site" size="1" onchange="javascript:formHandler()">
' >> "$1"

IFS="= "
grep -h -m1 "^Name=" /usr/share/applications/*.desktop | while read X N F; do
echo "<option value='http://en.wikipedia.org/wiki/${N}'\>${N} ${F}"
done >> "$1"

echo '</select>
</form>
</center>' >> "$1"


Keep in mind Puppy has a bunch of retarded desktop files that don't meet any sane guidelines.

_________________
Web Programming - Pet Packaging 100 & 101

Last edited by technosaurus on Mon 15 Dec 2014, 12:04; edited 1 time in total
Back to top
View user's profile Send private message 
mavrothal


Joined: 24 Aug 2009
Posts: 1894

PostPosted: Mon 15 Dec 2014, 12:03    Post subject:  

technosaurus wrote:
I'm running fatdog64 ATM, so don't have $HOME/.packages, but here is a start (1st arg is the file you want it to go to)

I'm not sure I want to rewrite indesgen.sh for now, but Thanks.
If you have the chance to boot a puppy and maybe offer a more complete version, would be supper.

_________________
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 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Mon 15 Dec 2014, 12:11    Post subject:  

Sadly that pretty much covers it, most of the second part is a duplicate of the first and the ones that aren't are not really useful to users.
If someone could give the output of head and/or tail for /root/.packages/PKGS_HOMEPAGES the rest would only take me a minute or so to knock out.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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.0889s ][ Queries: 11 (0.0063s) ][ GZIP on ]