| Author |
Message |
sunburnt

Joined: 08 Jun 2005 Posts: 4001 Location: Arizona, U.S.A.
|
Posted: Tue 29 May 2012, 20:53 Post subject:
rxvt -e and/or Xdialog TailBox to catch stdout. ( Solved ) |
|
I`m trying to get Xdialog`s TailBox to work, and I can`t even get rxvt to work.
This utility runs ldd-recursive to get exec`s deps outputting to TailBox or rxvt.
Working solution:
File name: ldd-gui
| Code: | #!/bin/sh
######### GUI select exec. file, run ldd and display the output.
libX="X11 Xau Xdamage Xdmcp Xext Xfixes Xxf86vm xcb"
libEX="linux asound libc libdl libdrm GL\. GLU\. freetype gcc_s\
libm librt pthread libtiff stdc++ libz"
fselP=/SqApp/mnt # file select path
exePF=`Xdialog --stdout --title " Select an Executable." --fselect $fselP 0 0`
[ $? -gt 0 ]&& exit
echo '' > /tmp/ldd.lst
msg='Exclusive Dependency List.'
Xdialog --title " LDD Recursive" --tailbox /tmp/ldd.lst 32 64 &
L=`echo "$libEX $libX" |tr '[:space:]' '\n'`
ldd-recursive.pl $exePF |while read D
do
[ ! `echo "$L" |grep $D` ]&& L=`echo -e "$L\x0a$D"` && echo $D >> /tmp/ldd.lst
done
rm /tmp/ldd.lst |
Last edited by sunburnt on Thu 31 May 2012, 00:36; edited 4 times in total
|
|
Back to top
|
|
 |
jamesbond
Joined: 26 Feb 2007 Posts: 1531 Location: The Blue Marble
|
Posted: Tue 29 May 2012, 22:30 Post subject:
|
|
This works. output_log here represents your "ldd-recursive".
| Code: | #!/bin/sh
output_log() {
while true; do
sleep 1
count=$((count + 1))
echo $count >> /tmp/countme
done
}
### main
count=0
output_log &
XPID=$!
Xdialog --tailbox /tmp/countme 0 0
kill $XPID
|
_________________ Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4001 Location: Arizona, U.S.A.
|
Posted: Tue 29 May 2012, 23:49 Post subject:
|
|
Hello again jamesB; I tried your script and got the same error that I got.
| Code: | sh-4.1# /tmp/jb
Xdialog: can't open /tmp/countme |
Strangely the while loop doesn`t write to the file until the loop`s done.
This of course explains why the TailBox can`t find the file.
I`m baffled as to why each loop the code isn`t written to the file.
It would be nice if the TailBox scrolled the info like it`s supposed to.
But I seem to recall having this problem years ago and gave up on the TailBox.
I revised it and this works ( sort of...):
| Code: | #!/bin/sh
######### GUI to run ldd on app. exec.
libEX="linux|asound|libc|libdl|libdrm|freetype|gcc_s|libm|librt|pthread|libtiff|stdc++|libz|\
X11|Xau|Xdamage|Xdmcp|Xext|Xfixes|Xxf86vm|xcb"
fselP=/SqApp/mnt
exePF=`Xdialog --stdout --title " Select an Executable." --fselect $fselP 0 0`
[ $? -gt 0 ]&& exit
exeF=`basename $exePF`
depPF=/tmp/$exeF.dep
rm -f $depPF
ldd-recursive.pl $exePF |egrep -v "($libEX)" |while read D
do
[ ! `echo "$L" |grep $D` ]&& L="$L\x0a$D" && echo "$D" >> $depPF
done &
echo -e "\n### Getting dependencies for $exeF\n"
echo -n "##> "
until [ -e $depPF ] ;do sleep 3 ;echo -n "X" ;sleep 3 ;echo -n "O" ;done
echo -e '\n### DONE\n'
Xdialog --title " LDD GUI" --backtitle "Dependency List." --tailbox $depPF 32 80 |
.
### The other thing is rxvt, it doesn`t want to run the long ldd command... Damn!!!
.
|
|
Back to top
|
|
 |
jamesbond
Joined: 26 Feb 2007 Posts: 1531 Location: The Blue Marble
|
Posted: Wed 30 May 2012, 00:57 Post subject:
|
|
| sunburnt wrote: | Hello again jamesB; I tried your script and got the same error that I got.
| Code: | sh-4.1# /tmp/jb
Xdialog: can't open /tmp/countme |
| That is because I was silly. I tried the example twice - once manually and once after I wrote the script. It worked because /tmp/countme was already created during my "manual" experiment.
This is the updated example - notice the "sleep 2" to give time for output_log to run and create the output file ... you could of course create a simple wait loop to test that /tmp/countme already exist before starting tail.
| Code: | #!/bin/sh
output_log() {
while true; do
sleep 1
count=$((count + 1))
echo $count >> /tmp/countme
done
}
### main
count=0
output_log &
XPID=$!
sleep 2
Xdialog --tailbox /tmp/countme 0 0
kill $XPID
|
_________________ Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
|
|
Back to top
|
|
 |
jamesbond
Joined: 26 Feb 2007 Posts: 1531 Location: The Blue Marble
|
Posted: Wed 30 May 2012, 01:06 Post subject:
|
|
| sunburnt wrote: |
### The other thing is rxvt, it doesn`t want to run the long ldd command... Damn!!!
. | Apparently rxvt (at least urxvt - that's what I have here) can only execute one command, so the example in your first post will not work directly. You need to call shell and ask shell to execute there rest of your commands, pipe and everything.
This works.
| Code: | | rxvt -e /bin/sh -c "echo haha | sed 's/haha/hoho/'; read" |
Note the absence of -hold and the presence of "read" at the end of the script ...
IMO, this is much better than xterm, gnome-term and other terms that executes everything as one quoted string --- makes is super-hard to write a pipe like the above ....
_________________ Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4001 Location: Arizona, U.S.A.
|
Posted: Wed 30 May 2012, 10:44 Post subject:
|
|
Now that works Great !!! Thanks JB. Seeing the info scroll is better than waiting.
I wonder what the deal is with the while loop? Just more odd shell behavior.
|
|
Back to top
|
|
 |
jamesbond
Joined: 26 Feb 2007 Posts: 1531 Location: The Blue Marble
|
Posted: Wed 30 May 2012, 20:46 Post subject:
|
|
| sunburnt wrote: | | Now that works Great !!! Thanks JB. Seeing the info scroll is better than waiting. | Glad that it works. Looking forward to see your work. I've been following your idea of mounted-but-not-unioned squashfs, but I haven't gotten a clear picture of how to implement that seamlessly yet.
| Quote: | | I wonder what the deal is with the while loop? Just more odd shell behavior. | Which is?
_________________ Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4001 Location: Arizona, U.S.A.
|
Posted: Wed 30 May 2012, 23:40 Post subject:
|
|
Nothing seems to be seamless in Linux, it`s just designed that way.
Unix was made for main frames and for admin`s to run and it works very well like that.
But for a desktop O.S. and all the app. install/uninstall it lacks a bit.
The biggest problem is that apps. scatter files all over the dir. tree.
I`ve said before that Linux needs to be organized into read-only and read-write dirs.
Read-only dirs. can then be in Squash files, and read-write dirs. on partitions.
# The trick for SqApps:
1) The app. finding all it`s deps. when all it`s files are in a nonstandard location.
Tiny Core Linux solves this with masses of links pointing into the Squash files.
It also has SCM Squash files that are setup to run without lots of links.
It does this by compiling them that way, but also uses binary files too.
There are ways to edit ELF binaries to change the paths in them.
Then the deps. can be in nonstandard locations and still be found.
2) How to write to config. files that are in a Squash file.
The only way to do this I can see is the config. file is a link pointing to the real
config. file in /usr/etc that was copied from the SqApp file when it`s loaded.
Icons are copied also so the desktop and menus can access them.
I think Tiny Core mounts ALL SCM files at boot to access the icons,
but it still has to copy the config. files.
I don`t like the kernel managing lots of mounts if the apps. aren`t used.
I`m running all the options through my brain. If you have suggestions...
Thanks again for all the help. Terry B.
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4001 Location: Arizona, U.S.A.
|
Posted: Thu 31 May 2012, 00:34 Post subject:
|
|
After a nights sleep I found out what I was doing wrong.
A working solution is in the first post at the top.
.
|
|
Back to top
|
|
 |
RSH

Joined: 05 Sep 2011 Posts: 1564 Location: Germany
|
Posted: Thu 31 May 2012, 12:05 Post subject:
|
|
| sunburnt wrote: | | Thanks again for all the help. Terry B. |
Hmm...
Terry B. Terry B. Terry B.....
Where did i heard that name before?
Got it! You are Terry Bozzio! The world's best drummer with the world's biggest drum!
Greetings from germany, from another drummer!
_________________ Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4001 Location: Arizona, U.S.A.
|
Posted: Thu 31 May 2012, 14:20 Post subject:
|
|
Hi RSH, how`s it been? It`s been a little while since we`ve talked.
What have you been working on lately? Come on, tell us your secrets!
Not doing much drumming so I moved into that big one, lots of space...
|
|
Back to top
|
|
 |
|