Skip to content

Instantly share code, notes, and snippets.

@m4rcu5nl
Created July 23, 2017 18:03
Show Gist options
  • Save m4rcu5nl/14bf103cfff87e6dd71201d0ca28f2d1 to your computer and use it in GitHub Desktop.
Save m4rcu5nl/14bf103cfff87e6dd71201d0ca28f2d1 to your computer and use it in GitHub Desktop.
Wrapper script for Kingston DataTraveler Vault Privacy 3.0 used on Ubuntu 16.04
#!/bin/bash
# Wrapper script for Kinston DataTraveler Vault Privacy 3.0
function errecho(){
(>&2 echo "${@}");
}
function usage(){
echo -e "Usage:\n\tksdtvp (login|logout|initialize|forgotpass|about)"
}
function getarch(){
if [[ $(uname -m) = "x86_64" ]]; then
echo "64"
elif [[ $(uname -m) =~ [i.86] ]]; then
echo "32"
fi
}
function main(){
_scriptspath="/media/$(whoami)/DTVP30/linux/linux$(getarch)"
if [[ ! "${@}" ]]; then
errecho "Missing argument"
usage
exit 1
elif [[ ! -d "${_scriptspath}" ]]; then
errecho "Device not found"
exit 1
else
case "${1}" in
"login" ) ${_scriptspath}/dtvp_login ;;
"logout" ) ${_scriptspath}/dtvp_logout ;;
"about" ) ${_scriptspath}/dtvp_about ;;
"initialize" ) ${_scriptspath}/dtvp_initialize ;;
"forgotpass" ) ${_scriptspath}/dtvp_forgotpassword ;;
* ) errecho "Invalid argument" ; usage ; exit ;;
esac
fi
}
main "${@}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment