summaryrefslogtreecommitdiffstats
path: root/client/python_interop/testdata/python-tuf-v3.0.0/generate.sh
blob: 094fa411ace63281d1ec8686b00c66b2ab6464dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
#
# A script to generate TUF repository files using the Python implementation.
#
# A list of generated files is printed to STDERR and a tar of the files to STDOUT.

set -e

main() {
  local dir="$(mktemp -d)"
  trap "rm -rf ${dir}" EXIT

  pushd "${dir}" >/dev/null
  generate_consistent
  generate_non_consistent
  list_files >&2
  tar c .
  popd >/dev/null
}

generate_consistent() {
  mkdir "with-consistent-snapshot"
  pushd "with-consistent-snapshot" >/dev/null
  python3 /generate.py --consistent-snapshot
  popd >/dev/null
}

generate_non_consistent() {
  mkdir "without-consistent-snapshot"
  pushd "without-consistent-snapshot" >/dev/null
  python3 /generate.py
  popd >/dev/null
}

list_files() {
  echo "Files generated:"
  tree
}

main $@