Refactor: Autobrr (#6302)

* Refactor

* Update

* Update autobrr.sh
This commit is contained in:
Slaviša Arežina 2025-07-29 08:30:32 +02:00 committed by GitHub
parent 5a889d8fc6
commit 34da66600d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 23 deletions

View File

@ -27,22 +27,24 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
msg_info "Stopping ${APP} LXC"
systemctl stop autobrr.service
msg_ok "Stopped ${APP} LXC"
msg_info "Updating ${APP} LXC" RELEASE=$(curl -fsSL https://api.github.com/repos/autobrr/autobrr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
rm -rf /usr/local/bin/* if [[ "${RELEASE}" != "$(cat ~/.autobrr 2>/dev/null)" ]] || [[ ! -f ~/.autobrr ]]; then
curl -fsSL "$(curl -fsSL https://api.github.com/repos/autobrr/autobrr/releases/latest | grep download | grep linux_x86_64 | cut -d\" -f4)" -o $(basename "$(curl -fsSL https://api.github.com/repos/autobrr/autobrr/releases/latest | grep download | grep linux_x86_64 | cut -d\" -f4)") msg_info "Stopping ${APP} LXC"
tar -C /usr/local/bin -xzf autobrr*.tar.gz systemctl stop autobrr
rm -rf autobrr*.tar.gz msg_ok "Stopped ${APP} LXC"
msg_ok "Updated ${APP} LXC"
msg_info "Starting ${APP} LXC" fetch_and_deploy_gh_release "autobrr" "autobrr/autobrr" "prebuild" "latest" "/usr/local/bin" "autobrr_*_linux_x86_64.tar.gz"
systemctl start autobrr.service
msg_ok "Started ${APP} LXC" msg_info "Starting ${APP} LXC"
msg_ok "Updated Successfully" systemctl start autobrr
exit msg_ok "Started ${APP} LXC"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
} }
start start

View File

@ -13,10 +13,9 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Autobrr" fetch_and_deploy_gh_release "autobrr" "autobrr/autobrr" "prebuild" "latest" "/usr/local/bin" "autobrr_*_linux_x86_64.tar.gz"
curl -fsSL "$(curl -fsSL https://api.github.com/repos/autobrr/autobrr/releases/latest | grep download | grep linux_x86_64 | cut -d\" -f4)" -o $(basename "$(curl -fsSL https://api.github.com/repos/autobrr/autobrr/releases/latest | grep download | grep linux_x86_64 | cut -d\" -f4)")
tar -C /usr/local/bin -xzf autobrr*.tar.gz msg_info "Configuring Autobrr"
rm -rf autobrr*.tar.gz
mkdir -p /root/.config/autobrr mkdir -p /root/.config/autobrr
cat <<EOF >>/root/.config/autobrr/config.toml cat <<EOF >>/root/.config/autobrr/config.toml
# https://autobrr.com/configuration/autobrr # https://autobrr.com/configuration/autobrr
@ -25,21 +24,24 @@ port = 7474
logLevel = "DEBUG" logLevel = "DEBUG"
sessionSecret = "$(openssl rand -base64 24)" sessionSecret = "$(openssl rand -base64 24)"
EOF EOF
msg_ok "Installed Autobrr" msg_ok "Configured Autobrr"
msg_info "Creating Service" msg_info "Creating Service"
service_path="/etc/systemd/system/autobrr.service" cat <<EOF >/etc/systemd/system/autobrr.service
echo "[Unit] [Unit]
Description=autobrr service Description=autobrr service
After=syslog.target network-online.target After=syslog.target network-online.target
[Service] [Service]
Type=simple Type=simple
User=root User=root
Group=root Group=root
ExecStart=/usr/local/bin/autobrr --config=/root/.config/autobrr/ ExecStart=/usr/local/bin/autobrr --config=/root/.config/autobrr/
[Install] [Install]
WantedBy=multi-user.target" >$service_path WantedBy=multi-user.target
systemctl enable --now -q autobrr.service EOF
systemctl enable --now -q autobrr
msg_ok "Created Service" msg_ok "Created Service"
motd_ssh motd_ssh