File: generate.sh

package info (click to toggle)
golang-github-theupdateframework-go-tuf 0.5.2-5~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 7,596 kB
  • sloc: python: 163; sh: 37; makefile: 12
file content (40 lines) | stat: -rwxr-xr-x 763 bytes parent folder | download | duplicates (2)
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 $@