initial version
[public/misc-sysadmin.git] / securenote
1 #!/bin/bash
2
3 # Copyright 2012, Svenne Krap
4 # # svenne@krap.dk
5 # #
6 # # Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
7 # #
8 # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
9
10
11
12
13
14
15 # This tool allows you to easily and safely to encrypt text for yourself
16 # PLEASE remember to change path, mymail, mykey below!
17 #
18 path=~/securenotes/
19 mymail=svenne@krap.dk
20 mykey=0x9bef4442
21 if [ $# -ne 1 ]; then
22     echo "securenote <notename>";
23     exit;
24 fi
25 fn=$1.gpg
26 ffn=$path$fn
27 if [ ! -d $path ]; then
28     echo "cannot find path"
29     exit;
30 fi
31
32 if [ -f $path$fn ]; then
33     echo "file exists";
34     exit;
35 fi
36 /usr/bin/gpg -a -e -s -u $mykey -r $mykey >$ffn