Compare commits

...
2 Commits
Author SHA1 Message Date
Kroese 04bd8a1639 feat: Check host connection 2023-11-15 21:52:03 +01:00
Kroese a024294e19 fix: Folder structure (#379)
* Moved to src

* Moved to src

* Moved to src

* Moved to src

* Moved to src

* Moved to src

* Moved to src

* Moved to src

* Moved to src

* Moved to src

* Moved to src

* Moved to src

* fix: Check entrypoint

* Moved to src

* Moved to src

* fix: Relative paths

* fix: Relative paths

* fix: Shellcheck

* fix: Relative paths

* Test shellcheck

* Test shellcheck
2023-11-15 20:54:51 +01:00
14 changed files with 34 additions and 16 deletions

No files matched your search

+1 -1
View File
@@ -11,4 +11,4 @@ jobs:
- name: Run ShellCheck - name: Run ShellCheck
uses: ludeeus/action-shellcheck@master uses: ludeeus/action-shellcheck@master
env: env:
SHELLCHECK_OPTS: -x -e SC2001 -e SC2002 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2028 -e SC2153 -e SC2004 SHELLCHECK_OPTS: -x --source-path=src -e SC2001 -e SC2002 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2028 -e SC2153 -e SC2004
+2 -3
View File
@@ -33,9 +33,8 @@ RUN apt-get update && apt-get -y upgrade && \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY run/*.sh /run/ COPY src/*.sh /run/
COPY --from=builder /qemu-host.bin /run/host.bin COPY --from=builder /qemu-host.bin /run/host.bin
RUN chmod +x /run/*.sh && chmod +x /run/*.bin RUN chmod +x /run/*.sh && chmod +x /run/*.bin
VOLUME /storage VOLUME /storage
@@ -66,4 +65,4 @@ LABEL org.opencontainers.image.description="Virtual DSM in a docker container"
HEALTHCHECK --interval=60s --retries=2 CMD /run/check.sh HEALTHCHECK --interval=60s --retries=2 CMD /run/check.sh
ENTRYPOINT ["/usr/bin/tini", "-s", "/run/run.sh"] ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"]
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
+10 -8
View File
@@ -4,14 +4,16 @@ set -Eeuo pipefail
echo "❯ Starting Virtual DSM for Docker v${VERSION}..." echo "❯ Starting Virtual DSM for Docker v${VERSION}..."
echo "❯ For support visit https://github.com/vdsm/virtual-dsm/" echo "❯ For support visit https://github.com/vdsm/virtual-dsm/"
. /run/reset.sh # Initialize system cd /run
. /run/install.sh # Run installation
. /run/disk.sh # Initialize disks . reset.sh # Initialize system
. /run/network.sh # Initialize network . install.sh # Run installation
. /run/gpu.sh # Initialize graphics . disk.sh # Initialize disks
. /run/serial.sh # Initialize serialport . network.sh # Initialize network
. /run/power.sh # Configure shutdown . gpu.sh # Initialize graphics
. /run/config.sh # Configure arguments . serial.sh # Initialize serialport
. power.sh # Configure shutdown
. config.sh # Configure arguments
trap - ERR trap - ERR
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
+1 -1
View File
@@ -5,7 +5,7 @@ info () { echo -e "\E[1;34m❯ \E[1;36m$1\E[0m" ; }
error () { echo -e >&2 "\E[1;31m❯ ERROR: $1\E[0m" ; } error () { echo -e >&2 "\E[1;31m❯ ERROR: $1\E[0m" ; }
trap 'error "Status $? while: ${BASH_COMMAND} (line $LINENO/$BASH_LINENO)"' ERR trap 'error "Status $? while: ${BASH_COMMAND} (line $LINENO/$BASH_LINENO)"' ERR
[ ! -f "/run/run.sh" ] && error "Script must run inside Docker container!" && exit 11 [ ! -f "/run/entry.sh" ] && error "Script must run inside Docker container!" && exit 11
[ "$(id -u)" -ne "0" ] && error "Script must be executed with root privileges." && exit 12 [ "$(id -u)" -ne "0" ] && error "Script must be executed with root privileges." && exit 12
# Docker environment variables # Docker environment variables
+20 -3
View File
@@ -35,17 +35,34 @@ HOST_ARGS+=("-cpu_arch=${HOST_CPU}")
if [[ "${HOST_DEBUG}" == [Yy1]* ]]; then if [[ "${HOST_DEBUG}" == [Yy1]* ]]; then
set -x set -x
./run/host.bin "${HOST_ARGS[@]}" & ./host.bin "${HOST_ARGS[@]}" &
{ set +x; } 2>/dev/null { set +x; } 2>/dev/null
echo echo
else else
./run/host.bin "${HOST_ARGS[@]}" >/dev/null & ./host.bin "${HOST_ARGS[@]}" >/dev/null &
fi fi
cnt=0
sleep 0.2
while ! nc -z -w1 127.0.0.1 2210 > /dev/null 2>&1; do
sleep 0.1
cnt=$((cnt + 1))
(( cnt > 20 )) && error "Failed to connect to qemu-host.." && exit 58
done
cnt=0
while ! nc -z -w1 127.0.0.1 12345 > /dev/null 2>&1; do
sleep 0.1
cnt=$((cnt + 1))
(( cnt > 20 )) && error "Failed to connect to qemu-host.." && exit 59
done
# Configure serial ports # Configure serial ports
SERIAL_OPTS="\ SERIAL_OPTS="\
-serial mon:stdio \ -serial mon:stdio \
-device virtio-serial-pci,id=virtio-serial0,bus=pcie.0,addr=0x3 \ -device virtio-serial-pci,id=virtio-serial0,bus=pcie.0,addr=0x3 \
-chardev pty,id=charserial0 \ -chardev pty,id=charserial0 \
-device isa-serial,chardev=charserial0,id=serial0 \ -device isa-serial,chardev=charserial0,id=serial0 \
View File
File renamed without changes.