From 600c731f454ea9b590d5bafd29246c01f0a9f7bb Mon Sep 17 00:00:00 2001 From: Janek <6506725+jkrgr0@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:05:04 +0000 Subject: [PATCH] fix(install): :bug: Fixed installation --- ct/2fauth.sh | 18 +++++++++--------- install/2fauth-install.sh | 13 +++++-------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/ct/2fauth.sh b/ct/2fauth.sh index b58c2170..997dcd3c 100644 --- a/ct/2fauth.sh +++ b/ct/2fauth.sh @@ -30,7 +30,7 @@ function update_script() { check_container_resources # 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!" exit fi @@ -45,21 +45,21 @@ function update_script() { # Creating Backup msg_info "Creating Backup" - mv "/opt/${NSAPP}" "/opt/${NSAPP}-backup" - # tar -czf "/opt/${NSAPP}_backup_$(date +%F).tar.gz" "/opt/${NSAPP}" + mv "/opt/2fauth" "/opt/2fauth-backup" + # tar -czf "/opt/2fauth_backup_$(date +%F).tar.gz" "/opt/2fauth" msg_ok "Backup Created" # Execute Update msg_info "Updating $APP to v${RELEASE}" wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip" unzip -q "${RELEASE}.zip" - mv "${APPLICATION}-${RELEASE}/" "/opt/${APPLICATION}" - mv "/opt/${NSAPP}-backup/.env" "/opt/${NSAPP}/.env" - mv "/opt/${NSAPP}-backup/storage" "/opt/${NSAPP}/storage" - cd "/opt/${NSAPP}" || return + mv "${APPLICATION}-${RELEASE//v}/" "/opt/${APPLICATION}" + mv "/opt/2fauth-backup/.env" "/opt/2fauth/.env" + mv "/opt/2fauth-backup/storage" "/opt/2fauth/storage" + cd "/opt/2fauth" || return - chown -R www-data: "/opt/${NSAPP}" - chmod -R 755 "/opt/${NSAPP}" + chown -R www-data: "/opt/2fauth" + chmod -R 755 "/opt/2fauth" export COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --prefer-source &>/dev/null diff --git a/install/2fauth-install.sh b/install/2fauth-install.sh index 66330f1b..c54ae87e 100644 --- a/install/2fauth-install.sh +++ b/install/2fauth-install.sh @@ -14,9 +14,6 @@ setting_up_container network_check update_os -# Custom variables -APP_PATH=/opt/2fauth - # Installing Dependencies with the 3 core dependencies (curl;sudo;mc) msg_info "Installing Dependencies" $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) }') wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${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 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_PASSWORD=$|DB_PASSWORD=$DB_PASS|" .env -chown -R www-data: $APP_PATH -chmod -R 755 $APP_PATH +chown -R www-data: /opt/2fauth +chmod -R 755 /opt/2fauth export COMPOSER_ALLOW_SUPERUSER=1 $STD composer update --no-plugins --no-scripts @@ -86,7 +83,7 @@ msg_info "Configure Service" cat </etc/nginx/conf.d/2fauth.conf server { listen 80; - root $APP_PATH/public; + root /opt/2fauth/public; server_name $IPADDRESS; index index.php; charset utf-8;