-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathgenerate
executable file
·71 lines (51 loc) · 1.31 KB
/
generate
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
set -e
kubernetes_version () {
VERSION="${1}"
DIR="$(nix-build release.nix --attr "\"${VERSION}\"" --no-out-link)"
rm -r -f -- "${VERSION}"
mkdir -p "${VERSION}"
for FILE in defaults types schemas types.dhall typesUnion.dhall defaults.dhall schemas.dhall package.dhall; do
cp -r "${DIR}/${FILE}" "${VERSION}"
chmod -R u+w "${VERSION}/${FILE}"
done
}
kubernetes () {
for KUBERNETES_FILE in ./nix/kubernetes/*.txt; do
KUBERNETES_FILE_WITHOUT_EXTENSION="${KUBERNETES_FILE%.txt}"
VERSION="${KUBERNETES_FILE_WITHOUT_EXTENSION#./nix/kubernetes/}"
kubernetes_version "${VERSION}"
done
}
examples () {
DIR="$(nix-build release.nix --attr examples)"
rm -r -f -- ./examples
cp -r "${DIR}/" ./examples
chmod -R u+w ./examples
}
readme () {
FILE="$(nix-build release.nix --attr readme)"
cp "${FILE}" README.md
chmod u+w README.md
}
preferred () {
PREFERRED_VERSION="$(cat ./nix/preferred.txt)"
kubernetes_version "${PREFERRED_VERSION}"
for FILE in {package,types,defaults,schemas,typesUnion}.dhall; do
echo "./${PREFERRED_VERSION}/${FILE}" > "${FILE}"
done
examples
readme
}
if [ -n "$1" ]; then
case "$1" in
kubernetes) kubernetes;;
examples) examples;;
readme) readme;;
esac
else
kubernetes
examples
readme
preferred
fi