Skip to content

Commit af88ff3

Browse files
authored
Refactor (#6379)
1 parent 2c618f5 commit af88ff3

3 files changed

Lines changed: 26 additions & 23 deletions

File tree

ct/lidarr.sh

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,24 @@ function update_script() {
2929
exit
3030
fi
3131

32-
msg_info "Updating $APP LXC"
33-
temp_file="$(mktemp)"
34-
rm -rf /opt/Lidarr
35-
RELEASE=$(curl -fsSL https://api.github.com/repos/Lidarr/Lidarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
36-
curl -fsSL "https://github.com/Lidarr/Lidarr/releases/download/v${RELEASE}/Lidarr.master.${RELEASE}.linux-core-x64.tar.gz" -o "$temp_file"
37-
$STD tar -xvzf "$temp_file"
38-
mv Lidarr /opt
39-
chmod 775 /opt/Lidarr
40-
msg_ok "Updated $APP LXC"
41-
42-
msg_info "Cleaning up"
43-
rm -rf "$temp_file"
44-
msg_ok "Cleaned up"
32+
RELEASE=$(curl -fsSL https://api.github.com/repos/Lidarr/Lidarr/releases/latest | jq -r '.tag_name' | sed 's/^v//')
33+
if [[ "${RELEASE}" != "$(cat ~/.lidarr)" ]] || [[ ! -f ~/.lidarr ]]; then
34+
35+
msg_info "Stopping service"
36+
systemctl stop lidarr
37+
msg_ok "Service stopped"
38+
39+
fetch_and_deploy_gh_release "lidarr" "Lidarr/Lidarr" "prebuild" "latest" "/opt/Lidarr" "Lidarr.master*linux-core-x64.tar.gz"
40+
chmod 775 /opt/Lidarr
41+
42+
msg_info "Starting service"
43+
systemctl start lidarr
44+
msg_ok "Service started"
45+
46+
msg_ok "Updated successfully"
47+
else
48+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
49+
fi
4550
exit
4651
}
4752

frontend/public/json/lidarr.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"updateable": true,
1010
"privileged": false,
1111
"interface_port": 8686,
12-
"documentation": null,
12+
"documentation": "https://wiki.servarr.com/en/lidarr",
1313
"website": "https://lidarr.audio/",
1414
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/lidarr.webp",
15-
"config_path": "",
15+
"config_path": "/var/lib/lidarr/config.xml",
1616
"description": "Lidarr is a music management tool designed for Usenet and BitTorrent users. It allows users to manage and organize their music collection with ease. Lidarr integrates with popular Usenet and BitTorrent clients, such as Sonarr and Radarr, to automate the downloading and organizing of music files. The software provides a web-based interface for managing and organizing music, making it easy to search and find songs, albums, and artists. Lidarr also supports metadata management, including album art, artist information, and lyrics, making it easy for users to keep their music collection organized and up-to-date. The software is designed to be easy to use and provides a simple and intuitive interface for managing and organizing music collections, making it a valuable tool for music lovers who want to keep their collection organized and up-to-date. With Lidarr, users can enjoy their music collection from anywhere, making it a powerful tool for managing and sharing music files.",
1717
"install_methods": [
1818
{

install/lidarr-install.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,28 @@ $STD apt-get install -y \
2020
mediainfo
2121
msg_ok "Installed Dependencies"
2222

23-
msg_info "Installing Lidarr"
24-
temp_file="$(mktemp)"
23+
fetch_and_deploy_gh_release "lidarr" "Lidarr/Lidarr" "prebuild" "latest" "/opt/Lidarr" "Lidarr.master*linux-core-x64.tar.gz"
24+
25+
msg_info "Configuring Lidarr"
2526
mkdir -p /var/lib/lidarr/
2627
chmod 775 /var/lib/lidarr/
27-
RELEASE=$(curl -fsSL https://api.github.com/repos/Lidarr/Lidarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
28-
curl -fsSL "https://github.com/Lidarr/Lidarr/releases/download/v${RELEASE}/Lidarr.master.${RELEASE}.linux-core-x64.tar.gz" -o "$temp_file"
29-
$STD tar -xvzf "$temp_file"
30-
mv Lidarr /opt
3128
chmod 775 /opt/Lidarr
32-
msg_ok "Installed Lidarr"
29+
msg_ok "Configured Lidarr"
3330

3431
msg_info "Creating Service"
3532
cat <<EOF >/etc/systemd/system/lidarr.service
3633
[Unit]
3734
Description=Lidarr Daemon
3835
After=syslog.target network.target
36+
3937
[Service]
4038
UMask=0002
4139
Type=simple
4240
ExecStart=/opt/Lidarr/Lidarr -nobrowser -data=/var/lib/lidarr/
4341
TimeoutStopSec=20
4442
KillMode=process
4543
Restart=on-failure
44+
4645
[Install]
4746
WantedBy=multi-user.target
4847
EOF
@@ -53,7 +52,6 @@ motd_ssh
5352
customize
5453

5554
msg_info "Cleaning up"
56-
rm -rf "$temp_file"
5755
$STD apt-get -y autoremove
5856
$STD apt-get -y autoclean
5957
msg_ok "Cleaned"

0 commit comments

Comments
 (0)