mirror of
https://github.com/stornic56/openvino-runtime-simple-installer.git
synced 2026-10-31 13:08:06 +00:00
fix: trap del --extract borraba la extraccion exitosa
Causa raiz (validacion end-to-end del usuario, paso 6 'Unexpected tarball layout'): el trap 'rm -rf $DIRNAME' EXIT se registraba antes de tar y se disparaba en TODA salida del proceso hijo, incluida la exitosa (exit 0) -> la carpeta recien extraida se borraba -> el DEPS_SCRIPT de main.sh no la encontraba -> error + exit 1. El intento del trap era limpiar extracciones parciales en abort, pero un trap EXIT no distingue exito de aborto. Fix (ataca la causa raiz): el trap se desarma en el camino de éxito (trap - EXIT tras el tar) y se conserva para limpiar extracciones parciales si el tar falla (if ! tar + error explícito + exit 1). Extra: 'Moving $DIRNAME a $INSTALL_DIR' -> 'to' (residuo de español). Verificado sin root con tarball FAKE (mismo layout): extract exitoso -> exit=0 y la carpeta SOBREVIVE al exit (DEPS_SCRIPT existe); tarball corrupto -> exit=1 y la carpeta parcial limpiada; bash -n OK.
This commit is contained in:
@@ -19,10 +19,17 @@ if [ "$1" = "--extract" ]; then
|
|||||||
|
|
||||||
# Known before tar (enables partial-extraction cleanup on abort)
|
# Known before tar (enables partial-extraction cleanup on abort)
|
||||||
DIRNAME="${FILENAME%.tgz}"
|
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
|
trap 'rm -rf "$DIRNAME"' EXIT
|
||||||
|
|
||||||
print_substep "Unzipping $FILENAME..."
|
print_substep "Unzipping $FILENAME..."
|
||||||
tar -xf "$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
|
# fallback if the extracted folder name differs from the tarball name
|
||||||
if [ ! -d "$DIRNAME" ]; then
|
if [ ! -d "$DIRNAME" ]; then
|
||||||
@@ -71,7 +78,7 @@ if [ "$1" = "--install" ]; then
|
|||||||
DIRNAME="${TAR_LIST%%$'\n'*}" # first entry (no pipe, no SIGPIPE)
|
DIRNAME="${TAR_LIST%%$'\n'*}" # first entry (no pipe, no SIGPIPE)
|
||||||
DIRNAME="${DIRNAME%%/*}"
|
DIRNAME="${DIRNAME%%/*}"
|
||||||
fi
|
fi
|
||||||
print_substep "Moving $DIRNAME a $INSTALL_DIR..."
|
print_substep "Moving $DIRNAME to $INSTALL_DIR..."
|
||||||
mv "$DIRNAME" "$INSTALL_DIR"
|
mv "$DIRNAME" "$INSTALL_DIR"
|
||||||
|
|
||||||
print_substep "Create symbolic link /opt/intel/openvino_2026..."
|
print_substep "Create symbolic link /opt/intel/openvino_2026..."
|
||||||
|
|||||||
Reference in New Issue
Block a user