From 1df67a88dc7ddca4fca6837fbb65df8808c5409c Mon Sep 17 00:00:00 2001 From: Chandler Cain Date: Sun, 27 Oct 2019 17:54:13 -0400 Subject: [PATCH] Update installation script --- README.md | 14 +++++++++----- install.sh | 3 +++ src/install.sh | 5 ----- src/tokens.conf => tokens.conf | 0 uninstall.sh | 2 ++ 5 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 install.sh delete mode 100644 src/install.sh rename src/tokens.conf => tokens.conf (100%) create mode 100644 uninstall.sh diff --git a/README.md b/README.md index bf1320f..22d8347 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,18 @@ # bash-2fa -A super simple 2 factor authentication code (TOTP) generator front-end for oathtool using Bash. + +A super simple 2 factor authentication code (TOTP) generator front-end for oathtool using Bash. Requires installation of oathtool (available from oath-toolkit). ## Installation -1. Install oath-toolkit (e.g. `sudo apt install oath-toolkit`) and ensure that `oathtool` can be run from the command line. -2. Navigate to the src/ directory. -3. Run `bash install.sh` (sudo password will be required to copy exectuable into `/usr/local/bin`) + +1. Install oath-toolkit (`sudo apt install oath-toolkit`) +3. Run the installation srcipt (`bash install.sh`) +4. Ensure that ~/bin/ is in your PATH variable. ## Configuration + Configure your tokens in `~/.bash-2fa/tokens.conf`. Use the existing tempalate for fomatting. ## Usage -If token_name is configured with a key in `~/.bash-2fa/tokens.conf`, run `2fa token_name` will return a 2FA code for this token. + +If [token_name] is configured with a key in `~/.bash-2fa/tokens.conf`, running `2fa [token_name]` will return a 2FA code for this token. diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..5c6aa1d --- /dev/null +++ b/install.sh @@ -0,0 +1,3 @@ +ln -s -f $PWD/src/2fa.sh ~/bin/2fa +mkdir -p ~/.bash-2fa +if [ ! -e ~/.bash-2fa/tokens.conf ]; then cp tokens.conf ~/.bash-2fa/; fi diff --git a/src/install.sh b/src/install.sh deleted file mode 100644 index fb0fefd..0000000 --- a/src/install.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [ ! -e /usr/local/bin/2fa ]; then sudo ln -s `pwd`/2fa.sh /usr/local/bin/2fa; fi -mkdir -p ~/.bash-2fa -if [ ! -e ~/.bash-2fa/tokens.conf ]; then cp tokens.conf ~/.bash-2fa/; fi diff --git a/src/tokens.conf b/tokens.conf similarity index 100% rename from src/tokens.conf rename to tokens.conf diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 0000000..7a004a4 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,2 @@ +rm -f ~/bin/2fa +rm -rf ~/.bash-2fa