diff --git a/libexec/sourcezap/scripts/setup-doas b/libexec/sourcezap/scripts/setup-doas index b414d1b..26e5c0d 100755 --- a/libexec/sourcezap/scripts/setup-doas +++ b/libexec/sourcezap/scripts/setup-doas @@ -17,12 +17,21 @@ sharedir="${localbase}"/share/sourcezap src="${sharedir}"/doas.conf dest="${localbase}"/etc/doas.conf # shellcheck disable=SC2002 -cat "${src}" | -while read -r line; do - if grep -q "${line}" "${dest}"; then - continue - fi - cat "${src}" >> "${dest}" - printok "modified ${dest}" - break -done +if [ -e "${dest}" ]; then + cat "${src}" | + while read -r line; do + if grep -q "${line}" "${dest}"; then + continue + fi + cat "${src}" >> "${dest}" + printok "modified ${dest}" + break + done +else + install -m "u=rw,go=" \ + -o root \ + -g wheel \ + "${src}" \ + "${localbase}"/etc + printok "installed ${dest}" +fi diff --git a/share/sourcezap/CHANGELOG b/share/sourcezap/CHANGELOG index 8c1d539..035cf96 100644 --- a/share/sourcezap/CHANGELOG +++ b/share/sourcezap/CHANGELOG @@ -2,6 +2,11 @@ ** vNEXT +**** Try to install ~doas.conf~ when it does not exist +When ~${PREFIX}/etc/doas.conf~ does not exist the ~setup-doas~ +script will try to install ~/usr/local/etc/doas.conf~ with +~root:wheel~ as the owner, and with ~u=rw,go=~ as the filemode + **** Log when ~sourcezap rm~ completes successfully Similar to other commands, log when the ~sourcezap rm~ command completes successfully