dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit 8211694d669ac00922e03b071c00e878a25a292d
parent 0763ee7ab7f51cc4ab816de84b50c46db0771c35
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sun, 22 Mar 2020 09:49:18 -0400

acme/Sudo: Fixes for doas compat

Diffstat:
Mlib/acme/Sudo | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/acme/Sudo b/lib/acme/Sudo @@ -1,15 +1,17 @@ #!/bin/sh +# Assumes the user can run cat and tee as root without a password -if [ -z "$SUDO_ASKPASS" ] +if type doas >/dev/null 2>&1 then - echo "SUDO_ASKPASS not defined" >&2 - exit + sudo=doas +else + sudo=sudo fi if [ $# -eq 0 ] then fname=$(9p read acme/$winid/tag | awk '{ print $1 }') - 9p read acme/$winid/body | sudo tee $fname >/dev/null 2>&1 + 9p read acme/$winid/body | $sudo /usr/bin/tee $fname >/dev/null 2>&1 echo clean | 9p write acme/$winid/ctl else if echo $1 | grep -E '^/' > /dev/null 2>&1 @@ -19,8 +21,8 @@ else fname=$(pwd)/$1 fi echo name $fname | 9p write acme/new/ctl - winid=$(9p read acme/index | grep $fname | awk '{ print $1 }') + winid=$(9p read acme/index | awk '{ print $1 " " $6 }' | grep /etc/pf.conf | awk '{ print $1 }') echo -n 'Sudo ' | 9p write acme/$winid/tag - sudo cat $fname | 9p write acme/$winid/body + $sudo /bin/cat $fname | 9p write acme/$winid/body echo clean | 9p write acme/$winid/ctl fi \ No newline at end of file