Commit 3c342a05 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Remove agent

Remove agent
parents 7f7272b7 d793921b
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -34,8 +34,6 @@ RUN apt-get update && apt-get -y upgrade && \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY run/*.sh /run/
COPY agent/*.sh /agent/

COPY --from=builder /qemu-host.bin /run/host.bin

RUN chmod +x /run/*.sh && chmod +x /run/*.bin
+0 −12
Original line number Diff line number Diff line
@@ -230,18 +230,6 @@ rm -f "$MOUNT/.SynoUpgradePackages/ActiveInsight-"*
[ -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/"

# 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..."

LABEL="1.44.1-42218"
+5 −9
Original line number Diff line number Diff line
@@ -39,16 +39,11 @@ _graceful_shutdown() {

    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}")"
    pkill -f qemu-system-x86_64 || true

  fi

  fi

  while [ "$(cat ${_QEMU_SHUTDOWN_COUNTER})" -lt "${QEMU_POWERDOWN_TIMEOUT}" ]; do

    # 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

      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

run/print.sh

0 → 100644
+63 −0
Original line number Diff line number Diff line
#!/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
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ if [[ "${HOST_DEBUG}" == [Yy1]* ]]; then
  { set +x; } 2>/dev/null
  echo
else
  ./run/host.bin "${HOST_ARGS[@]}" 2> /dev/null &
  ./run/host.bin "${HOST_ARGS[@]}" >/dev/null &
fi

# Configure serial ports