diff options
author | magnus | 2021-12-18 05:31:55 -0600 |
---|---|---|
committer | magnus | 2021-12-18 05:31:55 -0600 |
commit | e9280004d4d97d4c98e79895536bef9499ee298d (patch) | |
tree | 15bc7b416b7e9ecb9e109429e26848c292f3820d | |
parent | 17e696bb5bbfeb089a37529300ebabee290e9e6d (diff) | |
download | aur-e9280004d4d97d4c98e79895536bef9499ee298d.tar.gz |
Make doasedit able to edit regular files again by fixing order of operations in bash
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 4 | ||||
-rwxr-xr-x | doasedit | 7 |
3 files changed, 10 insertions, 5 deletions
@@ -1,7 +1,7 @@ pkgbase = doasedit pkgdesc = Allow doas users to edit root-owned files by running an unpriviledged editor - pkgver = 0.5 - pkgrel = 2 + pkgver = 0.6 + pkgrel = 1 url = https://gitlab.com/magnustesshu/doasedit arch = any license = GPL @@ -1,7 +1,7 @@ # Maintainer: Magnus Anderson <magnus@iastate.edu> pkgname=doasedit -pkgver=0.5 -pkgrel=2 +pkgver=0.6 +pkgrel=1 pkgdesc="Allow doas users to edit root-owned files by running an unpriviledged editor" arch=('any') url="https://gitlab.com/magnustesshu/doasedit" @@ -50,7 +50,12 @@ $EDITOR $doasediting_file || ERR "The editor failed to exit successfully" # If the original file did not exist, print a warning [[ -e "$1" ]] || echo "doasedit: File '$1' will be created, if this is not desireable press ctrl+C" -[[ "/etc/doas.conf" == "$1" ]] && echo "$ doas -C $doasediting_file doasedit \"$1\"" && doas -C $doasediting_file doasedit \"$1\" || ERR "Replacing '/etc/doas.conf' would mean you no longer have permissions to edit it any further.\nIf you do not know what you're doing, you had a syntax error, so see the above output and try again." +# Ensure if we edit '/etc/doas.conf' that permissons are correct +[[ "/etc/doas.conf" == "$1" ]] && { + echo "$ doas -C $doasediting_file doasedit \"$1\"" && + doas -C $doasediting_file doasedit \"$1\" || + ERR "Replacing '/etc/doas.conf' would mean you no longer have permissions to edit it any further.\nIf you do not know what you're doing, you had a syntax error, so see the above output and try again." +} doas cp $doasediting_file "$1" || ERR "You put your password in wrong. Manually run 'doas cp $doasediting_file $1'" |