diff options
author | Endi S. Dewata <edewata@redhat.com> | 2017-07-20 08:17:26 +0200 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2017-07-20 08:17:26 +0200 |
commit | b6deb83bb5734e64842b2ac8655c89931ca2ec34 (patch) | |
tree | b934500aee766c61b97539bde50b2027e6443787 | |
parent | 43f17ccffb5cec8c7b4faa6f441090db96b6eacb (diff) | |
download | pki-dev-b6deb83bb5734e64842b2ac8655c89931ca2ec34.tar.gz pki-dev-b6deb83bb5734e64842b2ac8655c89931ca2ec34.tar.xz pki-dev-b6deb83bb5734e64842b2ac8655c89931ca2ec34.zip |
Added nFast scripts.
-rwxr-xr-x | tools/nfast-find | 70 | ||||
-rwxr-xr-x | tools/nfast-partition-add | 65 | ||||
-rwxr-xr-x | tools/nfast-partition-del | 50 |
3 files changed, 185 insertions, 0 deletions
diff --git a/tools/nfast-find b/tools/nfast-find new file mode 100755 index 0000000..8e0fc16 --- /dev/null +++ b/tools/nfast-find @@ -0,0 +1,70 @@ +#!/bin/sh + +verbose= +token= +password_file= + +# read the options +TEMP=`getopt -o t:f:v --long help -n 'nfast-find' -- "$@"` +eval set -- "$TEMP" + +# extract options and their arguments into variables. +while true ; do + case "$1" in + -t) + token=$2 + shift 2 + ;; + -f) + password_file=$2 + shift 2 + ;; + --help) + echo "Usage: nfast-find <prefix> -f <password file> [OPTIONS]" + echo + echo "Options:" + echo " -t <token name> Token name." + echo " -f <password file> File containing token password." + echo " -v Run in verbose mode." + echo " --help Show help message." + exit 0 + ;; + -v) + verbose=1 + shift + ;; + --) + shift + break + ;; + *) + echo "Error: invalid option $1" >&2 + echo "Run nfast-find --help for help." >&2 + exit 1 + ;; + esac +done + +if [[ "$verbose" != "" ]] +then + echo "token name: $token" + echo "password file: $password_file" +fi + +if [[ "$token" == "" ]] +then + echo "Error: missing token name" >&2 + echo "Run nfast-find --help for help." >&2 + exit 1 +fi + +if [[ "$password_file" == "" ]] +then + echo "Error: missing password file" >&2 + echo "Run nfast-find --help for help." >&2 + exit 1 +fi + +password="`cat $password_file`" + +/opt/nfast/bin/cklist -s "$token" -p "$password" | egrep "CKA_CLASS|CKA_LABEL|CKA_NFKM_ID" diff --git a/tools/nfast-partition-add b/tools/nfast-partition-add new file mode 100755 index 0000000..f55200a --- /dev/null +++ b/tools/nfast-partition-add @@ -0,0 +1,65 @@ +#!/bin/sh + +verbose= +password_file= + +# read the options +TEMP=`getopt -o f:v --long help -n 'nfast-partition-add' -- "$@"` +eval set -- "$TEMP" + +# extract options and their arguments into variables. +while true ; do + case "$1" in + -f) + password_file=$2 + shift 2 + ;; + --help) + echo "Usage: nfast-partition-add <name> [OPTIONS]" + echo + echo "Options:" + echo " -f <password file> File containing partition password." + echo " -v Run in verbose mode." + echo " --help Show help message." + exit 0 + ;; + -v) + verbose=1 + shift + ;; + --) + shift + break + ;; + *) + echo "Error: invalid option $1" >&2 + echo "Run nfast-partition-add --help for help." >&2 + exit 1 + ;; + esac +done + +partition=$1 + +if [[ "$verbose" != "" ]] +then + echo "partition name: $partition" +fi + +if [[ "$partition" == "" ]] +then + echo "Error: missing partition name" >&2 + echo "Run nfast-partition-add --help for help." >&2 + exit 1 +fi + +if [[ "$password_file" == "" ]] +then + echo "Error: missing password file" >&2 + echo "Run nfast-partition-add --help for help." >&2 + exit 1 +fi + +password="`cat $password_file`" + +echo -e "$password\n$password\n" | /opt/nfast/bin/ppmk --new --recoverable $partition diff --git a/tools/nfast-partition-del b/tools/nfast-partition-del new file mode 100755 index 0000000..9fddba3 --- /dev/null +++ b/tools/nfast-partition-del @@ -0,0 +1,50 @@ +#!/bin/sh + +verbose= + +# read the options +TEMP=`getopt -o v --long help -n 'nfast-partition-del' -- "$@"` +eval set -- "$TEMP" + +# extract options and their arguments into variables. +while true ; do + case "$1" in + --help) + echo "Usage: nfast-partition-del <name> [OPTIONS]" + echo + echo "Options:" + echo " -v Run in verbose mode." + echo " --help Show help message." + exit 0 + ;; + -v) + verbose=1 + shift + ;; + --) + shift + break + ;; + *) + echo "Error: invalid option $1" >&2 + echo "Run nfast-partition-del --help for help." >&2 + exit 1 + ;; + esac +done + +partition=$1 + +if [[ "$verbose" != "" ]] +then + echo "partition name: $partition" +fi + +if [[ "$partition" == "" ]] +then + echo "Error: missing partition name" >&2 + echo "Run nfast-partition-del --help for help." >&2 + exit 1 +fi + +echo -e "yes\n" | /opt/nfast/bin/ppmk --delete $partition |