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 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 Enter. 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