mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-11-11 04:23:41 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04bd8a1639 | ||
|
|
a024294e19 |
2
.github/workflows/check.yml
vendored
2
.github/workflows/check.yml
vendored
@@ -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
|
||||||
|
|||||||
@@ -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"]
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -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 \
|
||||||
Reference in New Issue
Block a user