Skip to content

Commit fce7c8a

Browse files
authored
Tinyauth: Fix install issues for v4 (#8309)
* Fix Tinyauth * Update
1 parent e0ffcb4 commit fce7c8a

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

ct/alpine-tinyauth.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,19 @@ function update_script() {
2929
$STD apk -U upgrade
3030
msg_ok "Updated packages"
3131

32-
msg_info "Updating Tinyauth"
3332
RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
34-
35-
if [ "${RELEASE}" != "$(cat /opt/tinyauth_version.txt)" ] || [ ! -f /opt/tinyauth_version.txt ]; then
33+
if [ "${RELEASE}" != "$(cat ~/.tinyauth 2>/dev/null)" ] || [ ! -f ~/.tinyauth ]; then
34+
msg_info "Stopping Service"
3635
$STD service tinyauth stop
36+
msg_ok "Service Stopped"
37+
38+
msg_info "Updating Tinyauth"
3739
rm -f /opt/tinyauth/tinyauth
3840
curl -fsSL "https://github.com/steveiliop56/tinyauth/releases/download/v${RELEASE}/tinyauth-amd64" -o /opt/tinyauth/tinyauth
3941
chmod +x /opt/tinyauth/tinyauth
40-
echo "${RELEASE}" >/opt/tinyauth_version.txt
42+
echo "${RELEASE}" >~/.tinyauth
43+
msg_ok "Updated Tinyauth"
44+
4145
msg_info "Restarting Tinyauth"
4246
$STD service tinyauth start
4347
msg_ok "Restarted Tinyauth"

install/alpine-tinyauth-install.sh

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ network_check
1414
update_os
1515

1616
msg_info "Installing Dependencies"
17-
$STD apk add --no-cache curl openssl apache2-utils
17+
$STD apk add --no-cache openssl apache2-utils
1818
msg_ok "Installed Dependencies"
1919

2020
msg_info "Installing Tinyauth"
2121
mkdir -p /opt/tinyauth
22-
2322
RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
2423
curl -fsSL "https://github.com/steveiliop56/tinyauth/releases/download/v${RELEASE}/tinyauth-amd64" -o /opt/tinyauth/tinyauth
2524
chmod +x /opt/tinyauth/tinyauth
26-
2725
PASS=$(openssl rand -base64 8 | tr -dc 'a-zA-Z0-9' | head -c 8)
2826
USER=$(htpasswd -Bbn "tinyauth" "${PASS}")
2927

@@ -32,24 +30,18 @@ Tinyauth Credentials
3230
Username: tinyauth
3331
Password: ${PASS}
3432
EOF
35-
36-
echo "${RELEASE}" >/opt/tinyauth_version.txt
33+
echo "${RELEASE}" >~/.tinyauth
3734
msg_ok "Installed Tinyauth"
3835

39-
read -p "${TAB3}Enter your Tinyauth subdomain (e.g. https://tinyauth.example.com): " app_url
40-
41-
msg_info "Creating Tinyauth Service"
42-
SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | head -c 32)
36+
read -r -p "${TAB3}Enter your Tinyauth subdomain (e.g. https://tinyauth.example.com): " app_url
4337

4438
cat <<EOF >/opt/tinyauth/.env
4539
DATABASE_PATH=/opt/tinyauth/database.db
46-
SECRET=${SECRET}
47-
USERS=${USER}
40+
USERS='${USER}'
4841
APP_URL=${app_url}
4942
EOF
5043

51-
sed -i -e 's/\$/\$\$/g' /opt/tinyauth/.env
52-
44+
msg_info "Creating Service"
5345
cat <<'EOF' >/etc/init.d/tinyauth
5446
#!/sbin/openrc-run
5547
description="Tinyauth Service"
@@ -69,7 +61,6 @@ depend() {
6961
use net
7062
}
7163
EOF
72-
7364
chmod +x /etc/init.d/tinyauth
7465
$STD rc-update add tinyauth default
7566
msg_ok "Enabled Tinyauth Service"

0 commit comments

Comments
 (0)