zeek / package-manager

A package manager for Zeek
https://docs.zeek.org/projects/package-manager
Other
43 stars 27 forks source link

cannot run zkg autoconfig - File contains no section headers #67

Closed EdgeSync closed 4 years ago

EdgeSync commented 4 years ago

Hi,

zkg version:

root@ids:~# zkg --version
zkg 2.1.2

zeek + zeekctl version, built from source.

root@ids:~# /usr/local/zeek/bin/zeek --version
/usr/local/zeek/bin/zeek version 3.1.4
root@ids:~# zeekctl --version
ZeekControl version 2.1.0

OS Version

root@ids:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"

I have installed zkg through pip, and am trying to follow the steps listed in the docs.
https://docs.zeek.org/projects/package-manager/en/stable/quickstart.html

zkg autoconfig

this returns an error that it cannot find my zeek-config file. No problem, i use --configfile to pass that in.
zkg --configfile /usr/local/zeek/bin/zeek-config autoconfig

i get a python error:

 root@ids:# zpk --configfile /usr/local/zeek/bin/zeek-config autoconfig
 zpk: command not found
 root@ids:# zkg --configfile /usr/local/zeek/bin/zeek-config autoconfig
 Traceback (most recent call last):
  File "/usr/local/bin/zkg", line 2243, in <module>
    main()
  File "/usr/local/bin/zkg", line 2236, in main
    config = create_config(configfile)
  File "/usr/local/bin/zkg", line 200, in create_config
    config.read(configfile)
  File "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", line 770, in read
    self._read(fp, filename)
  File "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", line 1162, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
backports.configparser.MissingSectionHeaderError: File contains no section headers.
file: '/usr/local/zeek/bin/zeek-config', line: 3
u'version=3.1.4\n'

my zeek-config is the default one, hasn't been modified.

#!/bin/sh

version=3.1.4
build_type=relwithdebinfo
prefix=/usr/local/zeek
script_dir=/usr/local/zeek/share/zeek
site_dir=/usr/local/zeek/share/zeek/site
plugin_dir=/usr/local/zeek/lib/zeek/plugins
config_dir=/usr/local/zeek/etc
python_dir=/usr/local/zeek/lib/zeekctl
cmake_dir=/usr/local/zeek/share/zeek/cmake
include_dir=/usr/local/zeek/include/zeek
zeekpath=.:/usr/local/zeek/share/zeek:/usr/local/zeek/share/zeek/policy:/usr/local/zeek/share/zeek/site
zeek_dist=/root/zeek-3.1.4
binpac_root=/usr/local/zeek
caf_root=/usr/local/zeek
broker_root=/usr/local/zeek

usage="\
Usage: zeek-config [--version] [--build_type] [--prefix] [--script_dir] [--site_dir] [--plugin_dir] [--config_dir] [--python_dir] [--include_dir] [--cmake_dir] [--zeekpath] [--zeek_dist] [--binpac_root] [--caf_root] [--broker_root]"

if [ $# -eq 0 ] ; then
      echo "${usage}" 1>&2
      exit 1
fi

while [ $# -ne 0 ]; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case $1 in
    --version)
      echo $version
      ;;
    --prefix)
      echo $prefix
      ;;
    --build_type)
      echo $build_type
      ;;
    --script_dir)
      echo $script_dir
      ;;
    --site_dir)
      echo $site_dir
      ;;
    --plugin_dir)
      echo $plugin_dir
      ;;
    --config_dir)
      echo $config_dir
      ;;
    --python_dir)
      echo $python_dir
      ;;
    --cmake_dir)
      echo $cmake_dir
      ;;
    --include_dir)
      echo $include_dir
      ;;
    --bropath)   # For compatibility with legacy Bro plugins.
      echo $zeekpath
      ;;
    --zeekpath)
      echo $zeekpath
      ;;
    --bro_dist)  # For compatibility with legacy Bro plugins.
      echo $zeek_dist
      ;;
    --zeek_dist)
      echo $zeek_dist
      ;;
    --binpac_root)
      echo $binpac_root
      ;;
    --caf_root)
      echo $caf_root
      ;;
    --broker_root)
      echo $broker_root
      ;;
    *)
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done

exit 0
jsiwek commented 4 years ago
zkg autoconfig

this returns an error that it cannot find my zeek-config file. No problem, i use --configfile to pass that in.

zkg --configfile /usr/local/zeek/bin/zeek-config autoconfig

The --configfile option is not for specifying the path to zeek-config, it's for specifying the path to zkg's own config file: https://docs.zeek.org/projects/package-manager/en/stable/zkg.html#config-file

What you need to do for zkg autoconfig to find zeek-config, is to have it reachable in your PATH environment variable, for example: export PATH=/usr/local/zeek/bin:$PATH