aboutsummaryrefslogtreecommitdiff
path: root/scripts/encrypt_file.sh
blob: cee8c86edc3c47e0f02696dd8db51b2801fcaa4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
set -e

F="$(readlink -f "$1")"

cd "$(dirname "$0")/.."

TMP="$(mktemp)"
KEY="$(gpg2 --decrypt files/keys/primary.gpg)"

PASS_ENC="$KEY" openssl aes-192-cbc -e -a -pass env:PASS_ENC -in "$F" -out "$TMP"
mv "$TMP" "$F"