all repos

dotfiles @ 71ddd0ad2f8c1f05a2713984ad462b708d8579df

i use rach linux btw

dotfiles/bin/gpe (view raw)

1
#!/usr/bin/env bash
2
# For working this script set in $GPG_KEY you gpg key
3
## Functions
4
function encrypt() {
5
    gpg -ea -r $GPG_KEY $@
6
}
7
function decrypt() {
8
    local fn="$1"
9
10
    if [ ${fn: -4} == ".asc" ]
11
    then
12
        gpg -d -o ${fn%%.asc} $@
13
    elif [ ${fn: -4} == ".gpg" ]
14
    then
15
        gpg -d -o ${fn%%.gpg} $@
16
    fi
17
}
18
19
## Logic
20
case "$1" in
21
    enc|e) shift; encrypt $@ ;;
22
    dec|d) shift; decrypt $@ ;;
23
    *) echo "Error."         ;;
24
esac