Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[TIP] Using xlaunch
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Thu Nov 02, 2006 3:40 am    Post subject: Reply with quote

glad you soved it, I should probably set /bin/bash instead of /bin/sh

Quote:
Next on the docket, figuring out why it's not exiting properly and returning me to my desktop..


on the first(s) page, there were the same problem, it was with the ut game which actually doesn't exit properly, try running your program in a term, exit from it, and see if you get the prompt back in the term.
_________________
The End of the Internet!
Back to top
View user's profile Send private message
destr0yr
Tux's lil' helper
Tux's lil' helper


Joined: 29 Nov 2003
Posts: 80
Location: Kelowna, BC.

PostPosted: Thu Nov 02, 2006 6:55 am    Post subject: Reply with quote

truc wrote:
glad you soved it, I should probably set /bin/bash instead of /bin/sh
on the first(s) page, there were the same problem, it was with the ut game which actually doesn't exit properly, try running your program in a term, exit from it, and see if you get the prompt back in the term.

I tried simply running 'xlaunch xterm' which launched full screen but didn't allow for any input. I had to Ctrl-alt-backspace to get out. (AIGLX on Ubuntu 6.10 (Edgy)). In any case, I have figured out that I can use beryl-manager to change my WM from Beryl to Metacity and back again when desired. Using this rather cumbersome method, I can launch any game I like sans xlaunch. I'll continue to play around with it and report back if I figure it out.

I appreciate your time. Thank you.
Back to top
View user's profile Send private message
ThomasAdam
Guru
Guru


Joined: 20 Mar 2005
Posts: 447
Location: England

PostPosted: Thu Nov 02, 2006 6:47 pm    Post subject: Reply with quote

I notice that the following is being used:

Code:

if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then


Don't do this -- at least, don't check for "$USER" being equal to root since anyone can change it:

Just check for the $EUID, this is a read-only environment variable.

-- Thomas Adam
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Thu Nov 02, 2006 7:20 pm    Post subject: Reply with quote

ThomasAdam wrote:
I notice that the following is being used:

Code:

if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then


Don't do this -- at least, don't check for "$USER" being equal to root since anyone can change it:

Just check for the $EUID, this is a read-only environment variable.

-- Thomas Adam


:?: I never did this, the script doesn't even need root privileges :?:
_________________
The End of the Internet!
Back to top
View user's profile Send private message
ThomasAdam
Guru
Guru


Joined: 20 Mar 2005
Posts: 447
Location: England

PostPosted: Thu Nov 02, 2006 7:40 pm    Post subject: Reply with quote

truc wrote:
ThomasAdam wrote:
I notice that the following is being used:

Code:

if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then


Don't do this -- at least, don't check for "$USER" being equal to root since anyone can change it:

Just check for the $EUID, this is a read-only environment variable.

-- Thomas Adam


:?: I never did this, the script doesn't even need root privileges :?:


You recommend the change in /etc/profile -- and whilst the initial check might not even be yours -- the use of checking $USER is completely unnecessary and dangerous.

-- Thomas Adam
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Thu Nov 02, 2006 7:46 pm    Post subject: Reply with quote

oh, I use the $USER env variable in the script, but it is just ignore if you don't use the "XPLAYER" feature, and even if you do, I don't think there is anything dangerous, but I can be wrong. anyway, so what would you recommend to me, using $UID right?
_________________
The End of the Internet!
Back to top
View user's profile Send private message
ThomasAdam
Guru
Guru


Joined: 20 Mar 2005
Posts: 447
Location: England

PostPosted: Thu Nov 02, 2006 7:52 pm    Post subject: Reply with quote

truc wrote:
oh, I use the $USER env variable in the script, but it is just ignore if you don't use the "XPLAYER" feature, and even if you do, I don't think there is anything dangerous, but I can be wrong. anyway, so what would you recommend to me, using $UID right?


Yes, consider the following:

Code:

[n6tadam@workstation ~]% echo "$USER"
n6tadam


Which is fine, but then:

Code:

[n6tadam@workstation ~]% USER=root && echo "$USER"   
root


Oops. It's not a reliable means of ascertaining if a user is root or not. Plus, if you then had commands thereafter to change one's PATH or what have you, that's just going to be bad all round.

-- Thomas Adam
Back to top
View user's profile Send private message
user317
Guru
Guru


Joined: 26 Jan 2003
Posts: 314

PostPosted: Wed Nov 15, 2006 5:42 am    Post subject: Reply with quote

I cant seem to get this script to work with the -screen option on 7.1. the server exits before starting the program
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Wed Nov 15, 2006 3:51 pm    Post subject: Reply with quote

user317 wrote:
I cant seem to get this script to work with the -screen option on 7.1. the server exits before starting the program


Could you say exactly how you're using this option? I think you can use the -screen option as I described here(second part of the post) how to use the -config option.

I didn't know this option, but it looks like it's even better than the -config one :idea: :?:
_________________
The End of the Internet!
Back to top
View user's profile Send private message
Xamindar
Veteran
Veteran


Joined: 03 Oct 2004
Posts: 1155
Location: California

PostPosted: Mon Dec 04, 2006 6:49 pm    Post subject: Re: First test... Successful Reply with quote

Condex wrote:
I've tried Ubuntu Forum solution, so:

Changed: ServerCmd=/usr/bin/Xgl -br -ac -accel glx:pbuffer -accel xv:pbuffer
To: ServerCmd=/usr/bin/Xgl -br -ac -accel glx:pbuffer -accel xv:fbo -xorgAc

in /usr/kde/3.5/share/config/kdm/kdmrc

Start kdm, login and run:

$ openttd : (SDL game, windowed). Runs bad, problems with colors 8)
$ DISPLAY=:93 openttd : No problem with colors, runs fine. 8)

Now I'm emerging an OpenGL based game... tuxracer 8)

Edit:

-OpenTTD also runs ok in Fullscreen
- $ DISPLAY=:93 tuxracer runs perfect.

I think we got a solution 8)


I can't get that to work. Are there any other solutions? I get an error about -xorgAc not supported.
Back to top
View user's profile Send private message
dejawoo
n00b
n00b


Joined: 05 Dec 2006
Posts: 2

PostPosted: Tue Dec 05, 2006 3:30 am    Post subject: Reply with quote

i wanna thank for the topic, and other points in this topic..
_________________
dejawoo
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Sat Feb 10, 2007 10:04 am    Post subject: Reply with quote

there was a problem with xlaunch when the arg/options to the program had spaces in it.

This is fixed now with xlaunch-20070210

for those who modify their xlaunch script, here is a short diff, with the previous (20070127)
diff -Narup xlaunch xlaunch-20070210:
--- xlaunch     2007-01-27 16:26:30.000000000 +0100
+++ xlaunch-20070210    2007-02-10 10:54:46.075366591 +0100
@@ -6,7 +6,7 @@
 # commented so you should be able to easily use it.
 # See forum thread http://forums.gentoo.org/viewtopic-t-483004.html for more explanation.
 #
-VERSION=20070127
+VERSION=20070210
 
 #########
 # ======= configuration ======= #
@@ -322,7 +322,7 @@ if [ "x$XPLAYER" != "x" ]; then
                 fi
 
                 echo "Launching ${FULL_PROG_NAME##*/} as user: $XPLAYER"
-                sudo su - $XPLAYER -l -c "FULL_PROG_NAME=\"$FULL_PROG_NAME\" ${XLAUNCH_PATH:-$0} $*"
+                sudo su - $XPLAYER -l -c "FULL_PROG_NAME=\"$FULL_PROG_NAME\" ${XLAUNCH_PATH:-$0} ${*// /\\ }"
                 exit $?;;
                 
             error)
@@ -336,8 +336,6 @@ if [ "x$XPLAYER" != "x" ]; then
     fi
 fi
 
-
-
 ######
 # Thanks to LXj I added the following lines, which allows you launch several programs
 # each one on its own DISPLAY
@@ -374,7 +372,7 @@ case "${FULL_PROG_NAME##*/}" in
     
     *) 
         echo "Starting ${FULL_PROG_NAME} on DISPLAY $DISPLAY_TO_USE"
-        xinit "${FULL_PROG_NAME}" $* -- $Xserver :$DISPLAY_TO_USE $Xserverargs &>/dev/null &
+        xinit "${FULL_PROG_NAME}" "$@" -- $Xserver :$DISPLAY_TO_USE $Xserverargs &>/dev/null &
         ;;
 esac
 
@@ -412,7 +410,4 @@ if [ $? -eq 0 ]; then
     DISPLAY=:$DISPLAY_TO_USE numlockx on
 fi
 
-
-
-
 exit 0

_________________
The End of the Internet!
Back to top
View user's profile Send private message
garr0n
n00b
n00b


Joined: 07 Mar 2007
Posts: 2

PostPosted: Wed Mar 07, 2007 7:00 am    Post subject: Reply with quote

Hey, very nice work here, truc. I'm having a strange issue running the script from within X though, maybe you or someone else here know what's wrong.

If I login to another text-mode tty (i.e. ctrl-alt-F2) and run a program with xlaunch, everything works fine. However, if I run xlaunch from an xterm or a graphical menu in X or whatnot, performance is much worse than it should be. The exact same parameters are used both times.

I'm using updated nvidia drivers, Xorg 6.9 on Slackware. I don't have any fancy composite WMs running.

As an aside, I thought I was having issues running the script in zsh, but it seems to work fine if I specify the path to xlaunch when running it.

Merci beaucoup! keep up the good work
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Wed Mar 07, 2007 9:35 am    Post subject: Reply with quote

this is wierd :O
When your in X you should check if variables such as __GL_FSAA_MODE are set (used for antialiasing and things like that). this is the only thing I can think of, so check your env :/
_________________
The End of the Internet!
Back to top
View user's profile Send private message
garr0n
n00b
n00b


Joined: 07 Mar 2007
Posts: 2

PostPosted: Wed Mar 07, 2007 2:07 pm    Post subject: Reply with quote

Nope, definately not the problem. I'll keep experimenting and report back if I find a solution (or the cause of the problem at least :P).

EDIT: Bah, nevermind, I must have just had some secret runaway processes or something... everything's working fine after a reboot. (What is this, Windows 98? :?)

Thanks for the help anyhow.
Back to top
View user's profile Send private message
tekknokrat
Apprentice
Apprentice


Joined: 17 Apr 2005
Posts: 278
Location: Magdeburg

PostPosted: Sun Mar 11, 2007 6:55 pm    Post subject: Reply with quote

very complex script with a lot of features in mind!

I just wonder how it would be to include (seperate) root access.
I know that root cannot use it by design for security reason but I am looking for a solution running seamonkey, firefox or thunderbird with root
access for installing several xpi plugins.
other tools like k3b sometimes also need more privileges (e.g. for testing device access)

how would it be if your script has something like an
Code:
--root
switch which gathers root privileges via su/sudo and then executes x based apps
for installation/maintaining purposes.
Suggestions or Alternatives???
_________________
Optimism is solely an absence of information. / Optimismus ist nur ein Mangel an Information.
(Arthur Schopenhauer)
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Sun Mar 11, 2007 7:22 pm    Post subject: Reply with quote

I'm not sure I've understood exactly what you want :? you want to start an X session being root?

What's preventing you from running this script as root?
Also, if you edit your sudoers file you can even run this script as a normal user, and launch the different application as root (including the Xseesion), have a look at the "XPLAYER" feature, (I didn't find better for the name :D )
around line 316
Code:
        case "$PROG_GROUP" in
            games)
                if [ -h "$0" ]; then
                    XLAUNCH_PATH=`readlink $0` || echo "Error: could not read the \"$0\" link"
                fi
               
                echo "Launching ${FULL_PROG_NAME##*/} as user: $XPLAYER"
                sudo su - $XPLAYER -l -c "FULL_PROG_NAME=\"$FULL_PROG_NAME\" ${XLAUNCH_PATH:-$0} ${*// /\\ }"
                exit $?;;
           
            error)
                echo "Could not determine group of ${FULL_PROG_NAME}. (Do you have 'stat' on your system?)"
                echo "Launching $FULL_PROG_NAME on DISPLAY=$DISPLAY_TO_USE as user: $USER"
                ;;
           
            *) 
                ;;
        esac

you can very easily create a script which will launch your different programs, chgrp it, then ass the case for this group in this loop, and either modify the XPLAYER value (set it to root) or even add your own new variable :)

I'm probably not very clear, but I explain a bit this on the first page, so you might wana have a look :)
_________________
The End of the Internet!
Back to top
View user's profile Send private message
tekknokrat
Apprentice
Apprentice


Joined: 17 Apr 2005
Posts: 278
Location: Magdeburg

PostPosted: Sun Mar 11, 2007 8:34 pm    Post subject: Reply with quote

sorry for obfuscate my intention - sometimes i think/write too much in general terms.

when i can run this script also via sudo then everything is ok :D
thought the script path (and because of that access for root was denied) because of the line in /etc/profile

Quote:

in /etc/profile, replace:
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
else
PATH="/usr/local/bin:/usr/bin:/bin:${PATH}"
fi


with the following:
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
else
PATH="/usr/local/bin:/usr/bin:/bin:/home/scripts:${PATH}"
fi


will have a deeper look in script now!

thanks for your fast answer!
_________________
Optimism is solely an absence of information. / Optimismus ist nur ein Mangel an Information.
(Arthur Schopenhauer)
Back to top
View user's profile Send private message
KevinLarson
Tux's lil' helper
Tux's lil' helper


Joined: 23 Sep 2005
Posts: 126
Location: Chaimpaign, IL

PostPosted: Tue Mar 13, 2007 9:36 pm    Post subject: Reply with quote

So I'm trying to use xlaunch to run another script of mine. The contents of the other script are:

wc3
Code:

#! /bin/bash
setarch i386 -X wine ~/.wine/drive_c/Program\ Files/Warcraft\ III/Frozen\ Throne.exe -opengl


When I run $xlaunch wc3 it says:
Starting /home/scripts/wc3 on DISPLAY 1
It then prints out 50-ish line feeds,
then it prints xrdb: "XTerm*boldMode" on line 19 overrides entry on line 3,
followed by around 100 prompts (user@localhost ~ $).

Sometimes it will NOT have the line feeds or the prompts, other times it will, but the rest is always the same.
It seems to more frequently print them (last 5 or times I tried, as I was trying to find some sort of correlation(I didn't)), than not.

Thanks,
-Kevin
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Wed Mar 14, 2007 2:22 pm    Post subject: Reply with quote

I do also have sometimes the 100 prompts, and sometimes don't, I just don't know why :roll:

Anyway, so your script isn't working?
Be sure
Code:
xinit wc3 -- :1
works.
_________________
The End of the Internet!
Back to top
View user's profile Send private message
KevinLarson
Tux's lil' helper
Tux's lil' helper


Joined: 23 Sep 2005
Posts: 126
Location: Chaimpaign, IL

PostPosted: Wed Mar 14, 2007 7:52 pm    Post subject: Reply with quote

It opens another x session, but doesnt seem to do the script. Do you know why this might be?
Back to top
View user's profile Send private message
KevinLarson
Tux's lil' helper
Tux's lil' helper


Joined: 23 Sep 2005
Posts: 126
Location: Chaimpaign, IL

PostPosted: Wed Mar 14, 2007 7:59 pm    Post subject: Reply with quote

Do you want some of the output? I would have posted it, but I can't seem to find anything relevant.
Back to top
View user's profile Send private message
KevinLarson
Tux's lil' helper
Tux's lil' helper


Joined: 23 Sep 2005
Posts: 126
Location: Chaimpaign, IL

PostPosted: Wed Mar 14, 2007 8:07 pm    Post subject: Reply with quote

Update: I tried running the script in the second session, and it crashed it.

This printed:
Quote:
Backtrace:
0: X(xf86SigHandler+0x7d) [0x4898bd]
1: /lib/libc.so.6 [0x2ad65f6dbac0]
2: /usr/lib64/xorg/modules//libfb.so(fbSolidFillmmx+0x142) [0x2ad6610df432]
3: /usr/lib64/xorg/modules//libfb.so(fbFillRegionSolid+0xcc) [0x2ad6610d1c2c]
4: /usr/lib64/xorg/modules/drivers//nvidia_drv.so(_nv000690X+0x199) [0x2ad660ce8449]

Fatal server error:
Caught signal 11. Server aborting
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Wed Mar 14, 2007 8:08 pm    Post subject: Reply with quote

what about
Code:
xinit /path/to/wc3 -- :1
then?
_________________
The End of the Internet!
Back to top
View user's profile Send private message
KevinLarson
Tux's lil' helper
Tux's lil' helper


Joined: 23 Sep 2005
Posts: 126
Location: Chaimpaign, IL

PostPosted: Wed Mar 14, 2007 10:39 pm    Post subject: Reply with quote

It's a step closer, instead of opening the new session and doing nothing, it now opens the session, shows the little box while loading, then the whole thing dies, session and all.

Heres the output (after removing hundreds of line feeds (what is with this, I see this using xlaunch with other things as well))
Quote:
xinit /home/scripts/wc3 -- :1
X Window System Version 7.2.0
Release Date: 22 January 2007
X Protocol Version 11, Revision 0, Release 7.2
Build Operating System: Linux 2.6.20-rc5 x86_64
Current Operating System: Linux kevin 2.6.20-rc5 #1 SMP PREEMPT Fri Jan 26 23:49:07 CST 2007 x86_64
Build Date: 20 February 2007
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Wed Mar 14 17:31:38 2007
(==) Using config file: "/etc/X11/xorg.conf"
ALSA lib conf.c:3939:(snd_config_expand) Unknown parameters 0
ALSA lib control.c:910:(snd_ctl_open_noupdate) Invalid CTL default:0
ALSA lib conf.c:3939:(snd_config_expand) Unknown parameters 0
ALSA lib pcm.c:2145:(snd_pcm_open_noupdate) Unknown PCM default:0
ALSA lib conf.c:3939:(snd_config_expand) Unknown parameters 1
ALSA lib control.c:910:(snd_ctl_open_noupdate) Invalid CTL default:1
ALSA lib conf.c:3939:(snd_config_expand) Unknown parameters 1
ALSA lib pcm.c:2145:(snd_pcm_open_noupdate) Unknown PCM default:1
ALSA lib conf.c:3939:(snd_config_expand) Unknown parameters 1
ALSA lib pcm.c:2145:(snd_pcm_open_noupdate) Unknown PCM default:1
fixme:cdrom:CDROM_DeviceIoControl Unsupported IOCTL 2d1400 (type=2d access=0 func=500 meth=0)
fixme:cursor:SetSystemCursor (0x111e,00007f8a),stub!
fixme:cursor:SetSystemCursor (0x1126,00007f00),stub!
fixme:cursor:SetSystemCursor (0x1136,00007f03),stub!
fixme:cursor:SetSystemCursor (0x113e,00007f01),stub!
fixme:cursor:SetSystemCursor (0x114e,00007f88),stub!
fixme:cursor:SetSystemCursor (0x115e,00007f86),stub!
fixme:cursor:SetSystemCursor (0x116e,00007f83),stub!
fixme:cursor:SetSystemCursor (0x117e,00007f85),stub!
fixme:cursor:SetSystemCursor (0x118e,00007f82),stub!
fixme:cursor:SetSystemCursor (0x119e,00007f84),stub!
fixme:cursor:SetSystemCursor (0x11ae,00007f04),stub!
fixme:cursor:SetSystemCursor (0x11be,00007f02),stub!
err:ole:CoCreateInstance apartment not initialised
fixme:advapi:SetSecurityInfo stub
fixme:win:EnumDisplayDevicesW ((null),0,0x34ed44,0x00000000), stub!
fixme:win:EnumDisplayDevicesW ((null),0,0x34ed74,0x00000000), stub!
fixme:xrandr:X11DRV_XRandR_SetCurrentMode Cannot change screen BPP from 32 to 1 **** I believe this is cut off *****
waiting for X server to shut down X connection to :1.0 broke *********cut off?
server shutdown).
FreeFontPath: FPE "/usr/share/fonts/misc/" refcount is 2, sh *********cut off?
.


I removed alot of line feeds.
I know alot of these messages display when running wine regardless of the wc3 script or xlaunch.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 6 of 7

 
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