mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-08 01:18:32 +08:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1b8054e847 | ||
|
631a558a9f | ||
|
d5805b4e08 | ||
|
1dc15ce2e0 | ||
|
4145e811df | ||
|
fe8615d7d3 | ||
|
27ea5506bc | ||
|
394131a0d7 | ||
|
4d0d16023f | ||
|
60dd794b29 | ||
|
f13d104968 | ||
|
914099fd12 | ||
|
639725957d | ||
|
64bbe82c4a | ||
|
73a13e5697 | ||
|
e8ec5fb8ed | ||
|
0b500ca377 | ||
|
df58745ed8 | ||
|
55e8ab4930 | ||
|
4882fd3bf6 |
2
.github/ISSUE_TEMPLATE/1-issue.yml
vendored
2
.github/ISSUE_TEMPLATE/1-issue.yml
vendored
@ -21,6 +21,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Docker compose
|
label: Docker compose
|
||||||
description: The compose file (or otherwise the `docker run` command used).
|
description: The compose file (or otherwise the `docker run` command used).
|
||||||
|
render: yaml
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
@ -28,6 +29,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Docker log
|
label: Docker log
|
||||||
description: The logfile of the container (as shown by `docker logs dsm`).
|
description: The logfile of the container (as shown by `docker logs dsm`).
|
||||||
|
render: shell
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
2
.github/ISSUE_TEMPLATE/3-bug.yml
vendored
2
.github/ISSUE_TEMPLATE/3-bug.yml
vendored
@ -23,6 +23,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Docker compose
|
label: Docker compose
|
||||||
description: The compose file (or otherwise the `docker run` command used).
|
description: The compose file (or otherwise the `docker run` command used).
|
||||||
|
render: yaml
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
@ -30,6 +31,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Docker log
|
label: Docker log
|
||||||
description: The logfile of the container (as shown by `docker logs dsm`).
|
description: The logfile of the container (as shown by `docker logs dsm`).
|
||||||
|
render: shell
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
@ -44,7 +44,7 @@ RUN set -eu && \
|
|||||||
netcat-openbsd \
|
netcat-openbsd \
|
||||||
qemu-system-x86 && \
|
qemu-system-x86 && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
pip3 install --no-cache-dir --break-system-packages dissect.cstruct && \
|
pip3 install --no-cache-dir --break-system-packages --root-user-action=ignore dissect.cstruct && \
|
||||||
mkdir -p /etc/qemu && \
|
mkdir -p /etc/qemu && \
|
||||||
echo "allow br0" > /etc/qemu/bridge.conf && \
|
echo "allow br0" > /etc/qemu/bridge.conf && \
|
||||||
unlink /etc/nginx/sites-enabled/default && \
|
unlink /etc/nginx/sites-enabled/default && \
|
||||||
@ -61,9 +61,9 @@ ADD --chmod=775 https://raw.githubusercontent.com/sud0woodo/patology/refs/heads/
|
|||||||
VOLUME /storage
|
VOLUME /storage
|
||||||
EXPOSE 22 139 445 5000
|
EXPOSE 22 139 445 5000
|
||||||
|
|
||||||
ENV RAM_SIZE="1G"
|
ENV RAM_SIZE="2G"
|
||||||
|
ENV CPU_CORES="2"
|
||||||
ENV DISK_SIZE="16G"
|
ENV DISK_SIZE="16G"
|
||||||
ENV CPU_CORES="1"
|
|
||||||
|
|
||||||
HEALTHCHECK --interval=60s --start-period=45s --retries=2 CMD /run/check.sh
|
HEALTHCHECK --interval=60s --start-period=45s --retries=2 CMD /run/check.sh
|
||||||
|
|
||||||
|
15
readme.md
15
readme.md
@ -47,7 +47,7 @@ services:
|
|||||||
##### Via Docker CLI:
|
##### Via Docker CLI:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -it --rm --name dsm -p 5000:5000 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN -v ${PWD:-.}/dsm:/storage --stop-timeout 120 vdsm/virtual-dsm
|
docker run -it --rm --name dsm -p 5000:5000 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN -v "${PWD:-.}/dsm:/storage" --stop-timeout 120 vdsm/virtual-dsm
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Via Kubernetes:
|
##### Via Kubernetes:
|
||||||
@ -58,7 +58,7 @@ kubectl apply -f https://raw.githubusercontent.com/vdsm/virtual-dsm/refs/heads/m
|
|||||||
|
|
||||||
##### Via Github Codespaces:
|
##### Via Github Codespaces:
|
||||||
|
|
||||||
[](https://github.com/codespaces/new?repo=619260050&machine=basicLinux32gb)
|
[](https://codespaces.new/vdsm/virtual-dsm)
|
||||||
|
|
||||||
## FAQ 💬
|
## FAQ 💬
|
||||||
|
|
||||||
@ -123,20 +123,19 @@ kubectl apply -f https://raw.githubusercontent.com/vdsm/virtual-dsm/refs/heads/m
|
|||||||
|
|
||||||
### How do I pass-through a disk?
|
### How do I pass-through a disk?
|
||||||
|
|
||||||
It is possible to pass-through a disk device directly, which can be useful when your host is a virtual machine, as it removes an extra layer and allows for easier image management on the host.
|
It is possible to pass-through disk devices or partitions directly by adding them to your compose file in this way:
|
||||||
|
|
||||||
For use with physical disks this method provides little advantage over using an image and is not recommended. You can add the device to your compose file like this:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
devices:
|
devices:
|
||||||
- /dev/sdc:/disk1
|
- /dev/sdb:/disk1
|
||||||
|
- /dev/sdc1:/disk2
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace `/dev/sdc` with the name of the disk. It needs to be totally empty (without any partition table) otherwise DSM does not always format it into a volume.
|
Make sure it is totally empty (without any filesystem), otherwise DSM may not format it as a volume.
|
||||||
|
|
||||||
### How do I change the amount of CPU or RAM?
|
### How do I change the amount of CPU or RAM?
|
||||||
|
|
||||||
By default, the container will be allowed to use a maximum of 1 CPU core and 1 GB of RAM.
|
By default, the container will be allowed to use a maximum of 2 CPU cores and 2 GB of RAM.
|
||||||
|
|
||||||
If you want to adjust this, you can specify the desired amount using the following environment variables:
|
If you want to adjust this, you can specify the desired amount using the following environment variables:
|
||||||
|
|
||||||
|
41
src/disk.sh
41
src/disk.sh
@ -320,7 +320,7 @@ convertDisk() {
|
|||||||
|
|
||||||
msg="Conversion of $DISK_DESC"
|
msg="Conversion of $DISK_DESC"
|
||||||
html "$msg completed..."
|
html "$msg completed..."
|
||||||
info "$msg to $DST_FMT completed succesfully!"
|
info "$msg to $DST_FMT completed successfully!"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -368,6 +368,8 @@ createDevice () {
|
|||||||
local DISK_FMT=$5
|
local DISK_FMT=$5
|
||||||
local DISK_IO=$6
|
local DISK_IO=$6
|
||||||
local DISK_CACHE=$7
|
local DISK_CACHE=$7
|
||||||
|
local DISK_SERIAL=$8
|
||||||
|
local DISK_SECTORS=$9
|
||||||
local DISK_ID="data$DISK_INDEX"
|
local DISK_ID="data$DISK_INDEX"
|
||||||
|
|
||||||
local index=""
|
local index=""
|
||||||
@ -381,29 +383,29 @@ createDevice () {
|
|||||||
;;
|
;;
|
||||||
"usb" )
|
"usb" )
|
||||||
result+=",if=none \
|
result+=",if=none \
|
||||||
-device usb-storage,drive=${DISK_ID}${index}"
|
-device usb-storage,drive=${DISK_ID}${index}${DISK_SERIAL}${DISK_SECTORS}"
|
||||||
echo "$result"
|
echo "$result"
|
||||||
;;
|
;;
|
||||||
"nvme" )
|
"nvme" )
|
||||||
result+=",if=none \
|
result+=",if=none \
|
||||||
-device nvme,drive=${DISK_ID}${index},serial=deadbeaf${DISK_INDEX}"
|
-device nvme,drive=${DISK_ID}${index},serial=deadbeaf${DISK_INDEX}${DISK_SERIAL}${DISK_SECTORS}"
|
||||||
echo "$result"
|
echo "$result"
|
||||||
;;
|
;;
|
||||||
"ide" | "sata" )
|
"ide" | "sata" )
|
||||||
result+=",if=none \
|
result+=",if=none \
|
||||||
-device ich9-ahci,id=ahci${DISK_INDEX},addr=$DISK_ADDRESS \
|
-device ich9-ahci,id=ahci${DISK_INDEX},addr=$DISK_ADDRESS \
|
||||||
-device ide-hd,drive=${DISK_ID},bus=ahci$DISK_INDEX.0,rotation_rate=$DISK_ROTATION${index}"
|
-device ide-hd,drive=${DISK_ID},bus=ahci$DISK_INDEX.0,rotation_rate=$DISK_ROTATION${index}${DISK_SERIAL}${DISK_SECTORS}"
|
||||||
echo "$result"
|
echo "$result"
|
||||||
;;
|
;;
|
||||||
"blk" | "virtio-blk" )
|
"blk" | "virtio-blk" )
|
||||||
result+=",if=none \
|
result+=",if=none \
|
||||||
-device virtio-blk-pci,drive=${DISK_ID},bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2${index}"
|
-device virtio-blk-pci,drive=${DISK_ID},bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2${index}${DISK_SERIAL}${DISK_SECTORS}"
|
||||||
echo "$result"
|
echo "$result"
|
||||||
;;
|
;;
|
||||||
"scsi" | "virtio-scsi" )
|
"scsi" | "virtio-scsi" )
|
||||||
result+=",if=none \
|
result+=",if=none \
|
||||||
-device virtio-scsi-pci,id=${DISK_ID}b,bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2 \
|
-device virtio-scsi-pci,id=${DISK_ID}b,bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2 \
|
||||||
-device scsi-hd,drive=${DISK_ID},bus=${DISK_ID}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${index}"
|
-device scsi-hd,drive=${DISK_ID},bus=${DISK_ID}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${index}${DISK_SERIAL}${DISK_SECTORS}"
|
||||||
echo "$result"
|
echo "$result"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -482,7 +484,7 @@ addDisk () {
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DISK_OPTS+=$(createDevice "$DISK_FILE" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE")
|
DISK_OPTS+=$(createDevice "$DISK_FILE" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE" "" "")
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -497,7 +499,26 @@ addDevice () {
|
|||||||
[ -z "$DISK_DEV" ] && return 0
|
[ -z "$DISK_DEV" ] && return 0
|
||||||
[ ! -b "$DISK_DEV" ] && error "Device $DISK_DEV cannot be found! Please add it to the 'devices' section of your compose file." && exit 55
|
[ ! -b "$DISK_DEV" ] && error "Device $DISK_DEV cannot be found! Please add it to the 'devices' section of your compose file." && exit 55
|
||||||
|
|
||||||
DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE")
|
local sectors=""
|
||||||
|
local result logical physical
|
||||||
|
result=$(fdisk -l "$DISK_DEV" | grep -m 1 -o "(logical/physical): .*" | cut -c 21-)
|
||||||
|
logical="${result%% *}"
|
||||||
|
physical=$(echo "$result" | grep -m 1 -o "/ .*" | cut -c 3-)
|
||||||
|
physical="${physical%% *}"
|
||||||
|
|
||||||
|
if [ -n "$physical" ]; then
|
||||||
|
if [[ "$physical" == "512" ]] || [[ "$physical" == "4096" ]]; then
|
||||||
|
if [[ "$physical" == "4096" ]]; then
|
||||||
|
sectors=",logical_block_size=$logical,physical_block_size=$physical"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Unknown physical sector size: $physical for $DISK_DEV"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Failed to determine the sector size for $DISK_DEV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE" "" "$sectors")
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -529,8 +550,8 @@ else
|
|||||||
DISK_ALLOC="preallocation=falloc"
|
DISK_ALLOC="preallocation=falloc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "1" "0xa" "raw" "$DISK_IO" "$DISK_CACHE")
|
DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "1" "0xa" "raw" "$DISK_IO" "$DISK_CACHE" "" "")
|
||||||
DISK_OPTS+=$(createDevice "$SYSTEM" "$DISK_TYPE" "2" "0xb" "raw" "$DISK_IO" "$DISK_CACHE")
|
DISK_OPTS+=$(createDevice "$SYSTEM" "$DISK_TYPE" "2" "0xb" "raw" "$DISK_IO" "$DISK_CACHE" "" "")
|
||||||
|
|
||||||
DISK1_FILE="$STORAGE/${DISK_NAME}"
|
DISK1_FILE="$STORAGE/${DISK_NAME}"
|
||||||
if [[ ! -f "$DISK1_FILE.img" ]] && [[ -f "$STORAGE/data${DISK_SIZE}.img" ]]; then
|
if [[ ! -f "$DISK1_FILE.img" ]] && [[ -f "$STORAGE/data${DISK_SIZE}.img" ]]; then
|
||||||
|
@ -8,7 +8,9 @@ set -Eeuo pipefail
|
|||||||
: "${DISPLAY:="none"}" # Display type
|
: "${DISPLAY:="none"}" # Display type
|
||||||
: "${RENDERNODE:="/dev/dri/renderD128"}" # Render node
|
: "${RENDERNODE:="/dev/dri/renderD128"}" # Render node
|
||||||
|
|
||||||
if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then
|
CPU_VENDOR=$(lscpu | awk '/Vendor ID/{print $3}')
|
||||||
|
|
||||||
|
if [[ "$GPU" != [Yy1]* ]] || [[ "$CPU_VENDOR" != "GenuineIntel" ]] || [[ "$ARCH" != "amd64" ]]; then
|
||||||
|
|
||||||
[[ "${DISPLAY,,}" == "none" ]] && VGA="none"
|
[[ "${DISPLAY,,}" == "none" ]] && VGA="none"
|
||||||
DISPLAY_OPTS="-display $DISPLAY -vga $VGA"
|
DISPLAY_OPTS="-display $DISPLAY -vga $VGA"
|
||||||
|
@ -13,28 +13,30 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
FN="boot.pat"
|
FN="boot.pat"
|
||||||
if [ -d "/$FN" ]; then
|
DIR=$(find / -maxdepth 1 -type d -iname "$FN" -print -quit)
|
||||||
error "The file /$FN does not exist, please check that you mapped it to a valid path!" && exit 65
|
[ ! -d "$DIR" ] && DIR=$(find "$STORAGE" -maxdepth 1 -type d -iname "$FN" -print -quit)
|
||||||
|
|
||||||
|
if [ -d "$DIR" ]; then
|
||||||
|
BASE="DSM_VirtualDSM" && URL="file://$DIR"
|
||||||
|
if [[ ! -s "$STORAGE/$BASE.boot.img" ]] || [[ ! -s "$STORAGE/$BASE.system.img" ]]; then
|
||||||
|
error "The bind $DIR maps to a file that does not exist!" && exit 65
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILE=$(find / -maxdepth 1 -type f -iname "$FN" | head -n 1)
|
FILE=$(find / -maxdepth 1 -type f -iname "$FN" -print -quit)
|
||||||
[ ! -s "$FILE" ] && FILE=$(find "$STORAGE" -maxdepth 1 -type f -iname "$FN" | head -n 1)
|
[ ! -s "$FILE" ] && FILE=$(find "$STORAGE" -maxdepth 1 -type f -iname "$FN" -print -quit)
|
||||||
[ -s "$FILE" ] && BASE="DSM_VirtualDSM" && URL="file://$FILE"
|
[ -s "$FILE" ] && BASE="DSM_VirtualDSM" && URL="file://$FILE"
|
||||||
|
|
||||||
if [ -n "$URL" ]; then
|
if [ -n "$URL" ] && [ ! -s "$FILE" ] && [ ! -d "$DIR" ]; then
|
||||||
if [ ! -s "$FILE" ]; then
|
|
||||||
BASE=$(basename "$URL" .pat)
|
BASE=$(basename "$URL" .pat)
|
||||||
if [ ! -s "$STORAGE/$BASE.system.img" ]; then
|
if [ ! -s "$STORAGE/$BASE.system.img" ]; then
|
||||||
BASE=$(basename "${URL%%\?*}" .pat)
|
BASE=$(basename "${URL%%\?*}" .pat)
|
||||||
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
|
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
|
||||||
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
|
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
if [[ "${URL,,}" != "http"* ]] && [[ "${URL,,}" != "file:"* ]] ; then
|
if [[ "${URL,,}" != "http"* ]] && [[ "${URL,,}" != "file:"* ]] ; then
|
||||||
URL="file:///$BASE.pat"
|
[ ! -s "$STORAGE/$BASE.pat" ] && error "Invalid URL: $URL" && exit 65
|
||||||
if [ ! -s "/$BASE.pat" ]; then
|
URL="file://$STORAGE/$BASE.pat"
|
||||||
error "File '$BASE.pat' does not exist!" && exit 65
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -268,12 +270,9 @@ mv "$HDA.tgz" "$HDA.txz"
|
|||||||
[ -d "$PKG" ] && mv "$PKG/" "$MOUNT/.SynoUpgradePackages/"
|
[ -d "$PKG" ] && mv "$PKG/" "$MOUNT/.SynoUpgradePackages/"
|
||||||
rm -f "$MOUNT/.SynoUpgradePackages/ActiveInsight-"*
|
rm -f "$MOUNT/.SynoUpgradePackages/ActiveInsight-"*
|
||||||
|
|
||||||
[ -s "$HDP.txz" ] && tar xpfJ "$HDP.txz" --absolute-names -C "$MOUNT/"
|
|
||||||
|
|
||||||
if [ -s "$IDB.txz" ]; then
|
if [ -s "$IDB.txz" ]; then
|
||||||
INDEX_DB="$MOUNT/usr/syno/synoman/indexdb/"
|
INDEX_DB="$MOUNT/usr/syno/synoman/indexdb"
|
||||||
mkdir -p "$INDEX_DB"
|
mkdir -p "$INDEX_DB"
|
||||||
tar xpfJ "$IDB.txz" --absolute-names -C "$INDEX_DB"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LABEL="1.44.1-42218"
|
LABEL="1.44.1-42218"
|
||||||
@ -282,6 +281,8 @@ NUMBLOCKS="2097152" # (16777216 * 512) / 4096
|
|||||||
MSG="Installing system partition..."
|
MSG="Installing system partition..."
|
||||||
|
|
||||||
fakeroot -- bash -c "set -Eeu;\
|
fakeroot -- bash -c "set -Eeu;\
|
||||||
|
[ -s $HDP.txz ] && tar xpfJ $HDP.txz --absolute-names -C $MOUNT/;\
|
||||||
|
[ -s $IDB.txz ] && tar xpfJ $IDB.txz --absolute-names -C $INDEX_DB/;\
|
||||||
tar xpfJ $HDA.txz --absolute-names --skip-old-files -C $MOUNT/;\
|
tar xpfJ $HDA.txz --absolute-names --skip-old-files -C $MOUNT/;\
|
||||||
printf '%b%s%b' '\E[1;34m❯ \E[1;36m' 'Install: $MSG' '\E[0m\n';\
|
printf '%b%s%b' '\E[1;34m❯ \E[1;36m' 'Install: $MSG' '\E[0m\n';\
|
||||||
mke2fs -q -t ext4 -b 4096 -d $MOUNT/ -L $LABEL -F -E offset=$OFFSET $SYSTEM $NUMBLOCKS"
|
mke2fs -q -t ext4 -b 4096 -d $MOUNT/ -L $LABEL -F -E offset=$OFFSET $SYSTEM $NUMBLOCKS"
|
||||||
|
@ -176,7 +176,11 @@ getHostPorts() {
|
|||||||
|
|
||||||
configureUser() {
|
configureUser() {
|
||||||
|
|
||||||
|
if [ -z "$IP6" ]; then
|
||||||
NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.1,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"
|
NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.1,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"
|
||||||
|
else
|
||||||
|
NET_OPTS="-netdev user,id=hostnet0,ipv4=on,host=${VM_NET_IP%.*}.1,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,ipv6=on,hostname=$VM_NET_HOST"
|
||||||
|
fi
|
||||||
|
|
||||||
local forward
|
local forward
|
||||||
forward=$(getUserPorts "$USER_PORTS")
|
forward=$(getUserPorts "$USER_PORTS")
|
||||||
@ -192,6 +196,7 @@ configureNAT() {
|
|||||||
|
|
||||||
# Create the necessary file structure for /dev/net/tun
|
# Create the necessary file structure for /dev/net/tun
|
||||||
if [ ! -c /dev/net/tun ]; then
|
if [ ! -c /dev/net/tun ]; then
|
||||||
|
[[ "$PODMAN" == [Yy1]* ]] && return 1
|
||||||
[ ! -d /dev/net ] && mkdir -m 755 /dev/net
|
[ ! -d /dev/net ] && mkdir -m 755 /dev/net
|
||||||
if mknod /dev/net/tun c 10 200; then
|
if mknod /dev/net/tun c 10 200; then
|
||||||
chmod 666 /dev/net/tun
|
chmod 666 /dev/net/tun
|
||||||
@ -199,15 +204,15 @@ configureNAT() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -c /dev/net/tun ]; then
|
if [ ! -c /dev/net/tun ]; then
|
||||||
[[ "$PODMAN" != [Yy1]* ]] && error "$tuntap"
|
error "$tuntap" && return 1
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check port forwarding flag
|
# Check port forwarding flag
|
||||||
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
||||||
{ sysctl -w net.ipv4.ip_forward=1 > /dev/null; rc=$?; } || :
|
{ sysctl -w net.ipv4.ip_forward=1 > /dev/null 2>&1; rc=$?; } || :
|
||||||
if (( rc != 0 )) || [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
if (( rc != 0 )) || [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
||||||
[[ "$PODMAN" != [Yy1]* ]] && error "IP forwarding is disabled. $ADD_ERR --sysctl net.ipv4.ip_forward=1"
|
[[ "$PODMAN" == [Yy1]* ]] && return 1
|
||||||
|
error "IP forwarding is disabled. $ADD_ERR --sysctl net.ipv4.ip_forward=1"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -338,17 +343,17 @@ closeNetwork() {
|
|||||||
|
|
||||||
checkOS() {
|
checkOS() {
|
||||||
|
|
||||||
local name
|
local kernel
|
||||||
local os=""
|
local os=""
|
||||||
local if="macvlan"
|
local if="macvlan"
|
||||||
name=$(uname -a)
|
kernel=$(uname -a)
|
||||||
|
|
||||||
[[ "${name,,}" == *"darwin"* ]] && os="Docker Desktop for macOS"
|
[[ "${kernel,,}" == *"darwin"* ]] && os="Docker Desktop for macOS"
|
||||||
[[ "${name,,}" == *"microsoft"* ]] && os="Docker Desktop for Windows"
|
[[ "${kernel,,}" == *"microsoft"* ]] && os="Docker Desktop for Windows"
|
||||||
|
|
||||||
if [[ "$DHCP" == [Yy1]* ]]; then
|
if [[ "$DHCP" == [Yy1]* ]]; then
|
||||||
if="macvtap"
|
if="macvtap"
|
||||||
[[ "${name,,}" == *"synology"* ]] && os="Synology Container Manager"
|
[[ "${kernel,,}" == *"synology"* ]] && os="Synology Container Manager"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$os" ]; then
|
if [ -n "$os" ]; then
|
||||||
|
18
src/proc.sh
18
src/proc.sh
@ -37,14 +37,14 @@ if [[ "$KVM" != [Nn]* ]]; then
|
|||||||
KVM_ERR=""
|
KVM_ERR=""
|
||||||
|
|
||||||
if [ ! -e /dev/kvm ]; then
|
if [ ! -e /dev/kvm ]; then
|
||||||
KVM_ERR="(device file missing)"
|
KVM_ERR="(/dev/kvm is missing)"
|
||||||
else
|
else
|
||||||
if ! sh -c 'echo -n > /dev/kvm' &> /dev/null; then
|
if ! sh -c 'echo -n > /dev/kvm' &> /dev/null; then
|
||||||
KVM_ERR="(no write access)"
|
KVM_ERR="(/dev/kvm is unwriteable)"
|
||||||
else
|
else
|
||||||
flags=$(sed -ne '/^flags/s/^.*: //p' /proc/cpuinfo)
|
flags=$(sed -ne '/^flags/s/^.*: //p' /proc/cpuinfo)
|
||||||
if ! grep -qw "vmx\|svm" <<< "$flags"; then
|
if ! grep -qw "vmx\|svm" <<< "$flags"; then
|
||||||
KVM_ERR="(vmx/svm disabled)"
|
KVM_ERR="(not enabled in BIOS)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -54,8 +54,16 @@ if [[ "$KVM" != [Nn]* ]]; then
|
|||||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||||
warn "you are using macOS which has no KVM support, this will cause a major loss of performance."
|
warn "you are using macOS which has no KVM support, this will cause a major loss of performance."
|
||||||
else
|
else
|
||||||
error "KVM acceleration not available $KVM_ERR, this will cause a major loss of performance."
|
kernel=$(uname -a)
|
||||||
error "See the FAQ on how to diagnose the cause, or continue without KVM by setting KVM=N (not recommended)."
|
case "${kernel,,}" in
|
||||||
|
*"microsoft"* )
|
||||||
|
error "Please bind '/dev/kvm' as a volume in the optional container settings when using Docker Desktop." ;;
|
||||||
|
*"synology"* )
|
||||||
|
error "Please make sure that Synology VMM (Virtual Machine Manager) is installed and that '/dev/kvm' is binded to this container." ;;
|
||||||
|
*)
|
||||||
|
error "KVM acceleration is not available $KVM_ERR, this will cause a major loss of performance."
|
||||||
|
error "See the FAQ for possible causes, or continue without it by adding KVM: \"N\" (not recommended)." ;;
|
||||||
|
esac
|
||||||
[[ "$DEBUG" != [Yy1]* ]] && exit 88
|
[[ "$DEBUG" != [Yy1]* ]] && exit 88
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -17,8 +17,8 @@ echo "❯ For support visit $SUPPORT"
|
|||||||
: "${CONSOLE:="N"}" # Disable console mode
|
: "${CONSOLE:="N"}" # Disable console mode
|
||||||
: "${ALLOCATE:=""}" # Preallocate diskspace
|
: "${ALLOCATE:=""}" # Preallocate diskspace
|
||||||
: "${ARGUMENTS:=""}" # Extra QEMU parameters
|
: "${ARGUMENTS:=""}" # Extra QEMU parameters
|
||||||
: "${CPU_CORES:="1"}" # Amount of CPU cores
|
: "${CPU_CORES:="2"}" # Amount of CPU cores
|
||||||
: "${RAM_SIZE:="1G"}" # Maximum RAM amount
|
: "${RAM_SIZE:="2G"}" # Maximum RAM amount
|
||||||
: "${RAM_CHECK:="Y"}" # Check available RAM
|
: "${RAM_CHECK:="Y"}" # Check available RAM
|
||||||
: "${DISK_SIZE:="16G"}" # Initial data disk size
|
: "${DISK_SIZE:="16G"}" # Initial data disk size
|
||||||
: "${STORAGE:="/storage"}" # Storage folder location
|
: "${STORAGE:="/storage"}" # Storage folder location
|
||||||
|
@ -130,7 +130,10 @@ cpu() {
|
|||||||
cpu="${cpu// 12 Core/}"
|
cpu="${cpu// 12 Core/}"
|
||||||
cpu="${cpu// 16 Core/}"
|
cpu="${cpu// 16 Core/}"
|
||||||
cpu="${cpu// 32 Core/}"
|
cpu="${cpu// 32 Core/}"
|
||||||
|
cpu="${cpu// 48 Core/}"
|
||||||
cpu="${cpu// 64 Core/}"
|
cpu="${cpu// 64 Core/}"
|
||||||
|
cpu="${cpu// 96 Core/}"
|
||||||
|
cpu="${cpu// 128 Core/}"
|
||||||
cpu="${cpu//7th Gen /}"
|
cpu="${cpu//7th Gen /}"
|
||||||
cpu="${cpu//8th Gen /}"
|
cpu="${cpu//8th Gen /}"
|
||||||
cpu="${cpu//9th Gen /}"
|
cpu="${cpu//9th Gen /}"
|
||||||
@ -147,6 +150,7 @@ cpu() {
|
|||||||
cpu="${cpu// Core TM/ Core}"
|
cpu="${cpu// Core TM/ Core}"
|
||||||
cpu="${cpu// with Radeon Graphics/}"
|
cpu="${cpu// with Radeon Graphics/}"
|
||||||
cpu="${cpu// with Radeon Vega Graphics/}"
|
cpu="${cpu// with Radeon Vega Graphics/}"
|
||||||
|
cpu="${cpu// with Radeon Vega Mobile Gfx/}"
|
||||||
|
|
||||||
[ -z "${cpu// /}" ] && cpu="Unknown"
|
[ -z "${cpu// /}" ] && cpu="Unknown"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user