aboutsummaryrefslogtreecommitdiffstats
path: root/service/do.sh
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-05-29 14:24:31 +0200
committerLouis Burda <quent.burda@gmail.com>2021-05-29 14:24:31 +0200
commit13b65f01132c41be9ab8d9f92c2c5ca605c366d8 (patch)
tree74bd5b4dee779e4600d416adf4abcd4f621addab /service/do.sh
parent62d99253144a14648c4da1c2a60c01e7b06ef02c (diff)
downloadenowars5-service-stldoctor-13b65f01132c41be9ab8d9f92c2c5ca605c366d8.tar.gz
enowars5-service-stldoctor-13b65f01132c41be9ab8d9f92c2c5ca605c366d8.zip
changed repo structure and commited releease files such that default docker-compose worklow commands work in testvm
Diffstat (limited to 'service/do.sh')
-rw-r--r--service/do.sh90
1 files changed, 0 insertions, 90 deletions
diff --git a/service/do.sh b/service/do.sh
deleted file mode 100644
index d0ac5ed..0000000
--- a/service/do.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/sh
-
-SCRIPTPATH="$(dirname $(readlink -f "$0"))"
-cd "$SCRIPTPATH"
-
-makefile="
-all: .cleansrc
-
-.cleansrc: src/*
- bash do.sh cleansrc src container/src
- touch .cleansrc
-"
-
-shopt -s expand_aliases
-alias pushd="pushd &>/dev/null"
-alias popd="popd &>/dev/null"
-
-if [ "$1" == "compose" ]; then
- # ensure container files are up to date
- make --file <(echo "$makefile")
-
- # forward commands to compose
- pushd container
- docker-compose ${@:2}
- popd
-elif [ "$1" == "cleansrc" ]; then
- if [ $# -lt 3 ]; then
- echo "USAGE: do.sh cleansrc <SRC> <DST>"
- exit 0
- fi
-
- # copy files
- src="$2"
- dst="$3"
- [ -e "$dst" ] && rm -rf "$dst"
- mkdir -p "$dst"
- cp -r "$src"/{*.c,*.h,Makefile,msgs} "$dst"
-
- # strip comments
- find "$dst" | while read path; do
- if [ -f "$path" ]; then
- if [ ! -z $(echo "$path" | grep '.[hc]$') ]; then
- sed -i -e 's/^\s*\/\*.*\*\/\s*$//g' "$path" # remove /* */ style comments
- sed -i -e 's/\s*\/\*.*\*\/\s*/ /g' "$path" # remove /* */ style comments
- sed -i -e 's/\/\/.*//g' "$path" # remove // style comments
- sed -i -e ':a;N;$!ba;s/\n\{3,\}/\n\n/g' "$path" # collapse multiple newlines
- sed -i -e 's/fprintf(\s*stderr\s*,\s*/printf(/g' "$path" # replace fprintf stderr
- elif [ "$(basename "$path")" == "Makefile" ]; then
- sed -i -e 's/\s*#.*//g' "$path" # remove # style comments
- sed -i -e ':a;N;$!ba;s/\n\{3,\}/\n\n/g' "$path" # collapse multiple newlines
- fi
- fi
- done
-elif [ "$1" == "test" ]; then
- SRCDIR="$PWD/src" DATADIR="$PWD/container/data" bash "tests/test.sh" ${@:2}
-elif [ "$1" == "make" ]; then
- # build a normal version
- pushd src
- if [ -e ".safebuild" ]; then
- make clean
- rm ".safebuild"
- fi
- make
- popd
-elif [ "$1" == "make-safe" ]; then
- # build a 'safe' version with flagstore patches
-
- pushd src
- make clean
- touch ".safebuild"
-
- for f in $(ls | grep '\.[ch]$'); do
- cp "$f" "safe_$f"
- done
-
- git apply patches/flagstore1.diff
- git apply patches/flagstore2.diff
-
- PREFIX="safe_" make
-
- rm safe_*
- popd
-else
- echo "USAGE: do.sh (compose) [args..]"
- echo "EXAMPLES:"
- echo " do.sh compose up --build # starts the docker container"
- echo " do.sh cleansrc <src> <dst> # post-process source files for release"
- echo " do.sh make-safe # create patched version of binary"
- echo " do.sh test <cmd> # run a test on the binary"
-fi