fix(2fauth): 🐛 Use instead of for the directory name

This commit is contained in:
Janek 2024-12-20 12:23:03 +00:00
parent b373486084
commit 80258a7262
2 changed files with 15 additions and 15 deletions

View File

@ -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/${APP}" ]]; then if [[ ! -d "/opt/${NSAPP}" ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
@ -45,8 +45,8 @@ function update_script() {
# Creating Backup # Creating Backup
msg_info "Creating Backup" msg_info "Creating Backup"
mv "/opt/${APP}" "/opt/${APP}-backup" mv "/opt/${NSAPP}" "/opt/${NSAPP}-backup"
# tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" "/opt/${APP}" # tar -czf "/opt/${NSAPP}_backup_$(date +%F).tar.gz" "/opt/${NSAPP}"
msg_ok "Backup Created" msg_ok "Backup Created"
# Execute Update # Execute Update
@ -54,12 +54,12 @@ function update_script() {
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}/" "/opt/${APPLICATION}"
mv "/opt/${APP}-backup/.env" "/opt/${APP}/.env" mv "/opt/${NSAPP}-backup/.env" "/opt/${NSAPP}/.env"
mv "/opt/${APP}-backup/storage" "/opt/${APP}/storage" mv "/opt/${NSAPP}-backup/storage" "/opt/${NSAPP}/storage"
cd "/opt/${APP}" || return cd "/opt/${NSAPP}" || return
chown -R www-data: "/opt/${APP}" chown -R www-data: "/opt/${NSAPP}"
chmod -R 755 "/opt/${APP}" chmod -R 755 "/opt/${NSAPP}"
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

View File

@ -49,9 +49,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}/" "/opt/${APPLICATION}" mv "${APPLICATION}-${RELEASE}/" "/opt/${NSAPP}"
cd "/opt/${APP}" || return cd "/opt/${NSAPP}" || return
cp .env.example .env cp .env.example .env
IPADDRESS=$(hostname -I | awk '{print $1}') IPADDRESS=$(hostname -I | awk '{print $1}')
@ -63,8 +63,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: "/opt/${APPLICATION}" chown -R www-data: "/opt/${NSAPP}"
chmod -R 755 "/opt/${APPLICATION}" chmod -R 755 "/opt/${NSAPP}"
export COMPOSER_ALLOW_SUPERUSER=1 export COMPOSER_ALLOW_SUPERUSER=1
$STD composer update --no-plugins --no-scripts $STD composer update --no-plugins --no-scripts
@ -77,15 +77,15 @@ $STD php artisan passport:install
$STD php artisan storage:link $STD php artisan storage:link
$STD php artisan config:cache $STD php artisan config:cache
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" echo "${RELEASE}" >"/opt/${NSAPP}_version.txt"
msg_ok "Setup ${APPLICATION}" msg_ok "Setup ${NSAPP}"
# Configure Service (NGINX) # Configure Service (NGINX)
msg_info "Configure Service" 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 /opt/${APPLICATION}/public; root /opt/${NSAPP}/public;
server_name $IPADDRESS; server_name $IPADDRESS;
index index.php; index index.php;
charset utf-8; charset utf-8;