mirror of
https://github.com/stornic56/openvino-runtime-simple-installer.git
synced 2026-10-31 13:08:06 +00:00
fix
An issue with the verification and extraction of the .tgz file was resolved.
This commit is contained in:
+36
-9
@@ -6,10 +6,40 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/common.sh"
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
print_error "Usage: $0 <URL> <OUTPUT_FILE> | $0 --install <FILE>"
|
||||
print_error "Usage: $0 <URL> <OUTPUT_FILE> | $0 --extract <FILE> | $0 --install <FILE>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "--extract" ]; then
|
||||
FILENAME="$2"
|
||||
if [ ! -f "$FILENAME" ]; then
|
||||
print_error " $FILENAME could not be found to extract."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Known before tar (enables partial-extraction cleanup on abort)
|
||||
DIRNAME="${FILENAME%.tgz}"
|
||||
# Cleanup ONLY on abort: the trap is set before tar and DISARMED on success —
|
||||
# otherwise the EXIT trap deletes the just-extracted folder on 'exit 0' and
|
||||
# the deps step (and the later --install) find nothing.
|
||||
trap 'rm -rf "$DIRNAME"' EXIT
|
||||
|
||||
print_substep "Unzipping $FILENAME..."
|
||||
if ! tar -xf "$FILENAME"; then
|
||||
print_error "Extraction of $FILENAME failed."
|
||||
exit 1 # trap fires: partial extraction is cleaned up
|
||||
fi
|
||||
trap - EXIT # success: keep the extracted folder for the deps and install steps
|
||||
|
||||
# fallback if the extracted folder name differs from the tarball name
|
||||
if [ ! -d "$DIRNAME" ]; then
|
||||
TAR_LIST=$(tar -tf "$FILENAME")
|
||||
DIRNAME="${TAR_LIST%%$'\n'*}" # first entry (no pipe, no SIGPIPE)
|
||||
DIRNAME="${DIRNAME%%/*}"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "--install" ]; then
|
||||
FILENAME="$2"
|
||||
if [ ! -f "$FILENAME" ]; then
|
||||
@@ -30,9 +60,9 @@ if [ "$1" = "--install" ]; then
|
||||
INSTALL_DIR="/opt/intel/openvino_$(echo "$VERSION_FULL" | cut -d. -f1-3)"
|
||||
|
||||
# Replace policy (updates): remove ANY previous 2026 install and the previous symlink.
|
||||
# Known limitation: the previous install is deleted BEFORE extracting; if the tar
|
||||
# failed afterwards, the system would be left without OpenVINO. Acceptable because
|
||||
# the SHA256 was already verified during the download step.
|
||||
# Known limitation: the previous install is deleted BEFORE moving the new one; if the
|
||||
# mv failed afterwards, the system would be left without OpenVINO. Acceptable because
|
||||
# the extraction and its SHA256 verification already succeeded in the --extract step.
|
||||
if ls -d /opt/intel/openvino_2026.* >/dev/null 2>&1; then
|
||||
print_warning "An existing OpenVINO installation was found. Replacing it..."
|
||||
fi
|
||||
@@ -40,10 +70,7 @@ if [ "$1" = "--install" ]; then
|
||||
rm -rf /opt/intel/openvino_2026.* # ANY previous 2026 install
|
||||
mkdir -p /opt/intel
|
||||
|
||||
DIRNAME="${FILENAME%.tgz}" # known before tar (enables trap cleanup)
|
||||
trap 'rm -rf "$DIRNAME"' EXIT
|
||||
print_substep "Unzipping $FILENAME..."
|
||||
tar -xf "$FILENAME"
|
||||
DIRNAME="${FILENAME%.tgz}"
|
||||
|
||||
if [ ! -d "$DIRNAME" ]; then
|
||||
# guess the real name
|
||||
@@ -51,7 +78,7 @@ if [ "$1" = "--install" ]; then
|
||||
DIRNAME="${TAR_LIST%%$'\n'*}" # first entry (no pipe, no SIGPIPE)
|
||||
DIRNAME="${DIRNAME%%/*}"
|
||||
fi
|
||||
print_substep "Moving $DIRNAME a $INSTALL_DIR..."
|
||||
print_substep "Moving $DIRNAME to $INSTALL_DIR..."
|
||||
mv "$DIRNAME" "$INSTALL_DIR"
|
||||
|
||||
print_substep "Create symbolic link /opt/intel/openvino_2026..."
|
||||
|
||||
Reference in New Issue
Block a user