diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cef4239 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.so +/types \ No newline at end of file diff --git a/install-default-types.sh b/install-default-types.sh new file mode 100644 index 0000000..8916713 --- /dev/null +++ b/install-default-types.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# (1) Get default path # +DEFAULT_PATH="`realpath $GOPATH`/src/git.xdrm.io/gfw/checker/default"; +# fail if do not exist +test -d $DEFAULT_PATH || (echo "$DEFAULT_PATH does not exists.. aborting"; exit 1) || exit 1; + +# (2) List go files # +GO_FILES="`ls $DEFAULT_PATH/**/*.go`" + +# (3) Create target directory # +mkdir -p ./types; + +# (4) Build each file # +d=1 +for Type in $GO_FILES; do + plugin_name="`basename $(dirname $Type)`" + echo -e "($d) Building \e[33m$plugin_name\e[0m"; + go build -buildmode=plugin -o "./types/$plugin_name.so" $Type; + + # Manage failure + if [ "$?" -ne "0" ]; then + echo -e "\e[31m/!\\ \e[0merror building \e[33m$plugin_name\e[0m\n" + fi + + d=""`expr $d + 1`"" +done; + +# (5) ACK # +echo -e "\n[ \e[32mfinished\e[0m ]\n" +echo -e "files are located inside the relative \e[33m./types\e[0m directory" \ No newline at end of file