Skip to content

Commit d683a7b

Browse files
committed
Add script to revendor OPA
Signed-off-by: Torin Sandall <[email protected]>
1 parent afd732d commit d683a7b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

revendor_opa.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
usage() {
4+
echo "$0 <commit-ish> (e.g., $0 v0.9.1)"
5+
}
6+
7+
if [ $# -eq 0 ]; then
8+
usage
9+
exit 1
10+
fi
11+
12+
# Copied from https://unix.stackexchange.com/questions/92895/how-can-i-achieve-portability-with-sed-i-in-place-editing
13+
case $(sed --help 2>&1) in
14+
*GNU*) sed_i () { sed -i "$@"; };;
15+
*) sed_i () { sed -i '' "$@"; };;
16+
esac
17+
18+
sed_i "/name = \"github.com\/open-policy-agent\/opa\"/{N;s/version = .*/version = \"$1\"/;}" Gopkg.toml
19+
20+
git status | grep Gopkg.toml
21+
22+
if [ $? -eq 0 ]; then
23+
dep ensure
24+
git add .
25+
fi

0 commit comments

Comments
 (0)