Skip to content

Commit 66a5730

Browse files
authored
Refactor (#5722)
1 parent 1cefb1b commit 66a5730

File tree

2 files changed

+25
-30
lines changed

2 files changed

+25
-30
lines changed

ct/authelia.sh

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,30 @@ color
2222
catch_errors
2323

2424
function update_script() {
25-
header_info
26-
check_container_storage
27-
check_container_resources
28-
if [[ ! -d "/etc/authelia/" ]]; then
29-
msg_error "No ${APP} Installation Found!"
30-
exit
31-
fi
32-
RELEASE=$(curl -fsSL https://api.github.com/repos/authelia/authelia/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
33-
if [[ "${RELEASE}" != "$(/usr/bin/authelia -v | awk '{print substr($3, 2, length($2)) }')" ]]; then
34-
msg_info "Updating $APP to ${RELEASE}"
35-
$STD apt-get update
36-
$STD apt-get -y upgrade
37-
curl -fsSL "https://github.com/authelia/authelia/releases/download/${RELEASE}/authelia_${RELEASE}_amd64.deb" -o $(basename "https://github.com/authelia/authelia/releases/download/${RELEASE}/authelia_${RELEASE}_amd64.deb")
38-
$STD dpkg -i "authelia_${RELEASE}_amd64.deb"
39-
msg_info "Cleaning Up"
40-
rm -f "authelia_${RELEASE}_amd64.deb"
41-
$STD apt-get -y autoremove
42-
$STD apt-get -y autoclean
43-
msg_ok "Cleanup Completed"
44-
msg_ok "Updated $APP to ${RELEASE}"
45-
else
46-
msg_ok "No update required. ${APP} is already at ${RELEASE}"
47-
fi
25+
header_info
26+
check_container_storage
27+
check_container_resources
28+
if [[ ! -d "/etc/authelia/" ]]; then
29+
msg_error "No ${APP} Installation Found!"
4830
exit
31+
fi
32+
RELEASE=$(curl -fsSL https://api.github.com/repos/authelia/authelia/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
33+
if [[ "${RELEASE}" != "$(/usr/bin/authelia -v | awk '{print substr($3, 2, length($2)) }')" ]]; then
34+
$STD apt-get update
35+
$STD apt-get -y upgrade
36+
37+
fetch_and_deploy_gh_release "authelia" "authelia/authelia" "binary"
38+
39+
msg_info "Cleaning Up"
40+
$STD apt-get -y autoremove
41+
$STD apt-get -y autoclean
42+
msg_ok "Cleanup Completed"
43+
44+
msg_ok "Updated $APP to ${RELEASE}"
45+
else
46+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
47+
fi
48+
exit
4949
}
5050

5151
start

install/authelia-install.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ setting_up_container
1313
network_check
1414
update_os
1515

16-
msg_info "Installing Authelia"
17-
RELEASE=$(curl -fsSL https://api.github.com/repos/authelia/authelia/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
18-
curl -fsSL "https://github.com/authelia/authelia/releases/download/${RELEASE}/authelia_${RELEASE}_amd64.deb" -o "authelia_${RELEASE}_amd64.deb"
19-
$STD dpkg -i "authelia_${RELEASE}_amd64.deb"
20-
msg_ok "Install Authelia completed"
16+
fetch_and_deploy_gh_release "authelia" "authelia/authelia" "binary"
2117

22-
read -p "${TAB3}Enter your domain (ex. example.com): " DOMAIN
18+
read -rp "${TAB3}Enter your domain (ex. example.com): " DOMAIN
2319

2420
msg_info "Setting Authelia up"
2521
touch /etc/authelia/emails.txt
@@ -72,7 +68,6 @@ motd_ssh
7268
customize
7369

7470
msg_info "Cleaning up"
75-
rm -f "authelia_${RELEASE}_amd64.deb"
7671
$STD apt-get -y autoremove
7772
$STD apt-get -y autoclean
7873
msg_ok "Cleaned"

0 commit comments

Comments
 (0)