@@ -15,17 +15,12 @@ update_os
1515
1616msg_info " Installing Dependencies"
1717$STD apt-get install -y \
18- lsb-release
19- curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /usr/share/keyrings/deb.sury.org-php.gpg
20- echo " deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $( lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
21- $STD apt-get update
22-
23- $STD apt-get install -y \
24- nginx \
25- composer \
26- php8.3-{bcmath,common,ctype,curl,fileinfo,fpm,gd,intl,mbstring,mysql,xml,cli}
18+ lsb-release \
19+ nginx
2720msg_ok " Installed Dependencies"
2821
22+ PHP_VERSION=" 8.3" PHP_MODULE=" common,ctype,fileinfo,fpm,mysql,cli" install_php
23+ install_composer
2924install_mariadb
3025
3126msg_info " Setting up Database"
@@ -43,39 +38,29 @@ $STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUS
4338} >> ~/2FAuth.creds
4439msg_ok " Set up Database"
4540
46- msg_info " Setup 2FAuth"
47- RELEASE=$( curl -fsSL https://api.github.com/repos/Bubka/2FAuth/releases/latest | grep " tag_name" | awk ' {print substr($2, 2, length($2)-3) }' )
48- curl -fsSL " https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE} .zip" -o " ${RELEASE} .zip"
49- $STD unzip " ${RELEASE} .zip"
50- mv " 2FAuth-${RELEASE// v/ } /" /opt/2fauth
41+ fetch_and_deploy_gh_release " Bubka/2FAuth"
5142
52- cd " /opt/2fauth" || return
43+ msg_info " Setup 2FAuth"
44+ cd /opt/2fauth
5345cp .env.example .env
5446IPADDRESS=$( hostname -I | awk ' {print $1}' )
55-
5647sed -i -e " s|^APP_URL=.*|APP_URL=http://$IPADDRESS |" \
5748 -e " s|^DB_CONNECTION=$|DB_CONNECTION=mysql|" \
5849 -e " s|^DB_DATABASE=$|DB_DATABASE=$DB_NAME |" \
5950 -e " s|^DB_HOST=$|DB_HOST=127.0.0.1|" \
6051 -e " s|^DB_PORT=$|DB_PORT=3306|" \
6152 -e " s|^DB_USERNAME=$|DB_USERNAME=$DB_USER |" \
6253 -e " s|^DB_PASSWORD=$|DB_PASSWORD=$DB_PASS |" .env
63-
6454export COMPOSER_ALLOW_SUPERUSER=1
6555$STD composer update --no-plugins --no-scripts
6656$STD composer install --no-dev --prefer-source --no-plugins --no-scripts
67-
6857$STD php artisan key:generate --force
69-
7058$STD php artisan migrate:refresh
7159$STD php artisan passport:install -q -n
7260$STD php artisan storage:link
7361$STD php artisan config:cache
74-
7562chown -R www-data: /opt/2fauth
7663chmod -R 755 /opt/2fauth
77-
78- echo " ${RELEASE} " > " /opt/2fauth_version.txt"
7964msg_ok " Setup 2fauth"
8065
8166msg_info " Configure Service"
@@ -107,15 +92,13 @@ server {
10792 }
10893}
10994EOF
110-
11195systemctl reload nginx
11296msg_ok " Configured Service"
11397
11498motd_ssh
11599customize
116100
117101msg_info " Cleaning up"
118- rm -f " /opt/v${RELEASE} .zip"
119102$STD apt-get -y autoremove
120103$STD apt-get -y autoclean
121104msg_ok " Cleaned"
0 commit comments