Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: uggla on January 31, 2011, 12:18:13 PM

Title: Adding xvnc to .xsession
Post by: uggla on January 31, 2011, 12:18:13 PM
Hi!
I have three boot options: Xorg, Xvesa and xvnc. Xorg and Xvesa automatically adds the correct line to .xsession but xvnc doesn't. How can I achieve this?
Title: Re: Adding x11vnc to .xsession
Post by: curaga on January 31, 2011, 01:29:09 PM
x11vnc is not an X server. It will let you connect via VNC to an existing one (xorg or xvesa).

If you want a standalone VNC server, I recommend tightvnc. Note that it doesn't have the mentioned autoconfig either, because it is assumed the general user will not want their only display be vnc.
Title: Re: Adding x11vnc to .xsession
Post by: uggla on January 31, 2011, 01:32:12 PM
You can use x11vnc as a xserver without loading either Xorg or Xvesa.

http://forum.tinycorelinux.net/index.php?topic=7720.0
Title: Re: Adding x11vnc to .xsession
Post by: curaga on January 31, 2011, 02:42:18 PM
Xvnc != x11vnc.
Title: Re: Adding x11vnc to .xsession
Post by: uggla on January 31, 2011, 03:32:54 PM
Oops! Sorry I got confused (I'll change the thread title). Well, how can I add the right xvnc command to .xsession at boot?
Title: Re: Adding xvnc to .xsession
Post by: tinypoodle on January 31, 2011, 04:12:23 PM
Personally I have ".xsession.Xvesa_base" ".xsession.Xorg" ".xsession.Xvesa_new" in backup; then I copy the appropriate one to .xsession
Title: Re: Adding xvnc to .xsession
Post by: uggla on February 01, 2011, 04:55:42 AM
Would it work to create three different extensions with different .xsession that I put in xorg.lst, xvesa.lst, xvnc.lst?
Title: Re: Adding xvnc to .xsession
Post by: tinypoodle on February 01, 2011, 05:06:24 AM
Not sure if an extension would be a good idea for a configuration file like .xsession

In any such case, you would have to exclude home/tc/.xsession from backup, to avoid overwriting the file.
Title: Re: Adding xvnc to .xsession
Post by: uggla on February 01, 2011, 05:19:17 AM
I have a persistent home, but if I would put it in backup the way you suggested can I place the copy command in bootlocal.sh and have the correct x start at boot?
Title: Re: Adding xvnc to .xsession
Post by: curaga on February 01, 2011, 06:22:36 AM
Edit .xsession to have the correct line for your VNC options, and add "echo Xvnc > /etc/sysconfig/desktop" to bootsync.sh. Untested, but should let you have your only display be VNC.
Title: Re: Adding xvnc to .xsession
Post by: uggla on February 01, 2011, 06:36:36 AM
But if I boot with xorg or xvesa won't my vnc options cause trouble? Do I still need three different .xsession files?
Title: Re: Adding xvnc to .xsession
Post by: curaga on February 01, 2011, 07:09:37 AM
It's not clear what you want here... If you want our help, do describe your situation in more detail.
Title: Re: Adding xvnc to .xsession
Post by: uggla on February 01, 2011, 07:33:38 AM
I want three boot alternatives in Grub:
1. TC with Xorg
2. TC with Xvesa
3. TC with (only) Xvnc

To achieve this I have created three different onboot.lst-files that are passed as boot option. One loads xorg, the next loads xvesa and the last loads tightvnc. Xorg and Xvesa automatically alters .xsession at boot. I need a simple way to do that for Xvnc as well.
Title: Re: Adding xvnc to .xsession
Post by: curaga on February 01, 2011, 07:39:30 AM
Oh ok. To do that either edit the tightvnc extension, or check for a bootcode in bootsync.sh. In the second case, your boot entry would include something like "xvnc".

Quote
grep xvnc /proc/cmdline && echo Xvnc > /etc/sysconfig/desktop && cp /path/to/.xsession.xnvc /home/tc/.xsession
Title: Re: Adding xvnc to .xsession
Post by: uggla on February 01, 2011, 07:47:14 AM
I will test that. Thanks!
Title: Re: Adding xvnc to .xsession
Post by: uggla on February 01, 2011, 09:17:48 AM
Is there a simple way to substitute the first line in a text file? (Googled echo, cat, tail and sed but got only confused).
Title: Re: Adding xvnc to .xsession
Post by: danielibarnes on February 01, 2011, 11:11:15 AM
Is there a simple way to substitute the first line in a text file? (Googled echo, cat, tail and sed but got only confused).

sed '1s/^/inserted-text\n/' -i /home/tc/.xsession
Title: Re: Adding xvnc to .xsession
Post by: uggla on February 01, 2011, 03:07:03 PM
That wasn't quite right. This worked though:
sed -e '1d' -e '2i\newtext' -i /home/tc/.xsession
Title: Re: Adding xvnc to .xsession
Post by: danielibarnes on February 01, 2011, 03:33:46 PM
My reply was based on the snippet I tested with busybox sed:
tc@box:~$ seq 1 3|sed '1s/^/first\n/'
first
1
2
3
A different sed might give you different results.
Title: Re: Adding xvnc to .xsession
Post by: uggla on February 01, 2011, 04:14:35 PM
I got the same result but I wanted to substitute the first line, not add a new one.
Title: Re: Adding xvnc to .xsession
Post by: maro on February 01, 2011, 04:54:42 PM
Whilst a "delete first line and insert before the second" approach (as mentioned in reply #17) should work I wonder why you don't just substitute the entire line (via a 's/^.*$/replacemnet text/' expression).

Or along the lines of the formerly shown example:
Code: [Select]
tc@box:~$ seq 1 3 | sed '1s#^.*$#first#'
first
2
3

BTW, a few good links related to SED are mentioned here (http://forum.tinycorelinux.net/index.php?topic=5942.0).
Title: Re: Adding xvnc to .xsession
Post by: danielibarnes on February 01, 2011, 06:19:51 PM
I got the same result but I wanted to substitute the first line, not add a new one.

Sorry, I see that now. I did not read your question clearly.
Title: Re: Adding xvnc to .xsession
Post by: uggla on February 02, 2011, 03:09:18 AM
Thanks anyway, you pointed me in the right direction.  ;)