OILS / trees / silo.sh View on Github | oilshell.org

46 lines, 24 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# trees/silo.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10die() {
11 echo "$@" >&2
12 exit 1
13}
14
15main() {
16 local action=${1:-}
17
18 case $action in
19
20 init)
21 local dir=${2:-'.'}
22
23 # Set up repo structure
24 mkdir -v -p $dir/{objects,pack,derived}
25
26 # Make the 00 objects on demand
27 ;;
28
29 verify)
30 local dir=${2:-'.'}
31
32 # TODO: decompress and checksum file?
33 #
34 # Note that git-hash-object takes -t blob, and that --literally bypasses
35 # the check
36 find primary -name '*.blob.gz' | xargs echo TODO
37 ;;
38
39 *)
40 die "Invalid action '$action'"
41 ;;
42
43 esac
44}
45
46main "$@"