systemd & vnc - how to properly handle /etc/sysconfig/vncservers
On Wed, 20.07.11 11:48, Adam Tkac (email@example.com) wrote:
> Hello all,
> I'm trying to package systemd service file for tigervnc server and to
> find a solution how to make it backward-compatible with current format
> of the /etc/sysconfig/vncservers.
> Current /etc/sysconfig/vncservers has following options (example):
> VNCSERVERS="1:user1 2:user2"
> VNCSERVERARGS="-arg1 -arg2"
> VNCSERVERARGS="-arg3 -arg4"
> With arguments above traditional SysV initscript starts Xvnc instances
> for displays :1 and :2 which run under appropriate user (user1 and user2
> in this example) and passes arguments to Xvnc.
> If I understand systemd correctly it's a bad idea to try start multiple
> instances of the Xvnc via one systemd service file - I'm fine with this,
> admin will have to create multiple service files for multiple Xvnc
> However is there any way how to extract correct bits from the sysconfig
> file? I think it's easy with the VNCSERVERARGS[num] variable but I don't
> have any idea how to extract proper user from the VNCSERVERS variable.
> Does systemd support some kind of regex matching for the $<name>
> variables got from sysconfig files?
> Any idea how to handle the VNCSERVERS argument in backward-compatible
> way is welcomed, otherwise I will simply drop sysconfig support at all
> in the service file and admin will have to create /etc/systemd/system/
> service files with appropriate params.
You have a couple two options here:
a) I think this is one of the cases where the configuration in sysconfig
is just too cumbersome and a proper configuration file would bre really
useful. (It might even be an option to just fold this into gdm, so that
clients dynamically get a new screen). This of course requires hacking
vnc and/or gnome, so is not a short-term thing.
b) If you want to keep full compatibility with the sysconfig file, place
a start-up script in /usr/lib/vnc/start-vncserver-instance or so, which parses
it. Then, use instantiated systemd services, to instantiate individual
Description=VNC for %i
Place that in /lib/systemd/vncserver@.service or so. If a user then
wants to start a vnc server for a user, it is sufficien to run
"systemctl start vncserver@1:lennart.service" which would then cause
"/usr/lib/vnc/start-vnc-instance 1:lennart" to be started. Or, to make
this permanent: "ln -s /lib/systemd/vncserver@.service
Presumably most users will just use the same vnc server configuration,
and hence a couple of "ln -s" would be everything needed to instantiate
vnc for the users. If there's point in passing specific arguments to the
service for a specific user, then the admin should just copy
/etc/systemd/vncserver@1:lennart.service and edit it there. You can do
this for individual users.
Hope this clears some things up.
Lennart Poettering - Red Hat, Inc.
devel mailing list