aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Fitzgerald <greg@gregf.org>2016-07-28 11:16:45 -0400
committerGreg Fitzgerald <greg@gregf.org>2016-07-28 11:16:45 -0400
commit0379ab4ef1e5dcfe24a63fb3127b13a025ae4d1b (patch)
tree2c9f4c76db36c684e73088680b03e7ff1884de77
parentc2f83edb75cb82a260597c46da8820d00b497628 (diff)
downloadrofi-pass-0379ab4ef1e5dcfe24a63fb3127b13a025ae4d1b.tar.gz
Add support for BSD
-rw-r--r--README.md4
-rwxr-xr-xaddpass2
-rwxr-xr-xrofi-pass13
3 files changed, 14 insertions, 5 deletions
diff --git a/README.md b/README.md
index f5059f4..4205db5 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,10 @@ In addition to those `:enter` and `:delay` are available.
* gawk
* bash
+### BSD
+* gnugrep
+* gawk
+
## Configuration
rofi-pass may read its configuration values from `/etc/rofi-pass` and/or `$HOME/.config/rofi-pass/config`.
For an example configuration please take a look at the included `config.example` file.
diff --git a/addpass b/addpass
index 5e61dc3..1bdad29 100755
--- a/addpass
+++ b/addpass
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
source $HOME/.config/rofi-pass/config
diff --git a/rofi-pass b/rofi-pass
index 0129c51..398162e 100755
--- a/rofi-pass
+++ b/rofi-pass
@@ -4,6 +4,11 @@
# (c) 2015 Rasmus Steinke <rasi@xssn.at>
basecommand=$(echo "$0" | gawk '{ print $1 }')
+case "$OSTYPE" in
+ *bsd*) GREP='/usr/local/bin/grep' ;;
+ linux*) GREP='/usr/bin/grep' ;;
+ *) echo 'OS not supported, patches welcome' && exit 1 ;;
+esac
# get all password files and create an array
list_passwords() {
@@ -74,7 +79,7 @@ autopass () {
openURL () {
checkIfPass
- $BROWSER "$(pass "$selected_password" | grep "${URL_field}: " | gawk '{sub(/:/,"")}{print $2}1' | head -1)"; exit;
+ $BROWSER "$(pass "$selected_password" | $GREP "${URL_field}: " | gawk '{sub(/:/,"")}{print $2}1' | head -1)"; exit;
clearUp
}
@@ -219,7 +224,7 @@ Type field of entry with <span color='$help_color'>Enter</span>. For more help h
_id="${LINE%%: *}"
_val="${LINE#* }"
stuff["${_id}"]=${_val}
- done < <(echo "${password_temp}" | tail -n+2 | grep -P '(: |:\t)' )
+ done < <(echo "${password_temp}" | tail -n+2 | $GREP -P '(: |:\t)' )
stuff["pass"]=${password}
if test "${stuff['autotype']+autotype}"
then
@@ -344,7 +349,7 @@ showEntry () {
_id=$(echo "${LINE}" | gawk -F ':[[:space:]]*' '{print $1}')
_val=$(echo "${LINE}" | gawk '{sub(/:/,"")}{for (i=2; i<NF; i++) printf $i " "; print $NF}')
stuff["${_id}"]=${_val}
- done < <(PASSWORD_STORE_DIR="${root}" pass "${selected_password}" | tail -n+2 | grep -P '(: |:\t)' )
+ done < <(PASSWORD_STORE_DIR="${root}" pass "${selected_password}" | tail -n+2 | $GREP -P '(: |:\t)' )
stuff["pass"]=${password}
word=$(echo "$bla" | gawk -F': ' '{print $1}')
@@ -499,7 +504,7 @@ fi
# set help color
if [[ $help_color == "" ]]; then
- help_color=$(rofi -dump-xresources | grep 'rofi.color.normal' | gawk -F ',' '/,/{gsub(/ /, "", $2); print $2}')
+ help_color=$(rofi -dump-xresources | $GREP 'rofi.color.normal' | gawk -F ',' '/,/{gsub(/ /, "", $2); print $2}')
fi
# check for BROWSER variable, use xdg-open as fallback