Skip to content
Snippets Groups Projects
virtualbox 1.06 KiB
Newer Older
  • Learn to ignore specific revisions
  • Alberto LIVIO BECCARIA's avatar
    Alberto LIVIO BECCARIA committed
    #!/bin/bash
    
    ESAME_VB_CONFIG_FILE="/local/vbconsole/bin/kiosk.settings"
    
    getconf() {
    	# Get the right config file
    #	. /opt/esame/bin/getconf
    
    	# Source the current exam configuration
    #	. ${ESAME_CONF}
    
    	# Check the syntax of the configuration file
    #	/opt/esame/bin/esame-check-config.sh || exit 1
        
        ESAME_VIRTUALBOX=${args[1]}
        ESAME_USER=${args[2]}
    }
    
    stop() {
    	if [ -f ${ESAME_VB_CONFIG_FILE} ]; then
    		echo "STOP VIRTUALBOX KIOSK";
    		rm -rf ${ESAME_VB_CONFIG_FILE};
    	fi
    }
    
    start() {
        echo "ESAME_VIRTUALBOX = ${ESAME_VIRTUALBOX}"
        echo "ESAME_USER = ${ESAME_USER}"
        if [ $ESAME_VIRTUALBOX -eq 1 ]; then
            echo "START VIRTUALBOX KIOSK MODE";
            cat <<EOF1 >${ESAME_VB_CONFIG_FILE}
    VMSETUP="${VMSETUP}"
    VMNAME="${VMNAME}"
    EOF1
    		chown -h ${ESAME_USER} ${ESAME_VB_CONFIG_FILE}
    		chmod 755 ${ESAME_VB_CONFIG_FILE}
    		echo "Virtualbox kiosk config created in ${ESAME_VB_CONFIG_FILE}"
        fi
    }
    
    
    args=("$@")
    
    case "$1" in
    'start')
    	start
    	;;
    'stop')
    	stop
    	;;
    'restart')
    	stop
    	start
    	;;
    *)
    	echo "Usage: $0 { start | stop | restart }";
    	exit 1;
    	;;
    esac
    exit 0