Removed build

This commit is contained in:
2022-02-06 23:22:15 +01:00
parent d7aa7f4144
commit be1ca1fb27
3 changed files with 0 additions and 121 deletions

5
build/.gitignore vendored
View File

@@ -1,5 +0,0 @@
.env
out/
backend/
frontend/
TheAdversary/

View File

@@ -1,53 +0,0 @@
#!/bin/bash
src_dir=${SRCDIR:=./TheAdversary}
out_dir=${OUTDIR:=./out}
local=false
while getopts :l opts; do
case $opts in
l) local=true;;
esac
done
pwd=$PWD
if ! $local; then
read -p "Git username: " username
read -sp "$username git password: " password
for name in backend frontend; do
path=$src_dir/$name
if [ -d "$path" ]; then
cd $path
git pull
cd $pwd
else
git clone https://$username:$password@mhsl.eu/gitea/TheAdversary/$name.git $path
fi
done
fi
if [ ! -d "$out_dir" ]; then
mkdir $out_dir
fi
# echo "INFO: Building sass files"
# for f in $(ls $src_dir/frontend/sass/*.sass); do
# sass --update $f $src_dir/frontend/sass/$(basename $f .sass).css
# done
echo "INFO: Building backend"
cd $src_dir/backend
go build . TheAdversary
cd $pwd
echo "INFO: Copying output to output directory"
for f in $src_dir/backend/{TheAdversary,database.sqlite3,.env}; do
cp -rf $f $out_dir
done
for f in $src_dir/frontend; do
cp -rf $f $out_dir/frontend/
done

View File

@@ -1,63 +0,0 @@
init() {
for dir in frontend backend out; do
if [ ! -d $dir ]; then
mkdir $dir
if [ $dir != "out" ]; then
echo Cloning $dir
git clone https://mhsl.eu/gitea/TheAdversary/$dir.git
fi
fi
done
}
build() {
pwd=$PWD
cd out/backend/
go build .
cp -rf TheAdversary database.sqlite3 ../
if [ ! -f ../../.env ]; then
cp -rf .env ../
else
cp ../../.env ../
fi
cd $pwd
}
start() {
pwd=$PWD
cd out/
./TheAdversary
cd $pwd
}
stop() {
kill $(pidof TheAdversary)
}
process() {
sleep 5
cp -rf frontend/ backend/ out/
build
echo "Restarting"
stop
start &
}
main() {
init
cp -rf frontend/ backend/ out/
build
if [ $? -eq 0 ]; then
start &
fi
while inotifywait -r -e modify frontend/ backend/; do
if [ -d /proc/$! ]; then
kill $!
fi
process &
done
}
main