mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
Remove agent
Remove agent
This commit is contained in:
commit
3c342a05aa
@ -34,8 +34,6 @@ RUN apt-get update && apt-get -y upgrade && \
|
|||||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
COPY run/*.sh /run/
|
COPY run/*.sh /run/
|
||||||
COPY agent/*.sh /agent/
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -230,18 +230,6 @@ rm -f "$MOUNT/.SynoUpgradePackages/ActiveInsight-"*
|
|||||||
[ -f "$HDP.txz" ] && tar xpfJ "$HDP.txz" --absolute-names -C "$MOUNT/"
|
[ -f "$HDP.txz" ] && tar xpfJ "$HDP.txz" --absolute-names -C "$MOUNT/"
|
||||||
[ -f "$IDB.txz" ] && tar xpfJ "$IDB.txz" --absolute-names -C "$MOUNT/usr/syno/synoman/indexdb/"
|
[ -f "$IDB.txz" ] && tar xpfJ "$IDB.txz" --absolute-names -C "$MOUNT/usr/syno/synoman/indexdb/"
|
||||||
|
|
||||||
# Install Agent
|
|
||||||
|
|
||||||
LOC="$MOUNT/usr/local/bin"
|
|
||||||
mkdir -p "$LOC"
|
|
||||||
cp /agent/agent.sh "$LOC/agent.sh"
|
|
||||||
chmod 755 "$LOC/agent.sh"
|
|
||||||
|
|
||||||
LOC="$MOUNT/usr/local/etc/rc.d"
|
|
||||||
mkdir -p "$LOC"
|
|
||||||
cp /agent/service.sh "$LOC/agent.sh"
|
|
||||||
chmod 755 "$LOC/agent.sh"
|
|
||||||
|
|
||||||
info "Install: Installing system partition..."
|
info "Install: Installing system partition..."
|
||||||
|
|
||||||
LABEL="1.44.1-42218"
|
LABEL="1.44.1-42218"
|
||||||
|
10
run/power.sh
10
run/power.sh
@ -39,16 +39,11 @@ _graceful_shutdown() {
|
|||||||
|
|
||||||
echo && error "Could not send shutdown command to the guest ($RESPONSE)"
|
echo && error "Could not send shutdown command to the guest ($RESPONSE)"
|
||||||
|
|
||||||
# Send a NMI interrupt which will be detected by the agent script
|
|
||||||
if ! echo 'nmi' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null ; then
|
|
||||||
|
|
||||||
kill -15 "$(cat "${_QEMU_PID}")"
|
kill -15 "$(cat "${_QEMU_PID}")"
|
||||||
pkill -f qemu-system-x86_64 || true
|
pkill -f qemu-system-x86_64 || true
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
while [ "$(cat ${_QEMU_SHUTDOWN_COUNTER})" -lt "${QEMU_POWERDOWN_TIMEOUT}" ]; do
|
while [ "$(cat ${_QEMU_SHUTDOWN_COUNTER})" -lt "${QEMU_POWERDOWN_TIMEOUT}" ]; do
|
||||||
|
|
||||||
# Increase the counter
|
# Increase the counter
|
||||||
@ -58,8 +53,9 @@ _graceful_shutdown() {
|
|||||||
if echo 'info version'| nc -q 1 -w 1 localhost "${QEMU_MONPORT}" >/dev/null 2>&1 ; then
|
if echo 'info version'| nc -q 1 -w 1 localhost "${QEMU_MONPORT}" >/dev/null 2>&1 ; then
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
CNT="$(cat ${_QEMU_SHUTDOWN_COUNTER})/${QEMU_POWERDOWN_TIMEOUT}"
|
|
||||||
[[ "${DEBUG}" == [Yy1]* ]] && info "Shutting down, waiting... (${CNT})"
|
#CNT="$(cat ${_QEMU_SHUTDOWN_COUNTER})/${QEMU_POWERDOWN_TIMEOUT}"
|
||||||
|
#[[ "${DEBUG}" == [Yy1]* ]] && info "Shutting down, waiting... (${CNT})"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
63
run/print.sh
Normal file
63
run/print.sh
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
info () { echo -e >&2 "\E[1;34m❯\E[1;36m $1\E[0m" ; }
|
||||||
|
error () { echo -e >&2 "\E[1;31m❯ ERROR: $1\E[0m" ; }
|
||||||
|
|
||||||
|
retry=true
|
||||||
|
|
||||||
|
while [ "$retry" = true ]
|
||||||
|
do
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Retrieve IP from guest VM
|
||||||
|
|
||||||
|
set +e
|
||||||
|
RESPONSE=$(curl -s -m 16 -S http://127.0.0.1:2210/read?command=10 2>&1)
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then
|
||||||
|
error "Failed to connect to guest: $RESPONSE" && continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Retrieve the HTTP port number
|
||||||
|
if [[ ! "${RESPONSE}" =~ "\"http_port\"" ]] ; then
|
||||||
|
error "Failed to parse response from guest: $RESPONSE" && continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
rest=${RESPONSE#*http_port}
|
||||||
|
rest=${rest#*:}
|
||||||
|
rest=${rest%%,*}
|
||||||
|
PORT=${rest%%\"*}
|
||||||
|
|
||||||
|
[ -z "${PORT}" ] && continue
|
||||||
|
|
||||||
|
# Retrieve the IP address
|
||||||
|
if [[ ! "${RESPONSE}" =~ "eth0" ]] ; then
|
||||||
|
error "Failed to parse response from guest: $RESPONSE" && continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
rest=${RESPONSE#*eth0}
|
||||||
|
rest=${rest#*ip}
|
||||||
|
rest=${rest#*:}
|
||||||
|
rest=${rest#*\"}
|
||||||
|
IP=${rest%%\"*}
|
||||||
|
|
||||||
|
[ -z "${IP}" ] && continue
|
||||||
|
|
||||||
|
retry=false
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "$IP" == "20.20"* ]]; then
|
||||||
|
MSG="port ${PORT}"
|
||||||
|
else
|
||||||
|
MSG="http://${IP}:${PORT}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "" >&2
|
||||||
|
info "--------------------------------------------------------"
|
||||||
|
info " You can now login to DSM at ${MSG}"
|
||||||
|
info "--------------------------------------------------------"
|
||||||
|
echo "" >&2
|
@ -45,7 +45,7 @@ if [[ "${HOST_DEBUG}" == [Yy1]* ]]; then
|
|||||||
{ set +x; } 2>/dev/null
|
{ set +x; } 2>/dev/null
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
./run/host.bin "${HOST_ARGS[@]}" 2> /dev/null &
|
./run/host.bin "${HOST_ARGS[@]}" >/dev/null &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure serial ports
|
# Configure serial ports
|
||||||
|
Loading…
x
Reference in New Issue
Block a user