[go: up one dir, main page]

Menu

[r24]: / trunk / configure  Maximize  Restore  History

Download this file

111 lines (86 with data), 3.1 kB

#! /usr/bin/perl
#
#    This is vcontrol, a administration software for KVM virtual machines
#    Copyright (C) 2008-2014  Stefan Hoefer <stefan@hoefer.ch>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

my $VERSION = `cat version`;
my $NAME = "virtualcontrol";

chomp $VERSION;

#-----------------------------------------------------------------------
# nothing to be edited from here on!
#-----------------------------------------------------------------------

if (@ARGV > 0) {
   die "Please do your configurations in this script, right at the beginning! Stopping here...\n";
}

print "Configuring $NAME version $VERSION\n\n";

open VERSIONFILE, ">version" or die "Could not write version!\n";

print VERSIONFILE $VERSION;

close VERSIONFILE;

print "Checking for dependencies...";

my @packages = qw(File::Spec);
my @needed;

foreach my $package (@packages) {
   eval "require $package;";

   if ($@) {
      push @needed, $package;
   }
}

if (@needed > 0) {
   print "\n\n";
   print "Required, but not found, Perl modules:\n\n";

   foreach my $package (@needed) {
      print "   $package\n";
   }

   print "\n";
   die "Please install these packages before we can continue.\n";
}
else {
   print "OK\n\n";
}

if (!-e "/dev/kvm") {
	die "Your system does not support kvm!\n";
}

if (!-e "/dev/vhost-net") {
	die "Your system does not support vhost virtio-net acceleration!\n";
}

if (!-e "/usr/bin/qemu-system-x86_64") {
	die "Please install qemu (with kvm support)!\n";
}

if (!-e "/usr/bin/sudo") {
    die "Please install sudo!\n";
}

if (!-e "/usr/bin/socat") {
   die "Please install socat!\n";
}

if (!-e "/usr/bin/tunctl" && ! -e "/usr/sbin/tunctl") {
   die "Please install tunctl (UML utilities)!\n";
}

if (!-e "/usr/bin/uuidgen") {
	die "Please install uuidgen!\n";
}

if (!system("grep vmx /proc/cpuinfo &> /dev/null")) {
   print "INFO: Your system supports Intel virtualization (Vanderpool)\n";
}
elsif (!system("grep svm /proc/cpuinfo &> /dev/null")) {
   print "INFO: Your system supports AMD virtualization (Pacifica)\n";
}
else {
   print "!!! NOTE !!! Your system is probably not ready for hardware accelerated virtualization.\n";
   print "This may mean that you'll have to activate it in the BIOS, or this may mean that your processor is not capable of such things.\n";
   print "Before you continue, I strongly recommend you fix this!\n";
}

print "The software is now ready to be installed, please proceed:\n\n";
print "   make\n";
print "   make install\n";