RSS
 

vinoctrl

#!/bin/bash

GCT="$(which gconftool-2)"
VNC_PASSWORD="/desktop/gnome/remote_access/vnc_password"
VNC_ENABLED="/desktop/gnome/remote_access/enabled"
VNC_PROMPT="/desktop/gnome/remote_access/prompt_enabled"
VNC_AUTHMETH="/desktop/gnome/remote_access/authentication_methods"
case "$1" in
    start)
        echo -n "Starting VINO..."
        ${GCT} -s -t bool ${VNC_ENABLED} "true"
        echo "done"
        ;;
    stop)
        echo -n "Stopping VINO..."
        ${GCT} -s -t bool ${VNC_ENABLED} "false"
        echo "done"
        ;;
    passwd)
        echo -n "Setting VINO password..."
        PASSWD="$2"
        if [ "x${PASSWD}" == "" ]
            then
            ${GCT} -s -t string ${VNC_PASSWORD} ""
        else
            ${GCT} -s -t string ${VNC_PASSWORD} "${PASSWD}"
        fi
        echo "done"
        ;;
    prompt)
        echo -n "Setting VINO prompt..."
        VPROMPT="$2"
        if [ "x${VPROMPT}" == "" ]
            then
            ${GCT} -s -t bool ${VNC_PROMPT} "false"
        else
            if [ "${VPROMPT}" == "true" -o "${VPROMPT}" == "1" -o "${VPROMPT}" == "on" ]
                then
                ${GCT} -s -t bool ${VNC_PROMPT} "true"
            else
                ${GCT} -s -t bool ${VNC_PROMPT} "false"
            fi
        fi
        echo "done"
        ;;
    query)
        echo "Vino Enabled: $(${GCT} -g ${VNC_ENABLED})"
        echo "Vino Password: $(${GCT} -g ${VNC_PASSWORD})"
        echo "Vino Prompt: $(${GCT} -g ${VNC_PROMPT})"
        ;;
    *)
        echo "usage: $(basename $0) {start|stop|passwd|prompt}"
        echo
        echo "Actions:"
        echo "    start                 Start the VINO service."
        echo "    stop                  Stop the VINO service."
        echo "    passwd [new-pass]     Set new password, if blank password is empty."
        echo "    prompt          Enable/Disable prompt for allowed connection."
        ;;
esac
Share

Leave a Reply