pUPnGO - 6Mb ISO - Basic Building Block Puplet

A home for all kinds of Puppy related projects
Message
Author
User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#221 Post by technosaurus »

here is the calculator ported to getgui

Code: Select all

#!/bin/sh
A=`awk "BEGIN{print $1}"`
A=`getgui calculator -keyin -initval $A`
[ $A ] && $0 $A
and a minimal process killer gui

Code: Select all

#!/bin/sh
L=`ps -a |grep -v PID |awk '{print $1"\t\t"$4}'`
kill `getgui -title "ggProcess" -msg "Select process to kill" -selectbox "PID    CMD_NAME\n$L" -buttons "Kill|Close" -okstr Kill |cut -d " " -f1`
Attachments
ggprocess.png
(6.98 KiB) Downloaded 1301 times
calc.png
(3.11 KiB) Downloaded 1326 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

freememapplet

#222 Post by goingnuts »

I have been missing freememapplet in the pupngo GUI-part...but it needs so many libs...
Managed to link libgcc and libstdc++ static and this leaves freememapplet with dependencies already present. But binary goes from 20K to 524K! UPX-ed it gets down to 155K. Still a lot just to show what it shows. But here it is if anybody misses it.
Changed font to fixed and included the 3 xpms needed.
Attachments
freememapplet.tar.gz
freememapplet static libgcc/libstdc++
(156.11 KiB) Downloaded 496 times

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#223 Post by technosaurus »

Thanks - it does come in handy to know why things have started to slow down and even fail (the -flto flag in my new gcc compile uses ~3X the disk space as without it -which is actually useful to lower ram usage when it is not running in RAM like I typically do)
Compiling c++ for size is a daunting, sometimes painful task if you want to link statically with libstdc++ (similar to glibc, lots of inlining makes it rather large)
for c++ apps you can try compiling with -fno-rtti and -fno-exceptions added to the CXXFLAGS as well as doing the final link with gcc instead of g++ and linking libsupc++ instead of libstdc++

Note: When compiling with -fno-exceptions, if you get an error refering to exceptions, you can usually remove the catch code that gcc refers to without affecting operation ... maybe just do a print to stderr in its place

If you still aren't satisfied with your results there are some alternatives.

I have tried uclibc++ with uclibc and it worked great (it uses a gcc wrapper), but have been meaning to try it with glibc or alternatively stlport or the seemingly more promisingustl

here is one example program I compiled statically with uclibc and uclibc++
http://www.murga-linux.com/puppy/viewtopic.php?t=60395
(it was roughly the same size as the shared glibc version)

On a side note I think it would be an interesting project to make a tray applet frontend that all it does is refresh icons at some periodicity and run an application when clicked (maybe add a right click later)
This would allow one process to handle them all and conserve RAM

Code: Select all

trayapplet - copyleft 2011 technosaurus
    usage:
# trayapplet icon1:refreshtime:leftclickcommand:rightclickcommand icon2
default values: X seconds, no command, and start/stop/help/about menu
this would allow the icons to be updated using a shell script (by changing a symlink, regenerating the icon etc...) btw I compiled ploticus (same maintainer as getgui) last night - it is EXTREMELY fast at generating images - no extra dependencies either - will post if interested ... did several different versions with various combinations of SVG, png, X11, ps, gif enabled ranging from <300k to almost 600k, but all are really fast and light ... I may try to tweak mtcelledit to use ploticus instead of mtcellplot
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

#224 Post by emil »

goingnuts:
Do not work in P431 but could be modified to do so (different squashfs/aufs-version I think). Works only with aufs (but same functionality could be made with unionfs using unionctl).
Worked a little more with otf_sfs_loader. Added:
...
#check aufs version (for future P431 comp.)
hi - I tried to use the OTF_SFS Loader with Lupq-511, but it wont run because aufsfilesystem check fails. You write that it possibly could be modified, do you have any specific hint how and where?
thanks in advance!
emil

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

otf_sfs in puppy 5

#225 Post by emil »

goingnuts wrote:
Do not work in P431 but could be modified to do so (different squashfs/aufs-version I think). Works only with aufs (but same functionality could be made with unionfs using unionctl).
Worked a little more with otf_sfs_loader. Added:
...
#check aufs version (for future P431 comp.)
hi - I tried to use the OTF_SFS Loader with Lupq-511, but it wont run because aufs filesystem check fails. You write that it possibly could be modified, do you have any specific hint how and where?
thanks in advance!
emil

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

otf_sfs in puppy 5

#226 Post by emil »

goingnuts wrote:
Do not work in P431 but could be modified to do so (different squashfs/aufs-version I think). Works only with aufs (but same functionality could be made with unionfs using unionctl).
Worked a little more with otf_sfs_loader. Added:
...
#check aufs version (for future P431 comp.)
hi - I tried to use the OTF_SFS Loader with Lupq-511, but it wont run because aufs filesystem check fails. You write that it possibly could be modified, do you have any specific hint how and where?
thanks in advance!
emil

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#227 Post by goingnuts »

Might as well use this area to store build code for the freememapplet in previous post. Here is the source
And build script:

Code: Select all

#!/bin/sh
rm -f freememapplet.o freememapplet
ln -s $(g++ -print-file-name=libstdc++.a)
g++ -static-libgcc -fno-rtti -fno-exceptions -L. -L /usr/X11R7/lib -lX11 -lXpm -o freememapplet freememapplet.cc
strip --strip-all freememapplet*
Last edited by goingnuts on Fri 07 Jan 2011, 22:09, edited 3 times in total.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#228 Post by goingnuts »

dbl post
Last edited by goingnuts on Fri 07 Jan 2011, 05:26, edited 1 time in total.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#229 Post by goingnuts »

dbl post
Last edited by goingnuts on Fri 07 Jan 2011, 05:25, edited 1 time in total.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#230 Post by goingnuts »

dbl post
Last edited by goingnuts on Fri 07 Jan 2011, 05:25, edited 1 time in total.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#231 Post by goingnuts »

dbl post
Last edited by goingnuts on Fri 07 Jan 2011, 05:24, edited 1 time in total.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#232 Post by goingnuts »

emil wrote: hi - I tried to use the OTF_SFS Loader with Lupq-511, but it wont run because aufsfilesystem check fails. You write that it possibly could be modified, do you have any specific hint how and where?
thanks in advance!
emil
gyro has done sfs-load/unload scripts that works in P431 - here.
Remember that the sfs-file should be outside the current / branch. I started to implement it in present otf-sfs-loader but aufs2 reports different than aufs1 and maybe better to do a otf-sfs-script for 431 and dont make a common 412/431-script.
Anyway gyros script is an excellent starting point as it basically do the same as my script - load and unload sfs files.

Below a small wrapper for pupngo that loads GUI_412.sfs present on boot-cd after cd-boot when xwin is called (and without savefile) - name it whatever and start xwin via the script:

Code: Select all

#!/bin/sh
mount /dev/sr0 /mnt/cdrom
otf_sfs_loader.sh /mnt/cdrom/GUI_412.sfs
exec xwin
exit
Same principle could be expanded to jwm-menu...sort of load relevant application-sfs when needed...just for inspiration...

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#233 Post by technosaurus »

I wrote a similar script when I was working on 4.4, but lost it when gparted dumped my ntfs drive during a resize operation. There were 2 significant differences though:

1. I placed the loader script in /usr/local/bin (because its near the end of $PATH) with the same name as the executable in its <application>.desktop file
2. I then preemptively put the <application>.desktop file in /usr/share/applications (causing a menu entry to be created)
{{3.I should have probably added any include mime type entries to $HOME/Choices/...}}
{{4. the final line that executes the command should get a $@ to allow for usage if called by rox or the user with an argument}}

the result was that if an application's sfs was _not_ loaded, the script would be executed (which loads the application and then runs the program), but if the sfs was already loaded, it would just run the actual program (because it is higher in the $PATH) ... pretty simple and reduces ram usage and boot times

possible issues: I had heard (I think on Barry's blog) that mounting too many loop devices could significantly slow things down. I didn't see a big difference, but I was already considering a rewrite for app categories that grouped apps according to dependencies in some type of dependency based hierachy... X11 only, gtk only, gtk & c++ & ?, etc... I think this issue is largely overcome in recent kernels though, so it may even be possible to use ldd to get the library filenames to use, such as:

Code: Select all

[ ! -f /usr/lib/libgtk-x11-2.0.so.1 ] && loadgtk2
Thanks for this exchange - I had almost completely forgotten this train of thought.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#234 Post by goingnuts »

technosaurus wrote:Thanks for this exchange - I had almost completely forgotten this train of thought.
Thanks for the response - you are (as always) 3-10 steps ahead! The principle of using placement in PATH is perfect. I do not see any performance decrease loading up to 30 sfs-files - but I do see an increased demand for ram...unless the sfs-loading is used as as package-manager-system users rarely have need for having more than 30 sfs loaded - and performance might also be depending on the size of the sfs?

I have challenged the getgui a little and might include it later in the dialogfunctions.sh but only using its menu, input & message functions as its file-function chokes if number of files is high (haven't tested if the same occurs for the menu) - would be nice if that could be fixed but it seems to be 5-6 years since the developer worked on it.

Concerning the freememapplet it really should be possible to make a much smaller application - this site has a huge collection of tray-applets and some of them do not depend on libstdc++.
For the idea of having a script that relink xpm-images you would still need a X-application to show the xpm?

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#235 Post by technosaurus »

I hacked out all of the C++ so freememapplet is in c only (has to be swallowed still) ... including the source since it was compiled in wary
Attachments
freememc.tar.gz
(11.92 KiB) Downloaded 490 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#236 Post by goingnuts »

I hacked out all of the C++ so freememapplet is in c only...
Thanks! Already in service in my main P412. For whatever reason it did not show up in pUPnGO (it is running but don't show). So I followed your modifications to the source of freememapplet_xlib-404 and applied it to the source of freememapplet_xlib-0.1.2. And this one shows in pUPnGO. Attached the binary and the modified source. Really impressed that those "small" mods of source reduce demand for deps so much!
Attachments
freememapplet_xlib-0.1.2.tar.gz
freememapplet_xlib-0.1.2 bin and moded source c++2c
(9.87 KiB) Downloaded 498 times

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#237 Post by technosaurus »

yeah the code was kinda old to begin with - lots of gcc warnings
only the error messages needed changed - which leads me to believe that they were added by someone other than the initial dev that didn't know any C (I don't know a lot so the error messages are now more generic and go to stderr - never to be seen unless you run it from the command line for debugging)

I fixed getgui by hardcoding it to use ls -C -a -F -w 130 as the default instead of just ls -C
(you can do it with a command line argument as is too)

which gives you the capability for a little file manager

Code: Select all

#!/bin/sh
[ $1 ] && cd $1
A=`getgui "Pick a directory or file to continue:    dir/, symlink@, executable*" -filepick`
[ -d $A ] && $0 $A || defaulthandler $A
Edit: may need to modify default handler for the symlinks ending in @

Edit - I compiled uClibc++ <patched> in wary - only a 70kb pet and geany-0.20 compiled cleanly against it. .... anyone interested?
Attachments
getgui-202-2.pet
(28.06 KiB) Downloaded 499 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#238 Post by goingnuts »

technosaurus wrote: Edit - I compiled uClibc++ <patched> in wary - only a 70kb pet and geany-0.20 compiled cleanly against it. .... anyone interested?
Yes... :D

I have worked a little further on the c-converted freememapplet ending out in the attached poor-mans-freemem:
# Reduced size of images - now only green, red and lightred - single colour.
# it now takes the argument given
# introduced argument -k: control if you want to kill other running apps
# introduced launch command on mouse-click
# fixed a bug (?) that prevented -u (Set update interval) from being used

And probably introduced new bugs and malfunctions as this is the first time I am doing Xlib-code... :D

Some figures:
pmfree: size of bin 9K
pmfree: size of all needed libs 1940K
org freememapplet: size of bin 20K
org freememapplet: size of all needed libs 3276K


Update 130111: Changed Xevent code to be independent of the update delay (mouse-click independent of update-delay).

Also uploaded pmnet - a "replacement" of blinky
pmnet: size of bin 14K
pmnet: size of all needed libs 1940K
org blinky: size of bin 39K
org blinky: size of all needed libs 8854K

Update: 170111: Uploaded new versions: now background color can be chosen and commands can be assigned to all 3 mouse-buttons. Source code and build script included.
NB: You do not need to install icons - they are included in the bin... :)
Attachments
pmnet0.2.tar.gz
pmnet 0.2 (blinky &quot;alternative&quot;)
(16.52 KiB) Downloaded 446 times
pmfree0.2.tar.gz
pmfree 0.2 (based on freememapplet_xlib-0.1.2)
(8.35 KiB) Downloaded 456 times
pmfree_pmnet.png
(6.28 KiB) Downloaded 1135 times
Last edited by goingnuts on Mon 17 Jan 2011, 20:44, edited 1 time in total.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#239 Post by technosaurus »

Simple IRC client (using root tail & getgui, but can easily swap out tail and read in a terminal or other input/output methods)

Code: Select all

#!/bin/sh
[ $1 ] && USER=$1 || USER=puppy$RANDOM$RANDOM
touch /tmp/irclog /tmp/ircbot
root-tail /tmp/irclog
echo NICK $USER'
USER '$USER' +iw '$USER' :ashirc
JOIN #puppylinux '$USER > /tmp/ircbot

ircmsg(){ sleep 3
while true
do
echo 'PRIVMSG #puppylinux :'`getgui "Enter an IRC message" -keyin 30` >>/tmp/ircbot
done
}

ircpong() { while (sleep 100) do echo 'PONG' >>/tmp/ircbot; done }

ircmsg & ircpong &

tail -f /tmp/ircbot | telnet irc.freenode.net 6667 | while true
do read MSG || break
echo $MSG >> /tmp/irclog
done
Still needs some work with killing input loops
a little better with just Xdialog

Code: Select all

#!/bin/ash
. /etc/DISTRO_SPECS
[ $1 ] && USER=$1 || USER=${DISTRO_FILE_PREFIX}${DISTRO_VERSION}${DISTRO_MINOR_VERSION}user-$RANDOM
echo NICK $USER'
USER '$USER' +iw '$USER' :ashirc
JOIN #puppylinux '$USER > /tmp/ircbot;echo starting irc > /tmp/irclog
while (! grep QUIT /tmp/ircbot) do tail -f /tmp/ircbot |telnet irc.freenode.net 6667 >> /tmp/irclog; done &
while (! grep QUIT /tmp/ircbot) do Xdialog --title "#puppylinux irc" --tailbox /tmp/irclog 30 99; done &
while (! grep QUIT /tmp/ircbot) do sleep 200;echo 'PONG' >>/tmp/ircbot; done &
while (! grep QUIT /tmp/ircbot) do
	A=`Xdialog --stdout --title "AshIRC message dialog" --inputbox "Enter an IRC message for #puppylinux" 0 0`
	[ "$A" == "" ] && echo QUIT >>/tmp/ircbot || echo 'PRIVMSG #puppylinux :'$A'.' >>/tmp/ircbot
done
killall tail
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#240 Post by goingnuts »

Ahh - did use a lot of time getting the "Simple IRC client" to work in pUPnGO...turn out that I was running pmconky.sh...it kill all root-tails every 10 second :)
Also some font issue with getgui - installed courB12-ISO8859-1.pcf and that one was also solved.

Still some interference between pmconky.sh and "Simple IRC client" but its seems to run ok. A nice way to use that big empty desktop.

Below the change in pmconky.sh (just using pidoff instead of killing all root-tail):

Code: Select all

kill $PID 2&1> /dev/null 
#killall root-tail 2> /dev/null 
/usr/sbin/root-tail -g 50x14-10+10 -font fixed /var/log/test,black & #-reload " 5 pmconky.sh" 
PID=$(echo $!)
The ggprocesss works fine if ps-FULL is present but seems to fail if only BB is there. Might need a switch reflecting witch one to use...

Been working on adding all 3 possible mouse-clicks to pmfree and pmnet - download updated in previous post. Getting transparent background on icons for pmnet is not working - I just cant figure out the coding.

Post Reply