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 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!"
exit
fi
@ -45,8 +45,8 @@ function update_script() {
# Creating Backup
msg_info "Creating Backup"
mv "/opt/${APP}" "/opt/${APP}-backup"
# tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" "/opt/${APP}"
mv "/opt/${NSAPP}" "/opt/${NSAPP}-backup"
# tar -czf "/opt/${NSAPP}_backup_$(date +%F).tar.gz" "/opt/${NSAPP}"
msg_ok "Backup Created"
# Execute Update
@ -54,12 +54,12 @@ function update_script() {
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
unzip -q "${RELEASE}.zip"
mv "${APPLICATION}-${RELEASE}/" "/opt/${APPLICATION}"
mv "/opt/${APP}-backup/.env" "/opt/${APP}/.env"
mv "/opt/${APP}-backup/storage" "/opt/${APP}/storage"
cd "/opt/${APP}" || return
mv "/opt/${NSAPP}-backup/.env" "/opt/${NSAPP}/.env"
mv "/opt/${NSAPP}-backup/storage" "/opt/${NSAPP}/storage"
cd "/opt/${NSAPP}" || return
chown -R www-data: "/opt/${APP}"
chmod -R 755 "/opt/${APP}"
chown -R www-data: "/opt/${NSAPP}"
chmod -R 755 "/opt/${NSAPP}"
export COMPOSER_ALLOW_SUPERUSER=1
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) }')
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${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
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_PASSWORD=$|DB_PASSWORD=$DB_PASS|" .env
chown -R www-data: "/opt/${APPLICATION}"
chmod -R 755 "/opt/${APPLICATION}"
chown -R www-data: "/opt/${NSAPP}"
chmod -R 755 "/opt/${NSAPP}"
export COMPOSER_ALLOW_SUPERUSER=1
$STD composer update --no-plugins --no-scripts
@ -77,15 +77,15 @@ $STD php artisan passport:install
$STD php artisan storage:link
$STD php artisan config:cache
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Setup ${APPLICATION}"
echo "${RELEASE}" >"/opt/${NSAPP}_version.txt"
msg_ok "Setup ${NSAPP}"
# Configure Service (NGINX)
msg_info "Configure Service"
cat <<EOF >/etc/nginx/conf.d/2fauth.conf
server {
listen 80;
root /opt/${APPLICATION}/public;
root /opt/${NSAPP}/public;
server_name $IPADDRESS;
index index.php;
charset utf-8;