Can specify the number of key fragments

This commit is contained in:
Bob Mottram 2015-09-29 12:37:02 +01:00
parent 427b034a92
commit 4b80624010
3 changed files with 9 additions and 4 deletions

Binary file not shown.

View File

@ -31,13 +31,14 @@
USB_DRIVE=/dev/sdb1 USB_DRIVE=/dev/sdb1
USB_MOUNT=/mnt/usb USB_MOUNT=/mnt/usb
KEY_FRAGMENTS=3
FRAGMENTS_DIR=$USB_MOUNT/.gnupg_fragments FRAGMENTS_DIR=$USB_MOUNT/.gnupg_fragments
MY_USERNAME=$USER MY_USERNAME=$USER
MASTER_DRIVE="no" MASTER_DRIVE="no"
function show_help { function show_help {
echo '' echo ''
echo 'freedombone-keydrive -u [username] -d [device, eg. sdb] --master [yes/no]' echo 'freedombone-keydrive -u [username] -d [device, eg. sdb] --master [yes/no] -n [no of fragments]'
echo '' echo ''
exit 0 exit 0
} }
@ -62,6 +63,10 @@ case $key in
shift shift
MASTER_DRIVE="$1" MASTER_DRIVE="$1"
;; ;;
-n|--fragments)
shift
KEY_FRAGMENTS=$1
;;
*) *)
# unknown option # unknown option
;; ;;
@ -158,7 +163,7 @@ fi
LOCAL_FRAGMENTS_DIR=/home/$MY_USERNAME/.gnupg_fragments LOCAL_FRAGMENTS_DIR=/home/$MY_USERNAME/.gnupg_fragments
if [ ! -d $LOCAL_FRAGMENTS_DIR ]; then if [ ! -d $LOCAL_FRAGMENTS_DIR ]; then
freedombone-splitkey -u $MY_USERNAME freedombone-splitkey -u $MY_USERNAME -n $KEY_FRAGMENTS
fi fi
cd $LOCAL_FRAGMENTS_DIR cd $LOCAL_FRAGMENTS_DIR
@ -167,7 +172,7 @@ if [ ! "$?" = "0" ]; then
no_of_local_shares=0 no_of_local_shares=0
fi fi
if (( no_of_local_shares < 3 )); then if (( no_of_local_shares < 3 )); then
freedombone-splitkey -u $MY_USERNAME freedombone-splitkey -u $MY_USERNAME -n $KEY_FRAGMENTS
cd $LOCAL_FRAGMENTS_DIR cd $LOCAL_FRAGMENTS_DIR
no_of_local_shares=$(ls -afq keyshare.asc.* | wc -l) no_of_local_shares=$(ls -afq keyshare.asc.* | wc -l)
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head> <head>
<title></title> <title></title>
<!-- 2015-09-29 Tue 12:21 --> <!-- 2015-09-29 Tue 12:36 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="generator" content="Org-mode" /> <meta name="generator" content="Org-mode" />
<meta name="author" content="Bob Mottram" /> <meta name="author" content="Bob Mottram" />