2019-03-11 00:35:19 -07:00
|
|
|
|
#!/usr/bin/env bash
|
2023-05-03 19:52:06 +02:00
|
|
|
|
set -Eeuo pipefail
|
2023-03-27 19:23:50 +02:00
|
|
|
|
|
2023-11-29 18:07:41 +01:00
|
|
|
|
echo "❯ Starting Virtual DSM for Docker v$(</run/version)..."
|
2023-11-15 19:58:51 +01:00
|
|
|
|
echo "❯ For support visit https://github.com/vdsm/virtual-dsm/"
|
2023-05-11 17:23:40 +02:00
|
|
|
|
|
2023-11-15 20:54:51 +01:00
|
|
|
|
cd /run
|
|
|
|
|
|
2023-11-16 21:57:43 +01:00
|
|
|
|
. reset.sh # Initialize system
|
|
|
|
|
. install.sh # Run installation
|
|
|
|
|
. disk.sh # Initialize disks
|
|
|
|
|
. network.sh # Initialize network
|
|
|
|
|
. gpu.sh # Initialize graphics
|
2023-12-16 04:38:15 +01:00
|
|
|
|
. cpu.sh # Initialize processor
|
2023-11-16 21:57:43 +01:00
|
|
|
|
. serial.sh # Initialize serialport
|
|
|
|
|
. power.sh # Configure shutdown
|
|
|
|
|
. config.sh # Configure arguments
|
2023-04-21 10:38:06 +02:00
|
|
|
|
|
2023-05-03 18:12:11 +02:00
|
|
|
|
trap - ERR
|
|
|
|
|
|
2023-12-09 21:19:08 +01:00
|
|
|
|
if [[ "$CONSOLE" == [Yy]* ]]; then
|
|
|
|
|
exec qemu-system-x86_64 -pidfile "$QEMU_PID" ${ARGS:+ $ARGS}
|
2023-11-29 20:24:28 +01:00
|
|
|
|
exit $?
|
|
|
|
|
fi
|
|
|
|
|
|
2023-12-28 03:42:06 +01:00
|
|
|
|
[[ "$DEBUG" == [Yy1]* ]] && info "$VERS" && set -x
|
2023-12-28 08:31:32 +01:00
|
|
|
|
msg=$(qemu-system-x86_64 -daemonize -pidfile "$QEMU_PID" ${ARGS:+ $ARGS})
|
2023-12-28 03:42:06 +01:00
|
|
|
|
{ set +x; } 2>/dev/null
|
2023-12-28 05:04:40 +01:00
|
|
|
|
|
2023-12-28 08:31:32 +01:00
|
|
|
|
if [[ "$msg" != "char"* || "$msg" != *"serial0)" ]]; then
|
|
|
|
|
echo "$msg"
|
2023-12-28 05:04:40 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2023-12-28 08:31:32 +01:00
|
|
|
|
dev="${msg#*/dev/p}"
|
|
|
|
|
dev="/dev/p${dev%% *}"
|
2023-12-28 05:04:40 +01:00
|
|
|
|
|
|
|
|
|
if [ ! -c "$dev" ]; then
|
2023-12-28 08:31:32 +01:00
|
|
|
|
dev=$(echo 'info chardev' | nc -q 1 -w 1 localhost "$QEMU_PORT" | tr -d '\000')
|
|
|
|
|
dev="${dev#*charserial0}"
|
|
|
|
|
dev="${dev#*pty:}"
|
|
|
|
|
dev="${dev%%$'\n'*}"
|
|
|
|
|
dev="${dev%%$'\r'*}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ ! -c "$dev" ]; then
|
|
|
|
|
error "Device `$dev` not found!"
|
2023-12-28 05:04:40 +01:00
|
|
|
|
finish 34
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
cat "$dev" 2>/dev/null & wait $! || true
|
2023-12-28 03:42:06 +01:00
|
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
|
finish 0
|