Fixes in sh

This commit is contained in:
Antonio de la Rosa 2025-04-02 14:49:48 +02:00
parent 75bebd9fd6
commit 4ab6c4d19c

View file

@ -12,9 +12,8 @@ run_command() {
local cmd="$1" local cmd="$1"
local description="$2" local description="$2"
echo -e "${YELLOW}Ejecutando: ${description}...${NC}" echo "${YELLOW}Ejecutando: ${description}...${NC}"
echo -e "Comando: ${cmd}\n" >> "${LOG_FILE}" echo "Comando: ${cmd}\n" >> "${LOG_FILE}"
echo "${cmd}"
eval "${cmd} < /dev/null" >> "${LOG_FILE}" 2>&1 eval "${cmd} < /dev/null" >> "${LOG_FILE}" 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -122,55 +121,55 @@ run_command "incus exec ollama-container -- mkdir -p /etc/apt/keyrings/" "Aña
run_command "incus exec ollama-container -- curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc" "Añadir gpg zabbly en /et/apt/keyrings" run_command "incus exec ollama-container -- curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc" "Añadir gpg zabbly en /et/apt/keyrings"
incus exec ollama-container -- sh -c 'cat <<EOF > /etc/apt/sources.list.d/zabbly-incus-stable.sources run_command "incus exec ollama-container -- sh -c 'cat <<EOF > /etc/apt/sources.list.d/zabbly-incus-stable.sources \
Enabled: yes Enabled: yes \
Types: deb Types: deb \
URIs: https://pkgs.zabbly.com/incus/stable URIs: https://pkgs.zabbly.com/incus/stable \
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME}) Suites: $(. /etc/os-release && echo ${VERSION_CODENAME}) \
Components: main Components: main \
Architectures: $(dpkg --print-architecture) Architectures: $(dpkg --print-architecture) \
Signed-By: /etc/apt/keyrings/zabbly.asc Signed-By: /etc/apt/keyrings/zabbly.asc \
\
EOF'" "Add incus stable repo"
EOF' run_command "incus exec ollama-container -- apt install -y software-properties-common" "Add software properties package"
incus exec ollama-container -- apt install -y software-properties-common run_command "incus exec ollama-container -- apt-add-repository -y contrib" "Add contrib"
incus exec ollama-container -- apt-add-repository -y contrib run_command "incus exec ollama-container -- apt-add-repository -y non-free" "Add non-free"
incus exec ollama-container -- apt-add-repository -y non-free run_command "incus exec ollama-container -- apt-add-repository -y non-free-firmware" "Add non-free-firmware"
incus exec ollama-container -- apt-add-repository -y non-free-firmware run_command "incus exec ollama-container -- apt-get update && sudo apt-get upgrade" "Upgrade repos..."
incus exec ollama-container -- apt-get update && sudo apt-get upgrade
# Install new kernel. # Install new kernel.
incus exec ollama-container -- apt-get -y install linux-image-6.11.10+bpo-amd64 linux-headers-6.11.10+bpo-amd64 run_command "incus exec ollama-container -- apt-get -y install linux-image-6.11.10+bpo-amd64 linux-headers-6.11.10+bpo-amd64" "Add ollama container"
# Install cuda nvidia drivers # Install cuda nvidia drivers
echo "Install nvidia drivers in container" echo "Install nvidia drivers in container"
incus exec ollama-container -- apt -y purge "*nvidia*" run_command "incus exec ollama-container -- apt -y purge \"*nvidia*\"" "Delete nvidia"
incus exec ollama-container -- wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb run_command "incus exec ollama-container -- wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb" ""
incus exec ollama-container -- dpkg -i cuda-keyring_1.1-1_all.deb run_command "incus exec ollama-container -- dpkg -i cuda-keyring_1.1-1_all.deb" ""
incus exec ollama-container -- apt-get -y -f install run_command "incus exec ollama-container -- apt-get -y -f install" ""
incus exec ollama-container -- apt update run_command "incus exec ollama-container -- apt update" ""
incus exec ollama-container -- bash -c 'echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/ /" \ run_command "incus exec ollama-container -- bash -c 'echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/ /" \
| tee /etc/apt/sources.list.d/cuda-debian12-x86_64.list' | tee /etc/apt/sources.list.d/cuda-debian12-x86_64.list'" ""
incus exec ollama-container -- apt -y update run_command "incus exec ollama-container -- apt -y update" ""
incus exec ollama-container -- apt -y install cuda-drivers run_command "incus exec ollama-container -- apt -y install cuda-drivers" ""
echo "Install Ollama in container ollama-container" echo "Install Ollama in container ollama-container" ""
incus exec ollama-container -- apt -y install curl run_command "incus exec ollama-container -- apt -y install curl" ""
incus exec ollama-container -- curl -fsSL https://ollama.com/install.sh | sh run_command "incus exec ollama-container -- curl -fsSL https://ollama.com/install.sh | sh" ""
incus exec ollama-container -- ollama run gemma3:4b run_command "incus exec ollama-container -- ollama run gemma3:4b" ""
echo "Done!!!" echo "Done!!!"