#!/bin/sh
# Filename:      ~/.xinitrc.d/grml_vnc
# Purpose:       enable vnc if configured via bootoption
# Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports:   see http://grml.org/bugs/
# License:       This file is licensed under the GPL v2 or any later version.
################################################################################

if [ "$XINIT_GRML_VNC" = "false" ] ; then
   exit 0
fi

# if the vnc bootoption sets up the password let's start the vnc server
if [ -e "$HOME"/.vnc/passwd ]; then
   test -f "$HOME"/.vnc/options && OPTIONS=$(cat "$HOME"/.vnc/options)
   /usr/bin/x11vnc -bg -forever -noxdamage -o "$HOME"/.vnc/x11vnc.log -rfbauth \
                   "$HOME"/.vnc/passwd -auth "$HOME"/.Xauthority -display "$DISPLAY" "$OPTIONS"
fi

## END OF FILE #################################################################
