diff options
Diffstat (limited to '')
-rw-r--r-- | emacs/Makefile | 4 | ||||
-rw-r--r-- | git/Makefile | 4 | ||||
-rwxr-xr-x | git/ge | 8 | ||||
-rw-r--r-- | gnupg/Makefile | 8 | ||||
-rwxr-xr-x | gnupg/decrypt | 13 | ||||
-rwxr-xr-x | gnupg/encrypt | 10 | ||||
-rwxr-xr-x | gnupg/encrypt-nosign | 10 |
7 files changed, 57 insertions, 0 deletions
diff --git a/emacs/Makefile b/emacs/Makefile index c22b5f4..c7f8527 100644 --- a/emacs/Makefile +++ b/emacs/Makefile @@ -30,6 +30,9 @@ install: test ! -d ~/.config/profile.d/emacs && \ ln -sf -- ~/.dotfiles/emacs/user-profile ~/.config/profile.d/emacs; \ fi + mkdir -p -- ~/.local/bin + test ! -d ~/.local/bin/e + ln -sf -- "$$(which emacs)" ~/.local/bin/e uninstall: -unlink -- ~/.config/profile.d/emacs @@ -37,5 +40,6 @@ uninstall: -unlink -- ~/.config/emacs/init.el -unlink -- ~/.emacs.d -rmdir -- ~/.config/emacs + -unlink -- ~/.local/bin/e .PHONY: install uninstall diff --git a/git/Makefile b/git/Makefile index 3f9f161..13c3740 100644 --- a/git/Makefile +++ b/git/Makefile @@ -7,11 +7,15 @@ install: mkdir -p -- ~/.config/bash/aliases.d test ! -d ~/.config/bash/aliases.d/git ln -sf -- ~/.dotfiles/git/bash-aliases ~/.config/bash/aliases.d/git + $(CHECK_INSTALLED) dash + mkdir -p -- ~/.local/bin + ln -sf -- ~/.dotfiles/git/ge ~/.local/bin/ uninstall: -unlink -- ~/.config/git/config -rmdir -- ~/.config/git -unlink -- ~/.config/bash/aliases.d/git -rmdir -- ~/.config/bash/aliases.d + -unlink -- ~/.local/bin/ge .PHONY: install uninstall @@ -0,0 +1,8 @@ +#!/bin/dash + +e "$@" +git add -- "$@" + +if test -f "$(git home)/.git/autosave"; then + exec git commit -m 'Autosave' +fi diff --git a/gnupg/Makefile b/gnupg/Makefile index 6583b2d..76f83e9 100644 --- a/gnupg/Makefile +++ b/gnupg/Makefile @@ -13,10 +13,18 @@ install: mkdir -p -- ~/.config/profile.d test ! -d ~/.config/profile.d/gnupg ln -sf -- ~/.dotfiles/gnupg/user-profile ~/.config/profile.d/gnupg + $(CHECK_INSTALLED) dash + mkdir -p -- ~/.local/bin + ln -sf -- ~/.dotfiles/gnupg/decrypt ~/.local/bin/ + ln -sf -- ~/.dotfiles/gnupg/encrypt ~/.local/bin/ + ln -sf -- ~/.dotfiles/gnupg/encrypt-nosign ~/.local/bin/ uninstall: -unlink -- ~/.config/profile.d/gnupg -rmdir -- ~/.config/profile.d -unlink -- ~/.var/lib/gnupg + -unlink -- ~/.local/bin/decrypt + -unlink -- ~/.local/bin/encrypt + -unlink -- ~/.local/bin/encrypt-nosign .PHONY: install uninstall diff --git a/gnupg/decrypt b/gnupg/decrypt new file mode 100755 index 0000000..57db255 --- /dev/null +++ b/gnupg/decrypt @@ -0,0 +1,13 @@ +#!/bin/dash +if test -z "${GPG_KEY}"; then + printf '\033[1;31m%s\033[0m\n' 'You must export GPG_KEY with you GPG key' >&2 + exit 1 +else + for file in "$@"; do + if test "${file}" = "${file%*.crypt}"; then + gpg --decrypt < "${file}" > "${file%*.crypt}" + else + gpg --decrypt < "${file}" > "${file}.decrypted" + fi + done +fi diff --git a/gnupg/encrypt b/gnupg/encrypt new file mode 100755 index 0000000..e91190f --- /dev/null +++ b/gnupg/encrypt @@ -0,0 +1,10 @@ +#!/bin/dash +if test -z "${GPG_KEY}"; then + printf '\033[1;34m%s\033[0m\n' 'You must export GPG_KEY with you GPG key' >&2 + exit 1 +else + for file in "$@"; do + gpg --encrypt --sign -r "${GPG_KEY}" -u "${GPG_KEY}" < "${file}" > "${file}.crypt" + done + printf '\033[1;34m%s\033[0m\n' '-- Do not forget to shred. --' >&2 +fi diff --git a/gnupg/encrypt-nosign b/gnupg/encrypt-nosign new file mode 100755 index 0000000..c4446b1 --- /dev/null +++ b/gnupg/encrypt-nosign @@ -0,0 +1,10 @@ +#!/bin/dash +if test -z "${GPG_KEY}"; then + printf '\033[1;31m%s\033[0m\n' 'You must export GPG_KEY with you GPG key' >&2 + exec 1 +else + for file in "$@"; do + gpg --encrypt -r "${GPG_KEY}" < "${file}" > "${file}.crypt" + done + printf '\033[1;34m%s\033[0m\n' '-- Do not forget to shred. --' >&2 +fi |