diff options
author | David Runge <dave@sleepmap.de> | 2016-05-08 20:22:16 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2016-05-08 20:22:16 +0200 |
commit | 08845cec6393482a60493e465f0ba13727386f5b (patch) | |
tree | 8282cffd99ca2a12dfb3d34a7f82a28ac26d71b5 /bin/secret | |
parent | 9cfb64c997b8e5f095c75f39641762f44d3307c2 (diff) | |
download | dotfiles-08845cec6393482a60493e465f0ba13727386f5b.tar.gz dotfiles-08845cec6393482a60493e465f0ba13727386f5b.tar.bz2 dotfiles-08845cec6393482a60493e465f0ba13727386f5b.tar.xz dotfiles-08845cec6393482a60493e465f0ba13727386f5b.zip |
bin/set_volume: Making script not depend on functions.sh anymore. Introducing bash strict mode.
Diffstat (limited to 'bin/secret')
-rwxr-xr-x | bin/secret | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/bin/secret b/bin/secret deleted file mode 100755 index 27391ff..0000000 --- a/bin/secret +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -# Open and write to a gpg encrypted file -# Will create the file for you if it's not there yet -# -# secret <path/to/file> - -writeback () { - gpg --yes -eq -r "$gpgkey" -o $1 $tmpfile - echo "Encrypted file using gpg public key: $gpgkey" - chmod 600 $1 - echo "Finished working on file: $1." - rm $tmpfile - echo "Removed temp file $tmpfile" -} - -filetotmp () { - gpg --yes -o $tmpfile -d $1 -} - -tmpfile=$(mktemp) -gpgkey="David Runge <david.runge@frqrec.com>" - -# if file is available, use it, else create it -if [[ -f "$1" ]];then - filetotmp $1 - echo "File $1 now in $tmpfile ." -fi - -echo "Opening file in $EDITOR" -# edit decrypted file in /tmp -$EDITOR $tmpfile -if [[ $? -gt 0 ]];then - echo "Something went wrong with $EDITOR ." - echo "Aborting." - rm $tmpfile - echo "Deleted $tmpfile ." -else - # write back the file - writeback $1 -fi |