Browse Source

Update 'ollama1.sh'

master
alamin 3 weeks ago
parent
commit
3c10091bcb
  1. 18
      ollama1.sh

18
ollama1.sh

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2026 tteck # Copyright (c) 2021-2026 tteck
# Author: havardthom | Co-Author: MickLesk (CanbiZ) # Author: havardthom | Co-Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -9,7 +11,7 @@ APP="Ollama"
var_tags="${var_tags:-ai}" var_tags="${var_tags:-ai}"
var_cpu="${var_cpu:-2}" var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-6144}" var_ram="${var_ram:-6144}"
var_disk="${var_disk:-100}"
var_disk="${var_disk:-80}"
var_os="${var_os:-ubuntu}" var_os="${var_os:-ubuntu}"
var_version="${var_version:-24.04}" var_version="${var_version:-24.04}"
var_gpu="${var_gpu:-yes}" var_gpu="${var_gpu:-yes}"
@ -23,22 +25,29 @@ function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /usr/local/lib/ollama ]]; then if [[ ! -d /usr/local/lib/ollama ]]; then
msg_error "No Ollama Installation Found!" msg_error "No Ollama Installation Found!"
exit exit
fi fi
RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}') RELEASE=$(curl -fsSL https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk -F '"' '{print $4}')
if [[ ! -f /opt/Ollama_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/Ollama_version.txt)" ]]; then if [[ ! -f /opt/Ollama_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/Ollama_version.txt)" ]]; then
if [[ ! -f /opt/Ollama_version.txt ]]; then if [[ ! -f /opt/Ollama_version.txt ]]; then
touch /opt/Ollama_version.txt touch /opt/Ollama_version.txt
fi fi
ensure_dependencies zstd ensure_dependencies zstd
msg_info "Stopping Services" msg_info "Stopping Services"
systemctl stop ollama systemctl stop ollama
msg_ok "Services Stopped" msg_ok "Services Stopped"
TMP_TAR=$(mktemp --suffix=.tar.zst) TMP_TAR=$(mktemp --suffix=.tar.zst)
curl -fL# -C - -o "${TMP_TAR}" "https://github.com/ollama/ollama/releases/download/${RELEASE}/ollama-linux-amd64.tar.zst"
curl -fL# -C - -o "${TMP_TAR}" \
"https://file.wifibills.com/ollama-linux-amd64.tar.zst"
msg_info "Updating Ollama to ${RELEASE}" msg_info "Updating Ollama to ${RELEASE}"
rm -rf /usr/local/lib/ollama rm -rf /usr/local/lib/ollama
rm -rf /usr/local/bin/ollama rm -rf /usr/local/bin/ollama
@ -52,10 +61,13 @@ function update_script() {
msg_info "Starting Services" msg_info "Starting Services"
systemctl start ollama systemctl start ollama
msg_ok "Started Services" msg_ok "Started Services"
msg_ok "Updated successfully!" msg_ok "Updated successfully!"
else else
msg_ok "No update required. Ollama is already at ${RELEASE}"
msg_ok "No update required.
Ollama is already at ${RELEASE}"
fi fi
exit exit
} }

Loading…
Cancel
Save