updating according to PR

This commit is contained in:
David Abutbul 2022-01-29 20:17:30 +02:00 committed by GitHub
parent 7b2e478ca6
commit 65b9c570ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 11 deletions

View File

@ -1,25 +1,28 @@
#!/usr/bin/env bash
set -e
# Set some vars
prepopvols=("config" "mods" "art") # these are folders which contain runtime needed files, and need to be represented in the host
bbspath=/enigma-bbs # install location
bbsstgp=/enigma-bbs-pre # staging location for prepopvals
configname=config.hjson # this is the default name, this script is intended for easy get-go - make changes as needed
PRE_POP_VOLS=("config" "mods" "art") # these are folders which contain runtime needed files, and need to be represented in the host
BBS_ROOT=/enigma-bbs # install location
BBS_STG_P=/enigma-bbs-pre # staging location for pre populated volumes (PRE_POP_VOLS)
CONFIG_NAME=config.hjson # this is the default name, this script is intended for easy get-go - make changes as needed
# Setup happens when there is no existing config file
if [[ ! -f $bbspath/config/$configname ]]; then
for dir in "${prepopvols[@]}"
if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then
for DIR in "${PRE_POP_VOLS[@]}"
do
if [ -n "$(find "$bbspath/$dir" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then
cp -rp $bbsstgp/$dir/* $bbspath/$dir/
if [ -n "$(find "$BBS_ROOT/$DIR" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then
cp -rp $BBS_STG_P/$DIR/* $BBS_ROOT/$DIR/
else
echo "WARN skipped $bbspath/$dir - vol Not empty/not a new setup - possible bad state"
printf "WARN: skipped $BBS_ROOT/$DIR: Volume not empty or not a new setup; Files required to run ENiGMA 1/2 may be missing.\n Possible bad state\n"
printf "INFO:you have mounted folders with existing data - but no existing config json.\n\nPossible solutions:\n1. Make sure all volumes are set correctly specifically config volume... \n2. Check your configuration name if non-default\n\n\n"
fi
done
./oputil.js config new
fi
if [[ ! -f $bbspath/config/$configname ]]; then #make sure once more, otherwise pm2-runtime will loop if missing the config
echo "for some reason you have skipped configuration - enigma will not work. please run config"
if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then #make sure once more, otherwise pm2-runtime will loop if missing the config
printf "ERROR: Missing configuration - ENiGMA 1/2 will not work. please run config\n"
exit 1
else
pm2-runtime main.js