2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
15 # usage() - Prints the usage of the program
18 usage: $0 [-v volumes]
20 -v List of key pair values for volumes and mount points ( e. g. sda=/var/lib/docker/,sdb=/var/lib/libvirt/ )
24 # mount_external_partition() - Create partition and mount the external volume
25 function mount_external_partition {
26 local dev_name="/dev/$1"
29 sfdisk $dev_name --no-reread << EOF
32 mkfs -t ext4 ${dev_name}1
34 mount ${dev_name}1 $mount_dir
35 echo "${dev_name}1 $mount_dir ext4 errors=remount-ro,noatime,barrier=0 0 1" >> /etc/fstab
38 while getopts "h?v:" opt; do
41 dict_volumes="$OPTARG"
51 if [[ -n "${dict_volumes+x}" ]]; then
52 for kv in ${dict_volumes//,/ } ;do
53 mount_external_partition ${kv%=*} ${kv#*=}
57 vendor_id=$(lscpu|grep "Vendor ID")
58 if [[ $vendor_id == *GenuineIntel* ]]; then
59 kvm_ok=$(cat /sys/module/kvm_intel/parameters/nested)
60 if [[ $kvm_ok == 'N' ]]; then
61 echo "Enable Intel Nested-Virtualization"
63 echo 'options kvm-intel nested=y' >> /etc/modprobe.d/dist.conf
67 kvm_ok=$(cat /sys/module/kvm_amd/parameters/nested)
68 if [[ $kvm_ok == '0' ]]; then
69 echo "Enable AMD Nested-Virtualization"
71 sh -c "echo 'options kvm-amd nested=1' >> /etc/modprobe.d/dist.conf"
75 source /etc/os-release || source /usr/lib/os-release
80 apt-get install -y cpu-checker