Tiny Core Base > TCB Bugs

TC8.0 ondemand update

(1/2) > >>

rdebath:
I've made some small fixes to the 'ondemand' script so that it actually works from the command line again.

Currently I've uploaded them to github, but there's no history of issues and pulls there.
Should I push the pull request button or should I be looking somewhere else?

https://github.com/tinycorelinux/Core-scripts/compare/master...rdebath:master

Misalf:
Hi Robert,
I'm currently testing your CLI fix. So far it looks promising.

Unrelated to your fix, maybe this would come in handy, too, so one could run ondemand items with sudo:
replace

--- Code: --- ${COMMAND} "$FROMWHERE""$APPNAME"."$TYPE" || exit

--- End code ---
with

--- Code: --- TCUSER="$(cat /etc/sysconfig/tcuser)"
su "$TCUSER" -c "${COMMAND} "$FROMWHERE""$APPNAME"."$TYPE"" || exit

--- End code ---

Misalf:
With your fix, CLI apps ran from within X via ondemand, are now opened on tty (we have been there already).
So I have changed it from this

--- Code: --- case "$FOUNDDIR" in
""|*/ondemand* ) launchApp "$APPNAME" "$@" ;;
* ) exec "$FOUNDDIR"/"$APPNAME" "$@" ;;
esac

--- End code ---
to this

--- Code: --- case "$FOUNDDIR" in
""|*/ondemand* ) launchApp "$APPNAME" "$@" ;;
* )
if [ "$DISPLAY" ]; then
launchApp "$APPNAME" "$@"
else
exec "$FOUNDDIR"/"$APPNAME" "$@"
fi
;;
esac

--- End code ---

rdebath:
Actually I'd be inclined to add something like this at the start of tce and tce-load.


--- Code: ---[ $(/usr/bin/id -u) -eq 0 ] && {
    TCUSER="$(cat /etc/sysconfig/tcuser)"
    exec /bin/su "$TCUSER" -c "$0" "$@"
}

--- End code ---

That way it works from root like most people would expect.

As for checking DISPLAY that's going to fail if you run inside an xterm (aterm).
How about making the test this instead:


--- Code: ---if [ ! -t 0 ] ; then

--- End code ---

If you're running in the GUI your stdin shouldn't be a terminal.
 
(EDIT: Sigh flip that NOT a terminal!)

Misalf:

--- Quote from: rdebath on April 25, 2017, 07:25:56 AM ---Actually I'd be inclined to add something like this at the start of tce and tce-load.


--- Code: ---[ $(/usr/bin/id -u) -eq 0 ] && {
    TCUSER="$(cat /etc/sysconfig/tcuser)"
    exec /bin/su "$TCUSER" -c "$0" "$@"
}

--- End code ---

That way it works from root like most people would expect.

--- End quote ---
Except that Core is in many ways different to what people expect. :p
But yeah, sounds reasonable. However, I wonder what the Devs say.

I don't understand why checking $DISPLAY should fail when tested from xterm. Works here.
But [ ! -t 0 ] seems fine.
Both ways tested in TTY, xterm and WM menu (Openbox).

Navigation

[0] Message Index

[#] Next page

Go to full version