Improve doasedit()

This commit is contained in:
Sam A. 2022-06-14 18:03:40 +02:00
parent 2b21aa3365
commit 66440d4bd7
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

View file

@ -2,18 +2,17 @@ doasedit() {
(( ${+commands[doas]} )) || return 1 (( ${+commands[doas]} )) || return 1
doas -L doas -L
doas -u root sh -c \
doas cp /etc/doas.conf /tmp/doas.conf "cp /etc/doas.conf /tmp/doas.conf \
doas $EDITOR /tmp/doas.conf && $EDITOR /tmp/doas.conf \
&& doas -C /tmp/doas.conf \
if doas doas -C /tmp/doas.conf; then && mv /tmp/doas.conf /etc/doas.conf \
echo "ok" && echo 'ok' \
doas mv /tmp/doas.conf /etc/doas.conf || echo >&2 'error'"
else local STATUS=$?
echo "error"
fi
doas -L doas -L
[[ $STATUS -gt 0 ]] && return 1
} }
get_ip() { get_ip() {