Jafner.net/homelab/stacks/deploy.sh

18 lines
804 B
Bash
Raw Normal View History

2024-09-02 13:21:23 -07:00
#!/bin/bash
# run me with
2024-09-02 13:25:52 -07:00
# curl https://gitea.jafner.tools/Jafner/Jafner.net/raw/branch/main/homelab/stacks/deploy.sh | bash -s <stack to pass>
2024-09-02 13:21:23 -07:00
STACK=$1
mkdir -p /tmp/stack/$STACK
git clone -n --depth=1 --filter=tree:0 https://gitea.jafner.tools/Jafner/Jafner.net.git /tmp/stack/$STACK && cd /tmp/stack/$STACK
git sparse-checkout set --no-cone homelab/stacks/$STACK && git checkout
mv -f homelab/stacks/$STACK/* $HOME/stacks/$STACK/
mv -f homelab/stacks/$STACK/.* $HOME/stacks/$STACK/
2024-09-02 13:21:23 -07:00
cd $HOME/stacks/$STACK && rm -rf /tmp/stack/$STACK
echo -e "$(cat $HOME/.age/$HOSTNAME.host.key)\n$AGE_DEPLOY_KEY" > $HOME/.age/combined.key
export SOPS_AGE_KEY_FILE="$HOME/.age/combined.key"
for file in $(find . -type f); do
sops decrypt -i --input-type json "$file" 2>/dev/null && echo "Decrypted $file"
done