mirror of
https://github.com/olexsmir/dotfiles.git
synced 2026-01-15 16:51:34 +02:00
22 lines
410 B
Bash
Executable file
22 lines
410 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# For working this script set $GPG_KEY with gpg key
|
|
|
|
## Functions
|
|
encrypt() {
|
|
gpg -ea -r $GPG_KEY $@
|
|
}
|
|
decrypt() {
|
|
local f="$1"
|
|
if [ ${f: -4} == ".asc" ]
|
|
then gpg -d -o ${f%%.asc} $@
|
|
elif [ ${f: -4} == ".gpg" ]
|
|
then gpg -d -o ${f%%.gpg} $@
|
|
fi
|
|
}
|
|
|
|
## Case's
|
|
case "$1" in
|
|
enc|e) shift; encrypt $@ ;;
|
|
dec|d) shift; decrypt $@ ;;
|
|
*) echo "Error." ;;
|
|
esac
|