Unverified Commit 9185d655 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Error messages

Error messages
parents c91c96d3 5414d655
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -34,12 +34,12 @@ rm -rf "$TMP" && mkdir -p "$TMP"
LOC="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat"

{ curl -r 64493568-69886247 -sfk -o "$RD" "$LOC"; rc=$?; } || :
(( rc != 0 )) && echo "Failed to download extractor, reason: $rc" && exit 60
(( rc != 0 )) && echo "ERROR: Failed to download extractor, reason: $rc" && exit 60

SUM=$(md5sum "$RD" | cut -f 1 -d " ")

if [ "$SUM" != "14fb88cb7cabddb5af1d0269bf032845" ]; then
  echo "Invalid extractor, checksum mismatch." && exit 61
  echo "ERROR: Invalid extractor, checksum mismatch." && exit 61
fi

set +e
@@ -69,14 +69,16 @@ else
  PROGRESS="--progress=dot:giga"
fi

wget "$URL" -O "$PAT" -q --no-check-certificate --show-progress "$PROGRESS"
if ! wget "$URL" -O "$PAT" -q --no-check-certificate --show-progress "$PROGRESS"; then
  echo "ERROR: Failed to download $URL" && exit 69
fi

[ ! -f "$PAT" ] && echo "Download failed" && exit 61
[ ! -f "$PAT" ] && echo "ERROR: Failed to download $URL" && exit 69

SIZE=$(stat -c%s "$PAT")

if ((SIZE<250000000)); then
  echo "Invalid PAT file: File is an update pack which contains no OS image." && exit 62
  echo "ERROR: Invalid PAT file: File is an update pack which contains no OS image." && exit 62
fi

echo "Install: Extracting downloaded image..."
@@ -86,7 +88,7 @@ if { tar tf "$PAT"; } >/dev/null 2>&1; then
else
   export LD_LIBRARY_PATH="/run/extract"
   if ! /run/extract/syno_extract_system_patch "$PAT" "$TMP/." ; then
     echo "Invalid PAT file: File is an update pack which contains no OS image." && exit 63
     echo "ERROR: Invalid PAT file: File is an update pack which contains no OS image." && exit 63
   fi
   export LD_LIBRARY_PATH=""
fi
@@ -96,14 +98,14 @@ IDB="$TMP/indexdb"
PKG="$TMP/packages"
HDP="$TMP/synohdpack_img"

[ ! -f "$HDA.tgz" ] && echo "Invalid PAT file: contains no OS image." && exit 64
[ ! -f "$HDP.txz" ] && echo "Invalid PAT file: contains no HD pack." && exit 65
[ ! -f "$IDB.txz" ] && echo "Invalid PAT file: contains no IndexDB." && exit 66
[ ! -d "$PKG" ] && echo "Invalid PAT file: contains no packages." && exit 68
[ ! -f "$HDA.tgz" ] && echo "ERROR: Invalid PAT file: contains no OS image." && exit 64
[ ! -f "$HDP.txz" ] && echo "ERROR: Invalid PAT file: contains no HD pack." && exit 65
[ ! -f "$IDB.txz" ] && echo "ERROR: Invalid PAT file: contains no IndexDB." && exit 66
[ ! -d "$PKG" ] && echo "ERROR: Invalid PAT file: contains no packages." && exit 68

BOOT=$(find "$TMP" -name "*.bin.zip")

[ ! -f "$BOOT" ] && echo "Invalid PAT file: contains no boot file." && exit 67
[ ! -f "$BOOT" ] && echo "ERROR: Invalid PAT file: contains no boot file." && exit 67

BOOT=$(echo "$BOOT" | head -c -5)
unzip -q -o "$BOOT".zip -d "$TMP"
+1 −1
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ if [ ! -c /dev/net/tun ]; then
  chmod 666 /dev/net/tun
fi

[ ! -c /dev/net/tun ] && echo "Error: TUN network interface not available..." && exit 85
[ ! -c /dev/net/tun ] && echo "ERROR: TUN network interface not available..." && exit 85

update-alternatives --set iptables /usr/sbin/iptables-legacy > /dev/null
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy > /dev/null
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ _graceful_shutdown() {
  if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then

    echo
    echo "Could not send shutdown command to guest, error: $RESPONSE"
    echo "ERROR: Could not send shutdown command to the guest ($RESPONSE)"

    # If we cannot shutdown the usual way, fallback to the NMI method