Fixes in sh

This commit is contained in:
Antonio de la Rosa 2025-04-02 15:05:01 +02:00
parent 9153ed905f
commit 8c212c647a

View file

@ -3,7 +3,7 @@
# Función para mostrar mensajes de error y salir
die () {
echo -e "${RED}Error: $1${NC}" >&2
echo "${RED}Error: $1${NC}" >&2
exit 1
}
@ -43,10 +43,10 @@ NETWORK_DHCP_RANGE="10.0.0.2-10.0.0.254"
NETWORK_DHCP_STATIC="10.0.0.1"
TRUST_PASSWORD="" # Déjalo vacío para no configurar contraseña
echo -e "${YELLOW}Inicializando Incus con la siguiente configuración:${NC}"
echo "${YELLOW}Inicializando Incus con la siguiente configuración:${NC}"
echo " - Pool de almacenamiento: $STORAGE_POOL ($STORAGE_DRIVER)"
echo " - Red: $NETWORK_NAME ($NETWORK_TYPE, $NETWORK_ADDR)"
echo -e "${YELLOW}Esto configurará Incus con valores por defecto.${NC}"
echo "${YELLOW}Esto configurará Incus con valores por defecto.${NC}"
# Confirmar antes de continuar
#read -p "¿Deseas continuar? (y/N) " -n 1 -r
@ -57,7 +57,7 @@ echo -e "${YELLOW}Esto configurará Incus con valores por defecto.${NC}"
#fi
# Ejecutar incus admin init con las configuraciones
echo -e "${YELLOW}Inicializando Incus...${NC}"
echo "${YELLOW}Inicializando Incus...${NC}"
cat <<EOF | incus admin init --minimal
config:
@ -88,8 +88,8 @@ EOF
# Verificar si la inicialización fue exitosa
if [ $? -eq 0 ]; then
echo -e "${GREEN}¡Incus se ha inicializado correctamente!${NC}"
echo -e "Puedes ver la información con: ${YELLOW}incus info${NC}"
echo "${GREEN}¡Incus se ha inicializado correctamente!${NC}"
echo "Puedes ver la información con: ${YELLOW}incus info${NC}"
else
die "Hubo un problema al inicializar Incus"
fi
@ -113,6 +113,14 @@ incus config device add ollama-container gpu gpu
# Install nvidia
run_command "incus exec ollama-container -- apt install -y software-properties-common gpg wget" "Add software properties package and other utilities"
run_command "incus exec ollama-container -- apt-add-repository -y contrib" "Add contrib"
run_command "incus exec ollama-container -- apt-add-repository -y non-free" "Add non-free"
run_command "incus exec ollama-container -- apt-add-repository -y non-free-firmware" "Add non-free-firmware"
run_command "incus exec ollama-container -- bash -c 'echo \"deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware\" > /etc/apt/sources.list.d/backports.list'" "Añadir repo backport"
run_command "incus exec ollama-container -- curl -fsSL https://pkgs.zabbly.com/key.asc | gpg --show-keys --fingerprint" "Añadir gpg incus"
@ -132,14 +140,6 @@ Signed-By: /etc/apt/keyrings/zabbly.asc \
\
EOF'" "Add incus stable repo"
run_command "incus exec ollama-container -- apt install -y software-properties-common gpg wget" "Add software properties package and other utilities"
run_command "incus exec ollama-container -- apt-add-repository -y contrib" "Add contrib"
run_command "incus exec ollama-container -- apt-add-repository -y non-free" "Add non-free"
run_command "incus exec ollama-container -- apt-add-repository -y non-free-firmware" "Add non-free-firmware"
run_command "incus exec ollama-container -- apt-get update && sudo apt-get upgrade" "Upgrade repos..."
# Install new kernel.