Inline function in setup-doas
This commit is contained in:
parent
1822c14e63
commit
bf7cc3627e
1 changed files with 10 additions and 15 deletions
|
@ -4,25 +4,20 @@ set -e
|
||||||
##
|
##
|
||||||
# variables
|
# variables
|
||||||
localbase=$(realpath "$(dirname "$0")"/../../..)
|
localbase=$(realpath "$(dirname "$0")"/../../..)
|
||||||
libexec="${localbase}/libexec/portzap"
|
libexec="${localbase}"/libexec/portzap
|
||||||
sharedir="${localbase}/share/portzap"
|
sharedir="${localbase}"/share/portzap
|
||||||
|
|
||||||
##
|
##
|
||||||
# functions
|
# functions
|
||||||
. "${libexec}"/functions/print.sh
|
. "${libexec}"/functions/print.sh
|
||||||
|
|
||||||
install_doasconf()
|
|
||||||
{
|
|
||||||
src="${sharedir}/doas.conf"
|
|
||||||
dest="${localbase}/etc/doas.conf"
|
|
||||||
if grep -Fq "$(cat "${src}")" "${dest}"; then
|
|
||||||
printok "doas.conf is up to date"
|
|
||||||
else
|
|
||||||
cat "${src}" >> "${dest}"
|
|
||||||
printok "${dest} updated"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
install_doasconf
|
src="${sharedir}"/doas.conf
|
||||||
|
dest="${localbase}"/etc/doas.conf
|
||||||
|
if grep -Fq "$(cat "${src}")" "${dest}"; then
|
||||||
|
printok "doas.conf is up to date"
|
||||||
|
else
|
||||||
|
cat "${src}" >> "${dest}"
|
||||||
|
printok "${dest} updated"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue