mirror of
https://github.com/stornic56/openvino-runtime-simple-installer.git
synced 2026-10-31 13:08:06 +00:00
feat: flags no-interactivos --yes/--no-gpu
- Parsing antes del root check: --yes (asume 'yes' en el prompt GPU-absent), --no-gpu (fuerza GPU_PRESENT=false y salta NEO), --help/-h, opcion desconocida -> print_error + exit 1 - El prompt GPU-absent queda con 3 rutas: --no-gpu / --yes / interactivo (guard EOF H3 vigente) - Verificado: parsing sandbox (flags, desconocida, sin args, stdin cerrado sin aborts) y --help sin root (exit=0)
This commit is contained in:
@@ -24,6 +24,28 @@ case "${1:-}" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Option parsing (before the root check: parsing needs no privileges)
|
||||||
|
ASSUME_YES=false
|
||||||
|
FORCE_NO_GPU=false
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
--yes) ASSUME_YES=true ;;
|
||||||
|
--no-gpu) FORCE_NO_GPU=true ;;
|
||||||
|
--help | -h)
|
||||||
|
echo "Usage: sudo bash main.sh [--yes] [--no-gpu] [doctor]"
|
||||||
|
echo " --yes non-interactive: assume 'yes' at the GPU-absent prompt"
|
||||||
|
echo " --no-gpu skip NEO drivers without prompting"
|
||||||
|
echo " doctor post-install verification (no root required)"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
print_error "Unknown option: $1 (use --help)"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
# privileges
|
# privileges
|
||||||
if [ "$EUID" -ne 0 ]; then
|
if [ "$EUID" -ne 0 ]; then
|
||||||
echo "ERROR: This script must be run as root. Use:"
|
echo "ERROR: This script must be run as root. Use:"
|
||||||
@@ -90,6 +112,11 @@ if [ -n "$GPU_LINE" ]; then
|
|||||||
else
|
else
|
||||||
print_warning "No Intel GPU was detected."
|
print_warning "No Intel GPU was detected."
|
||||||
GPU_PRESENT=false
|
GPU_PRESENT=false
|
||||||
|
if [ "$FORCE_NO_GPU" = true ]; then
|
||||||
|
print_substep "--no-gpu set: skipping NEO driver installation."
|
||||||
|
elif [ "$ASSUME_YES" = true ]; then
|
||||||
|
print_substep "--yes set: continuing WITHOUT GPU support."
|
||||||
|
else
|
||||||
read -r -p "Do you want to continue the installation WITHOUT GPU support? [y/n]: " response || {
|
read -r -p "Do you want to continue the installation WITHOUT GPU support? [y/n]: " response || {
|
||||||
print_error "No interactive input available (stdin closed). Installation cancelled."
|
print_error "No interactive input available (stdin closed). Installation cancelled."
|
||||||
exit 1
|
exit 1
|
||||||
@@ -101,6 +128,7 @@ else
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user