mirror of https://github.com/tteck/Proxmox.git
				
				
				
			Update sabnzbd.sh
I added an if statement to check if the app is the latest version.
This commit is contained in:
		
							parent
							
								
									4cddfa3b12
								
							
						
					
					
						commit
						d229ed2e57
					
				| 
						 | 
					@ -55,16 +55,21 @@ function default_settings() {
 | 
				
			||||||
function update_script() {
 | 
					function update_script() {
 | 
				
			||||||
header_info
 | 
					header_info
 | 
				
			||||||
if [[ ! -d /opt/sabnzbd ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
 | 
					if [[ ! -d /opt/sabnzbd ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
 | 
				
			||||||
msg_info "Updating $APP"
 | 
					 | 
				
			||||||
systemctl stop sabnzbd.service
 | 
					 | 
				
			||||||
RELEASE=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
 | 
					RELEASE=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
 | 
				
			||||||
tar zxvf <(curl -fsSL https://github.com/sabnzbd/sabnzbd/releases/download/$RELEASE/SABnzbd-${RELEASE}-src.tar.gz) &>/dev/null
 | 
					if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
 | 
				
			||||||
\cp -r SABnzbd-${RELEASE}/* /opt/sabnzbd &>/dev/null
 | 
					   msg_info "Updating $APP to ${RELEASE}"
 | 
				
			||||||
rm -rf SABnzbd-${RELEASE}
 | 
					   systemctl stop sabnzbd.service
 | 
				
			||||||
cd /opt/sabnzbd
 | 
					   tar zxvf <(curl -fsSL https://github.com/sabnzbd/sabnzbd/releases/download/$RELEASE/SABnzbd-${RELEASE}-src.tar.gz) &>/dev/null
 | 
				
			||||||
python3 -m pip install -r requirements.txt &>/dev/null
 | 
					   \cp -r SABnzbd-${RELEASE}/* /opt/sabnzbd &>/dev/null
 | 
				
			||||||
systemctl start sabnzbd.service
 | 
					   rm -rf SABnzbd-${RELEASE}
 | 
				
			||||||
msg_ok "Updated $APP"
 | 
					   cd /opt/sabnzbd
 | 
				
			||||||
 | 
					   python3 -m pip install -r requirements.txt &>/dev/null
 | 
				
			||||||
 | 
					   echo "${RELEASE}" >/opt/${APP}_version.txt
 | 
				
			||||||
 | 
					   systemctl start sabnzbd.service
 | 
				
			||||||
 | 
					   msg_info "Updated ${APP} to ${RELEASE}"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   msg_info "No update required. ${APP} is already at ${RELEASE}"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
exit
 | 
					exit
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue