Add error handling to doasedit()

This commit is contained in:
theanonymousexyz 2022-05-27 20:30:58 +02:00
parent 08cb37e388
commit d0fb39a307
No known key found for this signature in database
GPG key ID: 35EE09F5481049BB

View file

@ -2,8 +2,17 @@ doasedit() {
(( ${+commands[doas]} )) || return 1 (( ${+commands[doas]} )) || return 1
doas -L doas -L
doas $EDITOR /etc/doas.conf
doas doas -C /etc/doas.conf && echo "ok" || echo "error" doas cp /etc/doas.conf /tmp/doas.conf
doas $EDITOR /tmp/doas.conf
if doas doas -C /tmp/doas.conf; then
echo "ok"
doas mv /tmp/doas.conf /etc/doas.conf
else
echo "error"
fi
doas -L doas -L
} }