################################################################################
# Filename: ./src/plugins/vnclogin/include/vnclogin-functions
# 
# The contents of this file are subject to the Qlusters Public License
# Version 1.1 (the License); you may not use this file except in compliance
# with the License.
# You may obtain a copy of the License at
# http://www.openqrm.org/content/view/33/69/.
# 
# Software distributed under the License is distributed on an AS IS basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
# the specific language governing rights and limitations under the License.
# 
# The Original Code is openQRM.
# 
# The Initial Developer of the Original Code is Qlusters Corporation. Portions
# created by Qlusters Corporation are Copyright (C) 2003-2005. All Rights
# Reserved.
# 
# Contributor(s):
# 
# Description:
# 
# Comments:
################################################################################
function vnclogin_install() {
	echo "Installing vnclogin"	
	/bin/rm -f $QRM_SERVER_BASE_DIR/qrm/java/webapp/unsecure/vnclogin
	ln -sf $QRM_SERVER_BASE_DIR/qrm/plugins/vnclogin/web $QRM_SERVER_BASE_DIR/qrm/java/webapp/unsecure/vnclogin
	echo
	echo "Compiling the VncViewer.jar completed"
	echo "Now we have to sign the jar-file to allow connecting to any remote nodes."
	echo "The following procedure will ask you question about the configuration for the signing procedure."
	echo "Please answer them all the correctly sign the VncViewer.jar file. Starting now ...."
	keytool -genkey -keystore $QRM_SERVER_BASE_DIR/qrm/plugins/vnclogin/web/openqrm.store -alias openqrm
	keytool -export -keystore $QRM_SERVER_BASE_DIR/qrm/plugins/vnclogin/web/openqrm.store -alias openqrm -file $QRM_SERVER_BASE_DIR/qrm/plugins/vnclogin/web/openqrm.cer
	jarsigner -keystore $QRM_SERVER_BASE_DIR/qrm/plugins/vnclogin/web/openqrm.store $QRM_SERVER_BASE_DIR/qrm/java/webapp/unsecure/vnclogin/VncViewer.jar openqrm
	
}

function vnclogin_uninstall() {
	echo "Uninstalling vnclogin"
	/bin/rm -f $QRM_SERVER_BASE_DIR/qrm/java/webapp/unsecure/vnclogin
}

function vnclogin_run_once() {
	: # code that will run once by the server
}

function vnclogin_start() {
	echo "Starting vnclogin"
}

function vnclogin_stop() {
	echo "Stopping vnclogin"
}

