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