Code: Select all
#!/bin/sh
VAR="$(echo $(tty) | cut -d: -f1 )"
if [ "$VAR" = "not a tty" ]; then
yaf-splash -text "clicked"
else
yaf-splash -text "in console"
fi
Code: Select all
#!/bin/sh
VAR="$(echo $(tty) | cut -d: -f1 )"
if [ "$VAR" = "not a tty" ]; then
yaf-splash -text "clicked"
else
yaf-splash -text "in console"
fi
Code: Select all
#!/bin/sh
[ ! $DISPLAY ] && echo NoX && exit || \
[ $(tty) ] && yaf-splash -text Terminal && exit || \
yaf-splash -text Gui
Code: Select all
#!/bin/sh
[ $DISPLAY ] && yaf-splash -text X && exit || echo NoX
Code: Select all
message() {
[ $DISPLAY ] && yaf-splash -text "$@" && exit || echo "$@"
}
Code: Select all
[ $DISPLAY ] && DIALOG=Xdialog || DIALOG=dialog
Code: Select all
#!/bin/sh
[ -n $DISPLAY ] && [ "$(tty | grep not)" ] && exec rxvt -e sh -c $0
echo "I am forced to be spawned from a shell...
and I could call cli, dialog, Xdialog, yaf-splash,
GTK-dialog or xmessage-content, dependent on which
environment I am in - instead of just using echo..."
read DUMMY
That is what I am trying to say - quoting myself:The only reason I can see bothering with tty is if you think that Xdialog would not be available
I will change thread title to:Setup-wizards should as a minimum be able to run from shell without any GUI wrapped around it
I agree with the end goalgoingnuts"
I will change thread title to:
Wizards should always be able to run from shell/console without
I use the dialogfunctions.sh for my own purpose(=joy) - did not mean to create anything beyond that - only used it to make my point...but if it has any potential and the "more linux compatible" could be clarified for me...why not?if you make it for only one special puppy version
which is the trend its dead before it can mature
if you to make it more linux compatible
I would help
Fully agree! I see no contradiction between robust code and user choice (or coded best choice). The long series of dialogs is old school and should only be visible when needed - it should not exclude fancy one-shot setup GUIs.Running in the X terminal should be a user choice though
I'm sorry - might have misused your example to promote my own statement... think [ -n $DISPLAY ] even might sometime give wrong result i console - maybe [ $DISPLAY ] is more secure?Sorry for the muddle
Code: Select all
#!/bin/sh
echo "Testing [ \$DISPLAY ]..."
if [ $DISPLAY ]; then
echo "Im in first part..."
else
echo "Im in second part..."
fi
echo "Testing [ -n \$DISPLAY ]..."
if [ -n $DISPLAY ]; then
echo "Im in first part..."
else
echo "Im in second part..."
fi
Code: Select all
TYPE="cli" #dialog or cli
[ $(which dialog) ] && TYPE="dialog" && DIALOG=dialog
[ $(which Xdialog) ] && [ $DISPLAY ] && DIALOG=Xdialog
[ $DISPLAY ] && [ "$(tty | grep not)" ] && [ ! "${DIALOG}" = "Xdialog" ] && exec rxvt -e sh -c $0
trygoingnuts wrote:jpeps: After exit to prompt from X I get:
"Im in second part..."
"Im in first part..."
running the below script:Code: Select all
#!/bin/sh echo "Testing [ \$DISPLAY ]..." if [ $DISPLAY ]; then echo "Im in first part..." else echo "Im in second part..." fi echo "Testing [ -n \$DISPLAY ]..." if [ -n $DISPLAY ]; then echo "Im in first part..." else echo "Im in second part..." fi
Code: Select all
if [ -n "$DISPLAY" ]
Thanks upnorth, I'll give that a try shortly./usr/local/petget/installpkg.sh worked a couple months ago when i tried it.
I think it just takes an absolute path and package name as argument.