Refactor: qBittorrent (#7089)
This commit is contained in:
parent
4773649706
commit
50feb0d846
@ -27,32 +27,24 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
if [[ ! -f /opt/${APP}_version.txt ]]; then
|
if [[ ! -f ~/.qbittorrent ]]; then
|
||||||
touch /opt/${APP}_version.txt
|
msg_error "Please create new qBittorrent LXC. Updating from v4.x to v5.x is not supported!"
|
||||||
mkdir -p $HOME/.config/qBittorrent/
|
exit
|
||||||
mkdir -p /opt/qbittorrent/
|
|
||||||
[ -d "/.config/qBittorrent" ] && mv /.config/qBittorrent "$HOME/.config/"
|
|
||||||
$STD apt-get remove --purge -y qbittorrent-nox
|
|
||||||
sed -i 's@ExecStart=/usr/bin/qbittorrent-nox@ExecStart=/opt/qbittorrent/qbittorrent-nox@g' /etc/systemd/system/qbittorrent-nox.service
|
|
||||||
systemctl daemon-reload
|
|
||||||
fi
|
fi
|
||||||
FULLRELEASE=$(curl -fsSL https://api.github.com/repos/userdocs/qbittorrent-nox-static/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
|
||||||
RELEASE=$(echo $FULLRELEASE | cut -c 9-13)
|
RELEASE=$(curl -fsSL https://api.github.com/repos/userdocs/qbittorrent-nox-static/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
if [[ ! -f ~/.qbittorrent ]] || [[ "${RELEASE}" != "$(cat ~/.qbittorrent 2>/dev/null)" ]]; then
|
||||||
msg_info "Stopping Service"
|
msg_info "Stopping Service"
|
||||||
systemctl stop qbittorrent-nox
|
systemctl stop qbittorrent-nox
|
||||||
msg_ok "Stopped Service"
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
msg_info "Updating ${APP} to v${RELEASE}"
|
fetch_and_deploy_gh_release "qbittorrent" "userdocs/qbittorrent-nox-static" "singlefile" "latest" "/opt/qbittorrent" "x86_64-qbittorrent-nox"
|
||||||
rm -f /opt/qbittorrent/qbittorrent-nox
|
mv /opt/qbittorrent/x86_64-qbittorrent-nox /opt/qbittorrent/qbittorrent-nox
|
||||||
curl -fsSL "https://github.com/userdocs/qbittorrent-nox-static/releases/download/${FULLRELEASE}/x86_64-qbittorrent-nox" -o /opt/qbittorrent/qbittorrent-nox
|
|
||||||
chmod +x /opt/qbittorrent/qbittorrent-nox
|
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
msg_ok "Updated $APP to v${RELEASE}"
|
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
systemctl start qbittorrent-nox
|
systemctl start qbittorrent-nox
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
|
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
@ -13,14 +13,12 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
|
fetch_and_deploy_gh_release "qbittorrent" "userdocs/qbittorrent-nox-static" "singlefile" "latest" "/opt/qbittorrent" "x86_64-qbittorrent-nox"
|
||||||
|
|
||||||
msg_info "Setup qBittorrent-nox"
|
msg_info "Setup qBittorrent-nox"
|
||||||
FULLRELEASE=$(curl -fsSL https://api.github.com/repos/userdocs/qbittorrent-nox-static/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
mv /opt/qbittorrent/x86_64-qbittorrent-nox /opt/qbittorrent/qbittorrent-nox
|
||||||
RELEASE=$(echo $FULLRELEASE | cut -c 9-13)
|
mkdir -p ~/.config/qBittorrent/
|
||||||
mkdir -p /opt/qbittorrent
|
cat <<EOF >~/.config/qBittorrent/qBittorrent.conf
|
||||||
curl -fsSL "https://github.com/userdocs/qbittorrent-nox-static/releases/download/${FULLRELEASE}/x86_64-qbittorrent-nox" -o /opt/qbittorrent/qbittorrent-nox
|
|
||||||
chmod +x /opt/qbittorrent/qbittorrent-nox
|
|
||||||
mkdir -p $HOME/.config/qBittorrent/
|
|
||||||
cat <<EOF >$HOME/.config/qBittorrent/qBittorrent.conf
|
|
||||||
[LegalNotice]
|
[LegalNotice]
|
||||||
Accepted=true
|
Accepted=true
|
||||||
|
|
||||||
@ -30,7 +28,6 @@ WebUI\Port=8090
|
|||||||
WebUI\UseUPnP=false
|
WebUI\UseUPnP=false
|
||||||
WebUI\Username=admin
|
WebUI\Username=admin
|
||||||
EOF
|
EOF
|
||||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
|
||||||
msg_ok "Setup qBittorrent-nox"
|
msg_ok "Setup qBittorrent-nox"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user