package update, setup non zero exit on error

This commit is contained in:
mrfry 2023-04-10 11:05:48 +02:00
parent 0d1abc7d4f
commit 2f763f3ab9
3 changed files with 86 additions and 86 deletions

View file

@ -10,19 +10,19 @@ log() { hr; echo -e "\033[0;34m${@}\033[0m"; hr; }
checkFile() {
if [ ! -f "${@}" ]; then
log "${@} does not exists, exiting"
exit
exit 1
fi
}
makeNextSubmodule() {
log "Making ${1}"
cd "submodules/${1}/" || exit
cd "submodules/${1}/" || exit 1
npm install
npm audit fix > /dev/null 2> /dev/null
checkFile "make.sh"
./make.sh || exit
./make.sh || exit 1
npx --yes next telemetry disable
cd "${baseDir}" || exit
cd "${baseDir}" || exit 1
# TODO: check if link exists
linkTarget="$PWD/nextStatic/${2}"
if [ ! -f "${linkTarget}" ]; then
@ -40,7 +40,7 @@ if [ ! -f "${domainPath}" ]; then
echo -e "\033[0;41m${domainPath} does not exist!\033[0m"
echo "Please create it, and re-run this script."
echo "Expected content: domain, ex.:'frylabs.net' (without http:// and /)"
exit
exit 1
fi
# ------------------------------------------------------------------------------------
@ -63,8 +63,8 @@ cp -r ./defaultPublicFiles/* ./publicDirs/qminingPublic/
# Git submodules
# ------------------------------------------------------------------------------------
log 'Updating / Cloning project'
git pull || exit
git submodule update --init --recursive || exit
git pull || exit 1
git submodule update --init --recursive || exit 1
# ------------------------------------------------------------------------------------
# DB-s
@ -88,19 +88,19 @@ log "Making moodle test userscript"
checkFile "$PWD/submodules/moodle-test-userscript/stable.user.js"
mkdir -pv "$PWD/publicDirs/qminingPublic/moodle-test-userscript"
ln -sfv "$PWD/submodules/moodle-test-userscript/stable.user.js" "$PWD/publicDirs/qminingPublic/moodle-test-userscript/"
cd "./submodules/moodle-test-userscript/" || exit
./make.sh || exit
cd "${baseDir}" || exit
cd "./submodules/moodle-test-userscript/" || exit 1
./make.sh || exit 1
cd "${baseDir}" || exit 1
# ------------------------------------------------------------------------------------
# DB-s
# ------------------------------------------------------------------------------------
if [ -z "$(ls -A ./data/dbs)" ]; then
log "Making DB-s"
cd src/standaloneUtils || exit
cd src/standaloneUtils || exit 1
NS_SQL_DEBUG_LOG=1 NS_LOGLEVEL=2 node dbSetup.js
mv ./*.db ../../data/dbs
cd "${baseDir}" || exit
cd "${baseDir}" || exit 1
else
log "Dbs already exist, skipping"
fi