parent
e0ffcb4160
commit
fce7c8a100
@ -29,15 +29,19 @@ function update_script() {
|
||||
$STD apk -U upgrade
|
||||
msg_ok "Updated packages"
|
||||
|
||||
msg_info "Updating Tinyauth"
|
||||
RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
|
||||
if [ "${RELEASE}" != "$(cat /opt/tinyauth_version.txt)" ] || [ ! -f /opt/tinyauth_version.txt ]; then
|
||||
if [ "${RELEASE}" != "$(cat ~/.tinyauth 2>/dev/null)" ] || [ ! -f ~/.tinyauth ]; then
|
||||
msg_info "Stopping Service"
|
||||
$STD service tinyauth stop
|
||||
msg_ok "Service Stopped"
|
||||
|
||||
msg_info "Updating Tinyauth"
|
||||
rm -f /opt/tinyauth/tinyauth
|
||||
curl -fsSL "https://github.com/steveiliop56/tinyauth/releases/download/v${RELEASE}/tinyauth-amd64" -o /opt/tinyauth/tinyauth
|
||||
chmod +x /opt/tinyauth/tinyauth
|
||||
echo "${RELEASE}" >/opt/tinyauth_version.txt
|
||||
echo "${RELEASE}" >~/.tinyauth
|
||||
msg_ok "Updated Tinyauth"
|
||||
|
||||
msg_info "Restarting Tinyauth"
|
||||
$STD service tinyauth start
|
||||
msg_ok "Restarted Tinyauth"
|
||||
|
||||
@ -14,16 +14,14 @@ network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apk add --no-cache curl openssl apache2-utils
|
||||
$STD apk add --no-cache openssl apache2-utils
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Tinyauth"
|
||||
mkdir -p /opt/tinyauth
|
||||
|
||||
RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
curl -fsSL "https://github.com/steveiliop56/tinyauth/releases/download/v${RELEASE}/tinyauth-amd64" -o /opt/tinyauth/tinyauth
|
||||
chmod +x /opt/tinyauth/tinyauth
|
||||
|
||||
PASS=$(openssl rand -base64 8 | tr -dc 'a-zA-Z0-9' | head -c 8)
|
||||
USER=$(htpasswd -Bbn "tinyauth" "${PASS}")
|
||||
|
||||
@ -32,24 +30,18 @@ Tinyauth Credentials
|
||||
Username: tinyauth
|
||||
Password: ${PASS}
|
||||
EOF
|
||||
|
||||
echo "${RELEASE}" >/opt/tinyauth_version.txt
|
||||
echo "${RELEASE}" >~/.tinyauth
|
||||
msg_ok "Installed Tinyauth"
|
||||
|
||||
read -p "${TAB3}Enter your Tinyauth subdomain (e.g. https://tinyauth.example.com): " app_url
|
||||
|
||||
msg_info "Creating Tinyauth Service"
|
||||
SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | head -c 32)
|
||||
read -r -p "${TAB3}Enter your Tinyauth subdomain (e.g. https://tinyauth.example.com): " app_url
|
||||
|
||||
cat <<EOF >/opt/tinyauth/.env
|
||||
DATABASE_PATH=/opt/tinyauth/database.db
|
||||
SECRET=${SECRET}
|
||||
USERS=${USER}
|
||||
USERS='${USER}'
|
||||
APP_URL=${app_url}
|
||||
EOF
|
||||
|
||||
sed -i -e 's/\$/\$\$/g' /opt/tinyauth/.env
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<'EOF' >/etc/init.d/tinyauth
|
||||
#!/sbin/openrc-run
|
||||
description="Tinyauth Service"
|
||||
@ -69,7 +61,6 @@ depend() {
|
||||
use net
|
||||
}
|
||||
EOF
|
||||
|
||||
chmod +x /etc/init.d/tinyauth
|
||||
$STD rc-update add tinyauth default
|
||||
msg_ok "Enabled Tinyauth Service"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user