mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-08 08:49:17 +00:00
fix(install): 🐛 Fixed installation
This commit is contained in:
parent
dd84fa3638
commit
600c731f45
18
ct/2fauth.sh
18
ct/2fauth.sh
@ -30,7 +30,7 @@ function update_script() {
|
|||||||
check_container_resources
|
check_container_resources
|
||||||
|
|
||||||
# Check if installation is present | -f for file, -d for folder
|
# Check if installation is present | -f for file, -d for folder
|
||||||
if [[ ! -d "/opt/${NSAPP}" ]]; then
|
if [[ ! -d "/opt/2fauth" ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@ -45,21 +45,21 @@ function update_script() {
|
|||||||
|
|
||||||
# Creating Backup
|
# Creating Backup
|
||||||
msg_info "Creating Backup"
|
msg_info "Creating Backup"
|
||||||
mv "/opt/${NSAPP}" "/opt/${NSAPP}-backup"
|
mv "/opt/2fauth" "/opt/2fauth-backup"
|
||||||
# tar -czf "/opt/${NSAPP}_backup_$(date +%F).tar.gz" "/opt/${NSAPP}"
|
# tar -czf "/opt/2fauth_backup_$(date +%F).tar.gz" "/opt/2fauth"
|
||||||
msg_ok "Backup Created"
|
msg_ok "Backup Created"
|
||||||
|
|
||||||
# Execute Update
|
# Execute Update
|
||||||
msg_info "Updating $APP to v${RELEASE}"
|
msg_info "Updating $APP to v${RELEASE}"
|
||||||
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
|
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
|
||||||
unzip -q "${RELEASE}.zip"
|
unzip -q "${RELEASE}.zip"
|
||||||
mv "${APPLICATION}-${RELEASE}/" "/opt/${APPLICATION}"
|
mv "${APPLICATION}-${RELEASE//v}/" "/opt/${APPLICATION}"
|
||||||
mv "/opt/${NSAPP}-backup/.env" "/opt/${NSAPP}/.env"
|
mv "/opt/2fauth-backup/.env" "/opt/2fauth/.env"
|
||||||
mv "/opt/${NSAPP}-backup/storage" "/opt/${NSAPP}/storage"
|
mv "/opt/2fauth-backup/storage" "/opt/2fauth/storage"
|
||||||
cd "/opt/${NSAPP}" || return
|
cd "/opt/2fauth" || return
|
||||||
|
|
||||||
chown -R www-data: "/opt/${NSAPP}"
|
chown -R www-data: "/opt/2fauth"
|
||||||
chmod -R 755 "/opt/${NSAPP}"
|
chmod -R 755 "/opt/2fauth"
|
||||||
|
|
||||||
export COMPOSER_ALLOW_SUPERUSER=1
|
export COMPOSER_ALLOW_SUPERUSER=1
|
||||||
composer install --no-dev --prefer-source &>/dev/null
|
composer install --no-dev --prefer-source &>/dev/null
|
||||||
|
@ -14,9 +14,6 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
# Custom variables
|
|
||||||
APP_PATH=/opt/2fauth
|
|
||||||
|
|
||||||
# Installing Dependencies with the 3 core dependencies (curl;sudo;mc)
|
# Installing Dependencies with the 3 core dependencies (curl;sudo;mc)
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y \
|
$STD apt-get install -y \
|
||||||
@ -50,9 +47,9 @@ msg_info "Setup ${APPLICATION}"
|
|||||||
RELEASE=$(curl -s https://api.github.com/repos/Bubka/2FAuth/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -s https://api.github.com/repos/Bubka/2FAuth/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
|
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
|
||||||
unzip -q "${RELEASE}.zip"
|
unzip -q "${RELEASE}.zip"
|
||||||
mv "${APPLICATION}-${RELEASE//v}/" $APP_PATH
|
mv "${APPLICATION}-${RELEASE//v}/" /opt/2fauth
|
||||||
|
|
||||||
cd "$APP_PATH" || return
|
cd "/opt/2fauth" || return
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
IPADDRESS=$(hostname -I | awk '{print $1}')
|
IPADDRESS=$(hostname -I | awk '{print $1}')
|
||||||
|
|
||||||
@ -64,8 +61,8 @@ sed -i -e "s|^APP_URL=.*|APP_URL=http://$IPADDRESS|" \
|
|||||||
-e "s|^DB_USERNAME=$|DB_USERNAME=$DB_USER|" \
|
-e "s|^DB_USERNAME=$|DB_USERNAME=$DB_USER|" \
|
||||||
-e "s|^DB_PASSWORD=$|DB_PASSWORD=$DB_PASS|" .env
|
-e "s|^DB_PASSWORD=$|DB_PASSWORD=$DB_PASS|" .env
|
||||||
|
|
||||||
chown -R www-data: $APP_PATH
|
chown -R www-data: /opt/2fauth
|
||||||
chmod -R 755 $APP_PATH
|
chmod -R 755 /opt/2fauth
|
||||||
|
|
||||||
export COMPOSER_ALLOW_SUPERUSER=1
|
export COMPOSER_ALLOW_SUPERUSER=1
|
||||||
$STD composer update --no-plugins --no-scripts
|
$STD composer update --no-plugins --no-scripts
|
||||||
@ -86,7 +83,7 @@ msg_info "Configure Service"
|
|||||||
cat <<EOF >/etc/nginx/conf.d/2fauth.conf
|
cat <<EOF >/etc/nginx/conf.d/2fauth.conf
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
root $APP_PATH/public;
|
root /opt/2fauth/public;
|
||||||
server_name $IPADDRESS;
|
server_name $IPADDRESS;
|
||||||
index index.php;
|
index index.php;
|
||||||
charset utf-8;
|
charset utf-8;
|
||||||
|
Loading…
Reference in New Issue
Block a user