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!"
|
||||
exit
|
||||
fi
|
||||
if [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||
touch /opt/${APP}_version.txt
|
||||
mkdir -p $HOME/.config/qBittorrent/
|
||||
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
|
||||
if [[ ! -f ~/.qbittorrent ]]; then
|
||||
msg_error "Please create new qBittorrent LXC. Updating from v4.x to v5.x is not supported!"
|
||||
exit
|
||||
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)
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
|
||||
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 ~/.qbittorrent ]] || [[ "${RELEASE}" != "$(cat ~/.qbittorrent 2>/dev/null)" ]]; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop qbittorrent-nox
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Updating ${APP} to v${RELEASE}"
|
||||
rm -f /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}"
|
||||
fetch_and_deploy_gh_release "qbittorrent" "userdocs/qbittorrent-nox-static" "singlefile" "latest" "/opt/qbittorrent" "x86_64-qbittorrent-nox"
|
||||
mv /opt/qbittorrent/x86_64-qbittorrent-nox /opt/qbittorrent/qbittorrent-nox
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start qbittorrent-nox
|
||||
msg_ok "Started Service"
|
||||
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
|
@ -13,14 +13,12 @@ setting_up_container
|
||||
network_check
|
||||
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"
|
||||
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)
|
||||
mkdir -p /opt/qbittorrent
|
||||
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
|
||||
mv /opt/qbittorrent/x86_64-qbittorrent-nox /opt/qbittorrent/qbittorrent-nox
|
||||
mkdir -p ~/.config/qBittorrent/
|
||||
cat <<EOF >~/.config/qBittorrent/qBittorrent.conf
|
||||
[LegalNotice]
|
||||
Accepted=true
|
||||
|
||||
@ -30,7 +28,6 @@ WebUI\Port=8090
|
||||
WebUI\UseUPnP=false
|
||||
WebUI\Username=admin
|
||||
EOF
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Setup qBittorrent-nox"
|
||||
|
||||
msg_info "Creating Service"
|
||||
|
Loading…
x
Reference in New Issue
Block a user