aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authormagnus2021-12-18 05:31:55 -0600
committermagnus2021-12-18 05:31:55 -0600
commite9280004d4d97d4c98e79895536bef9499ee298d (patch)
tree15bc7b416b7e9ecb9e109429e26848c292f3820d
parent17e696bb5bbfeb089a37529300ebabee290e9e6d (diff)
downloadaur-e9280004d4d97d4c98e79895536bef9499ee298d.tar.gz
Make doasedit able to edit regular files again by fixing order of operations in bash
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rwxr-xr-xdoasedit7
3 files changed, 10 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 027a929e1e0d..a1f768113ea9 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -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
diff --git a/PKGBUILD b/PKGBUILD
index 881a85f39338..c519b58ad343 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -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"
diff --git a/doasedit b/doasedit
index 85550ab1ad69..f491830049dd 100755
--- a/doasedit
+++ b/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'"