root/trunk/VBoxVentriloControl/run.sh

Revision 107, 1.6 KB (checked in by kfitzgerald, 3 years ago)

Added source for VBoxVentriloControl for using ventrilo inside a virtualbox virtual machine

  • Property svn:executable set to *
Line 
1#!/bin/bash
2#
3# VirtualBox Ventrilo Controller
4# By Kevin Fitzgerald - kevin@kevinfitzgerald.net
5#
6# $Id$
7# $Url$
8#
9# This script loads the config and runs the actual controller.
10
11# Load the config
12. ./config.sh
13
14# Check the config
15if [ "$ConfigFinished" != "true" ]; then
16   
17   echo "Uh oh, doesn't look like you didn't made it though the end of the configuration process." >&2
18   echo "Make sure you edit the config file 'config.sh' and set up your preferences!"
19   exit 2
20fi
21
22# Check the event config
23EventUID=$(ls -al $EventDevice | cut -d" " -f3)
24EventGID=$(ls -al $EventDevice | cut -d" " -f4)
25
26# Do a preliminary check if the running user might not have access to the device
27if [ "$RunUserCheck" == "true" -a "$EventUID" != "$(whoami)" -a "$EventGID" != "$(whoami)" -a "$(whoami)" != "root" ]; then
28   
29   # If they failed the prelim check, check if they should automatically attempt to sudo to get access
30   if [ "$RunAutoSudo" != "true" ]; then
31     
32      # Don't auto sudo, so ask if they want to continue
33      echo " ** Warning: You might not have access to read the device."
34      echo -n " Continue with attempt to sudo? (Y/n): "
35      read continueChoice
36     
37      # If not, end
38      if [ "$continueChoice" == "n" -o "$continueChoice" == "N" ]; then
39         echo "Aborted."
40         exit 1;
41      fi
42     
43   else
44     
45      # Auto sudo to get access and run the controller
46      sudo ./VBoxVentriloControl $EventDevice $InputKeyCode
47      exit $?
48     
49   fi
50else
51
52   # No potential problems found, run the controller
53   ./VBoxVentriloControl $EventDevice $InputKeyCode
54   exit $?
55   
56fi
Note: See TracBrowser for help on using the browser.