Update omada.sh

fixes https://github.com/tteck/Proxmox/issues/2349
This commit is contained in:
tteckster 2024-01-16 05:53:10 -05:00 committed by GitHub
parent 0c543874c0
commit 693367e278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 15 deletions

View File

@ -56,26 +56,17 @@ function update_script() {
header_info header_info
if [[ ! -d /opt/tplink ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/tplink ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
latest_url=$(curl -fsSL "https://www.tp-link.com/us/support/download/omada-software-controller/" | grep -o 'https://.*x64.deb' | head -n1) latest_url=$(curl -fsSL "https://www.tp-link.com/us/support/download/omada-software-controller/" | grep -o 'https://.*x64.deb' | head -n1)
latest_version=$(basename "${latest_url}" | sed -e 's/.*ller_//;s/_Li.*//') latest_version=$(basename "${latest_url}")
if [ -z "${latest_version}" ]; then if [ -z "${latest_version}" ]; then
msg_error "It seems that the server (tp-link.com) might be down. Please try again at a later time." msg_error "It seems that the server (tp-link.com) might be down. Please try again at a later time."
exit exit
fi fi
installed_version=$(dpkg -l | grep omada | awk '{print $3}') echo -e "Updating Omada Controller"
if [ "v${installed_version}" = "${latest_version}" ]; then
msg_info "Installed version (v${installed_version}) is the same as the latest version (${latest_version})"
sleep 2
msg_ok "Omada Controller is already up to date"
exit
else
echo -e "Updating Omada Controller to ${latest_version}"
wget -qL ${latest_url} wget -qL ${latest_url}
dpkg -i Omada_SDN_Controller_${latest_version}_Linux_x64.deb dpkg -i ${latest_version}
rm -rf Omada_SDN_Controller_${latest_version}_Linux_x64.deb rm -rf ${latest_version}
echo -e "Updated Omada Controller to ${latest_version}" echo -e "Updated Omada Controller"
exit exit
fi
} }
start start