-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Cache location * feat: Cache location * feat: Add support URL * feat: Cache location * fix: Remove files * feat: Reset filesystem * fix: Exit when PID is missing * fix: Counter file * fix: Check flags * docs: Readme * feat: Cleanup files * fix: Check flags * fix: Check flags * fix: Initialization * fix: Initalization * fix: Initialization * fix: Cleanup temp * fix: Initialize system * feat: Config system * feat: Configure system * fix: Variables * fix: Variables * fix: Error handling * style: Comments * fix: Returnvalue * fix: Returnvalue * fix: Returnvalue * fix: Returnvalue * fix: Returnvalue * docs: Multi-disk support * feat: Use cached location * fix: Swap order
- Loading branch information
Showing
12 changed files
with
208 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
set -Eeuo pipefail | ||
|
||
KVM_ERR="" | ||
KVM_OPTS="" | ||
|
||
if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then | ||
if ! grep -q -e vmx -e svm /proc/cpuinfo; then | ||
KVM_ERR="(vmx/svm disabled)" | ||
fi | ||
else | ||
[ -e /dev/kvm ] && KVM_ERR="(no write access)" || KVM_ERR="(device file missing)" | ||
fi | ||
|
||
if [ -n "${KVM_ERR}" ]; then | ||
if [ "$ARCH" == "amd64" ]; then | ||
error "KVM acceleration not detected ${KVM_ERR}, see the FAQ about this." | ||
[[ "${DEBUG}" != [Yy1]* ]] && exit 88 | ||
fi | ||
else | ||
KVM_OPTS=",accel=kvm -enable-kvm -cpu host" | ||
fi | ||
|
||
DEF_OPTS="-nographic -nodefaults -boot strict=on -display none" | ||
RAM_OPTS=$(echo "-m ${RAM_SIZE}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') | ||
CPU_OPTS="-smp ${CPU_CORES},sockets=1,dies=1,cores=${CPU_CORES},threads=1" | ||
MAC_OPTS="-machine type=q35,usb=off,dump-guest-core=off,hpet=off${KVM_OPTS}" | ||
EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4" | ||
EXTRA_OPTS="$EXTRA_OPTS -object rng-random,id=objrng0,filename=/dev/urandom" | ||
EXTRA_OPTS="$EXTRA_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c" | ||
|
||
if [[ "${GPU}" == [Yy1]* ]] && [[ "$ARCH" == "amd64" ]]; then | ||
DEF_OPTS="-nodefaults -boot strict=on -display egl-headless,rendernode=/dev/dri/renderD128" | ||
DEF_OPTS="${DEF_OPTS} -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1" | ||
fi | ||
|
||
ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS} ${ARGUMENTS}" | ||
ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ') | ||
|
||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.