#!/bin/bash
# -*- mode: sh; tab-width: 8; encoding: utf-8-unix -*-

prog=`basename $0 .bash`
PREFIX=/usr/local
ROLE=gpgkey
DEBUG=1
. /usr/local/bin/usr_local_tput.bash
. /usr/local/bin/gridfire.rc

usage () {
    echo USAGE: $0 [options]
    cat << EOF
USAGE: $0 [--arg password ] -- veracrypt-args
`basename $0` arguments go before the -- veracrypt args go after
MINIMUM of 2 args for veracrypt
EOF
    exit 1
}
if [ "$#" -eq 0 ] ; then
    usage
    exit 1
  fi
if [ "$#" -lt 2 ] ; then
    usage
  fi

RARGS="--stdin --non-interactive"
[[ "$*" =~ "--stdin" ]] || [[ $RARGS =~ "--stdin" ]] || LARGS="--stdin $LARGS"
#no [[ "$*" =~ "--create" ]] &&  LARGS="--repeat $LARGS"
#no [[ "$*" =~ "--new-password=" ]] &&  LARGS="--repeat $LARGS"

tail=`echo $@ | sed -e 's/.* \([^ ]*\) \([^ ]*\)/\1 \2/'`
$PREFIX/bin/gridfire $LARGS -H "veracrypt-console $tail" -- \
     $PREFIX/bin/veracrypt-console.sh $RARGS "$@" 

# FixMe:   --new-password=<str>       	New password
