From daa9dcb75f24fcae601332c53e84460cfb64064e Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Thu, 1 Aug 2013 15:51:45 +0200 Subject: [PATCH] Use wget or curl to download ruleset. --- Makefile.am | 10 +++++++++- configure.ac | 12 +++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 58200ae869..fd4527c208 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,7 +27,15 @@ install-conf: install-rules: install -d "$(e_sysconfrulesdir)" - wget -qO - http://rules.emergingthreats.net/open/suricata/emerging.rules.tar.gz | tar -x -z -C "$(e_sysconfdir)" -f - +if HAVE_FETCH_COMMAND +if HAVE_WGET_COMMAND + $(HAVE_WGET) -qO - http://rules.emergingthreats.net/open/suricata/emerging.rules.tar.gz | tar -x -z -C "$(e_sysconfdir)" -f - +else + $(HAVE_CURL) -s http://rules.emergingthreats.net/open/suricata/emerging.rules.tar.gz | tar -x -z -C "$(e_sysconfdir)" -f - +endif +else + @echo "UNABLE to load ruleset wget or curl are not installed on system." +endif @test -e "$(e_sysconfrulesdir)decoder-events.rules" || install -m 600 "$(top_srcdir)/rules/decoder-events.rules" "$(e_sysconfrulesdir)" @test -e "$(e_sysconfrulesdir)stream-events.rules" || install -m 600 "$(top_srcdir)/rules/stream-events.rules" "$(e_sysconfrulesdir)" @test -e "$(e_sysconfrulesdir)smtp-events.rules" || install -m 600 "$(top_srcdir)/rules/smtp-events.rules" "$(e_sysconfrulesdir)" diff --git a/configure.ac b/configure.ac index e1956c2992..1a327bc223 100644 --- a/configure.ac +++ b/configure.ac @@ -114,7 +114,17 @@ fi AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON_CONFIG" != "no"]) - + AC_PATH_PROG(HAVE_WGET, wget, "no") + if test "$HAVE_WGET" = "no"; then + AC_PATH_PROG(HAVE_CURL, curl, "no") + if test "$HAVE_CURL" = "no"; then + echo + echo " Warning curl or wget not found, you won't be able to" + echo " download latest ruleset with 'make install-rules'" + fi + fi + AM_CONDITIONAL([HAVE_FETCH_COMMAND], [test "x$HAVE_WGET" != "xno" || test "x$HAVE_CURL" != "xno"]) + AM_CONDITIONAL([HAVE_WGET_COMMAND], [test "x$HAVE_WGET" != "xno"]) # Checks for libraries. -- 2.47.2