Skip to content

Commit

Permalink
Add zkg wrapper which does not pull down sources.
Browse files Browse the repository at this point in the history
When executing `zkg` concurrently multiple updates to the sources can
race and destroy each others state. Disable that update. This is a
workaround for zeek/package-manager#139.
  • Loading branch information
bbannier committed Oct 6, 2022
1 parent 6a1236a commit b7b6d51
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/scripts/zkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

# This script provides a wrapper around `zkg` which provides a workaround for
# zeek/package-manager#139. The approach taken here is to provide an empty
# `sources` section in the zkg configuration; this seems to disable updates of
# the default package source.

STATE=$(realpath "$(mktemp -d zkg.state.XXXXXX)")
CONFIG=$(mktemp config.XXXXXX)

trap 'rm -rf ${STATE} ${CONFIG}' EXIT

cat > "$CONFIG" << _END_
[templates]
default = https://github.com/zeek/package-template
[paths]
state_dir = ${STATE}/.zkg
script_dir = ${STATE}/.zkg/script_dir
plugin_dir = ${STATE}/.zkg/plugin_dir
bin_dir = ${STATE}/.zkg/bin
zeek_dist =
[sources]
_END_

zkg --configfile "$CONFIG" "$@"

0 comments on commit b7b6d51

Please sign in to comment.