From 9da00bebf0982a37eaa7157df487fe72732fe94b Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Thu, 30 Aug 2018 08:19:35 -0600 Subject: [PATCH] scripts/setup: remove 'ed' based setup scripts Removes: - setup-app-layer.sh - setup-app-layer-logger.sh These have been replaced by setup-app-layer.py. --- scripts/setup-app-layer-logger.sh | 186 -------------------------- scripts/setup-app-layer.sh | 210 ------------------------------ 2 files changed, 396 deletions(-) delete mode 100755 scripts/setup-app-layer-logger.sh delete mode 100755 scripts/setup-app-layer.sh diff --git a/scripts/setup-app-layer-logger.sh b/scripts/setup-app-layer-logger.sh deleted file mode 100755 index fb1070238e..0000000000 --- a/scripts/setup-app-layer-logger.sh +++ /dev/null @@ -1,186 +0,0 @@ -#! /usr/bin/env bash - -set -e - -# Fail if "ed" is not available. -if ! which ed > /dev/null 2>&1; then - echo "error: the program \"ed\" is required for this script" - exit 1 -fi - -function usage() { - cat < - -This script will provision a new JSON application layer transaction -logger for the protocol name specified on the command line. This is -done by copying and patching src/output-json-template.h and -src/output-json-template.c then link the new files into the build -system. - -It is required that the application layer parser has already been -provisioned by the setup-app-layer.sh script. - -Examples: - - $0 DNP3 - $0 Gopher - -EOF -} - -# Make sure we are running from the correct directory. -set_dir() { - if [ -e ./suricata.c ]; then - cd .. - elif [ -e ./src/suricata.c ]; then - # Do nothing. - true - else - echo "error: this does not appear to be a suricata source directory." - exit 1 - fi -} - -fail_if_exists() { - path="$1" - if test -e "${path}"; then - echo "error: ${path} already exists." - exit 1 - fi -} - -function copy_template_file() { - src="$1" - dst="$2" - - echo "Creating ${dst}." - - sed -e '/TEMPLATE_START_REMOVE/,/TEMPLATE_END_REMOVE/d' \ - -e "s/TEMPLATE/${protoname_upper}/g" \ - -e "s/template/${protoname_lower}/g" \ - -e "s/Template/${protoname}/g" \ - > ${dst} < ${src} -} - -function copy_templates() { - src_h="src/output-json-template.h" - dst_h="src/output-json-${protoname_lower}.h" - src_c="src/output-json-template.c" - dst_c="src/output-json-${protoname_lower}.c" - - fail_if_exists ${dst_h} - fail_if_exists ${dst_c} - - copy_template_file ${src_h} ${dst_h} - copy_template_file ${src_c} ${dst_c} -} - -function patch_makefile_am() { - filename="src/Makefile.am" - echo "Patching ${filename}." - ed -s ${filename} > /dev/null < /dev/null < /dev/null < /dev/null < /dev/null 2>&1; then - echo "error: the program \"ed\" is required for this script" - exit 1 -fi - -function usage() { - cat < - -This script will provision a new app-layer parser for the protocol -name specified on the command line. This is done by copying and -patching src/app-layer-template.[ch] then linking the new files into -the build system. - -Examples: - - $0 DNP3 - $0 Gopher - -EOF -} - -# Make sure we are running from the correct directory. -set_dir() { - if [ -e ./suricata.c ]; then - cd .. - elif [ -e ./src/suricata.c ]; then - # Do nothing. - true - else - echo "error: this does not appear to be a suricata source directory." - exit 1 - fi -} - -fail_if_exists() { - path="$1" - if test -e "${path}"; then - echo "error: ${path} already exists." - exit 1 - fi -} - -function copy_template_file() { - src="$1" - dst="$2" - - echo "Creating ${dst}." - - sed -e '/TEMPLATE_START_REMOVE/,/TEMPLATE_END_REMOVE/d' \ - -e "s/TEMPLATE/${protoname_upper}/g" \ - -e "s/template/${protoname_lower}/g" \ - -e "s/Template/${protoname}/g" \ - > ${dst} < ${src} -} - -function copy_app_layer_templates { - src_h="src/app-layer-template.h" - dst_h="src/app-layer-${protoname_lower}.h" - src_c="src/app-layer-template.c" - dst_c="src/app-layer-${protoname_lower}.c" - - fail_if_exists ${dst_h} - fail_if_exists ${dst_c} - - copy_template_file ${src_h} ${dst_h} - copy_template_file ${src_c} ${dst_c} -} - -function patch_makefile_am { - filename="src/Makefile.am" - echo "Patching ${filename}." - ed -s ${filename} > /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null <