summaryrefslogtreecommitdiffstats
path: root/core/modules/qemukvm/data/opt/openslx/scripts/systemd-qemukvm_env
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/qemukvm/data/opt/openslx/scripts/systemd-qemukvm_env')
-rw-r--r--core/modules/qemukvm/data/opt/openslx/scripts/systemd-qemukvm_env33
1 files changed, 33 insertions, 0 deletions
diff --git a/core/modules/qemukvm/data/opt/openslx/scripts/systemd-qemukvm_env b/core/modules/qemukvm/data/opt/openslx/scripts/systemd-qemukvm_env
new file mode 100644
index 00000000..e19ae1ee
--- /dev/null
+++ b/core/modules/qemukvm/data/opt/openslx/scripts/systemd-qemukvm_env
@@ -0,0 +1,33 @@
+#!/bin/ash
+# -----------------------------------------------------------------------------
+# Copyright (c) 2013 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+# -----------------------------------------------------------------------------
+# systemd-qemukvm_env
+# - This is the preparation script for the configuration of Linux Qemu/KVM.
+################################################################################
+
+
+modprobe kvm
+modprobe kvm_amd
+modprobe kvm_intel
+
+# check for Linux kvm modules (if required at all)
+
+lsmod |grep kvm || slxlog "qemukvm-modules" "Cannot find any kvm kernel module(s)"
+
+cat >> /etc/sudoers << EOF
+# allow to start and stop kvm services / load-/unload kvm modules
+ALL ALL=NOPASSWD: /opt/openslx/sbin/tunctl -t kvmnet*
+ALL ALL=NOPASSWD: /opt/openslx/sbin/tunctl -d kvmnet*
+ALL ALL=NOPASSWD: /opt/openslx/sbin/brctl addif br0 kvmnet*
+ALL ALL=NOPASSWD: /opt/openslx/bin/ip link set dev kvmnet* *
+EOF
+