]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/bash | |
2 | ||
3 | if [ -z "$NIXOPS" ]; then | |
4 | echo "Please set NIXOPS to the nixops command" | |
5 | exit 1; | |
6 | fi | |
7 | ||
8 | if [ -z "$NIXOPS_CONFIG_PASS_SUBTREE_PATH" ]; then | |
9 | echo "Please set NIXOPS_CONFIG_PASS_SUBTREE_PATH to the password-store subtree path" | |
10 | exit 1; | |
11 | fi | |
12 | ||
13 | TEMP=$(mktemp -d /tmp/XXXXXX-nixops-files) | |
14 | chmod go-rwx $TEMP | |
15 | ||
16 | finish() { | |
17 | rm -rf "$TEMP" | |
18 | $NIXOPS set-args --unset privateFiles | |
19 | } | |
20 | ||
21 | trap finish EXIT | |
22 | ||
23 | # pass cannot "just" list files in a directory without showing a tree :( | |
24 | files=$(pass ls $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files | sed -e '1d' -e 's/^.* //') | |
25 | ||
26 | for file in $files; do | |
27 | pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files/$file" > $TEMP/$file | |
28 | done | |
29 | $NIXOPS set-args --argstr privateFiles "$TEMP" | |
30 | ||
31 | "$@" |