diff options
author | Greg Fitzgerald <greg@gregf.org> | 2016-07-28 11:16:45 -0400 |
---|---|---|
committer | Greg Fitzgerald <greg@gregf.org> | 2016-07-28 11:16:45 -0400 |
commit | 0379ab4ef1e5dcfe24a63fb3127b13a025ae4d1b (patch) | |
tree | 2c9f4c76db36c684e73088680b03e7ff1884de77 | |
parent | c2f83edb75cb82a260597c46da8820d00b497628 (diff) | |
download | rofi-pass-0379ab4ef1e5dcfe24a63fb3127b13a025ae4d1b.tar.gz |
Add support for BSD
-rw-r--r-- | README.md | 4 | ||||
-rwxr-xr-x | addpass | 2 | ||||
-rwxr-xr-x | rofi-pass | 13 |
3 files changed, 14 insertions, 5 deletions
@@ -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. @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source $HOME/.config/rofi-pass/config @@ -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 |