diff --git a/nlvmi b/nlvmi index 35e820a..61ae12f 100755 --- a/nlvmi +++ b/nlvmi @@ -8,7 +8,6 @@ if [ $LOGLEVEL -gt "1" ]; then echo "configuration loaded"; fi if [ ! -d $VMDIRECTORY ]; then echo "VMDIRECTORY wrong, $VMDIRECTORY does not exist"; exit 1; fi if [ ! -d $RUNDIRECTORY ]; then if [ $LOGLEVEL -gt "1" ]; then echo "creating $RUNDIRECTORY"; fi; mkdir -p $RUNDIRECTORY; fi - #checking database function checkdb { if [ $DATABASETYPE == "sqlite" ]; then @@ -31,10 +30,6 @@ echo "sqlite ready to use"; return 0 } - - - - #creating database function createdb { if [ $LOGLEVEL -gt "1" ]; then echo "going to create the db"; fi @@ -76,6 +71,7 @@ function createdb { password VARCHAR(50), admin INTEGER );" + chown -R nobody $SQLITEFILE fi checkdb && echo "DB creation successful!" || (echo "Failed to create the DB"; exit 1) } @@ -144,10 +140,26 @@ function vmstart { USBDEV3=""; fi if [ ${array[23]}!="" ]; then USBDEV3="-usbdevice ${array[22]}"; fi + if [ ${array[29]}=="" ]; then + CPUTYPE=""; fi + if [ ${array[29]}!="" ]; then + CPUTYPE="-cpu ${array[29]}"; fi + if [ ${array[27]}=="" ]; then + SMP=""; fi + if [ ${array[27]}!="" ]; then + SMP="-smp ${array[27]}"; fi + if [ ${array[26]}=="" ]; then + MEMORY=""; fi + if [ ${array[26]}!="" ]; then + MEMORY="-m ${array[26]}"; fi + if [ ${array[28]}=="" ]; then + CUSTOM=""; fi + if [ ${array[28]}!="" ]; then + CUSTOM="${array[28]}"; fi tunctl -t $TAPDEV1 -u ${array[3]} brctl addif br0 $TAPDEV1 ifconfig $TAPDEV1 up - su ${array[3]} -c \"${array[10]} -enable-kvm -cpu host -m 1024 -smp 2 -boot ${array[5]} $USBDEV1 $USBDEV2 $USBDEV3 -k ${array[24]} -daemonize $DRIVE1 $DRIVE2 $DRIVE3 $CDROM $NETDEV1 $TAPDEV1 $TAPDEV2 $TAPDEV3 $VNCPORT -pidfile $RUNDIRECTORY/${array[1]}.pid -monitor unix:$RUNDIRECTORY/${array[1]}.mon,server,nowait\" + su ${array[3]} -c \"${array[10]} -enable-kvm $CPUTYPE $MEMORY $SMP -boot ${array[5]} $USBDEV1 $USBDEV2 $USBDEV3 -k ${array[24]} -daemonize $DRIVE1 $DRIVE2 $DRIVE3 $CDROM $NETDEV1 $TAPDEV1 $TAPDEV2 $TAPDEV3 $VNCPORT $CUSTOM -pidfile $RUNDIRECTORY/${array[1]}.pid -monitor unix:$RUNDIRECTORY/${array[1]}.mon,server,nowait\" #Set VNC Password echo "change vnc password ${array[20]}" | socat - unix-connect:$RUNDIRECTORY/${array[1]}.mon >/dev/null