summaryrefslogtreecommitdiff
path: root/repo/doas/doas.post-install
blob: 65c3cff4681dc512530ccbdc52b7f56fea135f4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

[ -d /etc/doas.d ] || install -d -m 0750 /etc/doas.d
[ -e /etc/doas.d/doas.conf ] && exit 0

cat << _EOF_ >/etc/doas.d/doas.conf
# This file is actually located at /etc/doas.d/doas.conf, and reflects
# the system doas configuration.  It may have been migrated from its
# previous location, /etc/doas.conf, automatically.
_EOF_

if [ -f /etc/doas.conf ]; then
	cat /etc/doas.conf >> /etc/doas.d/doas.conf
	cat << _EOF_ >> /etc/doas.d/doas.conf
# Please see /usr/share/doc/doas/doas.conf.example in the doas-doc
# package for configuration examples.
_EOF_

	# install compatibility symlink
	rm -f /etc/doas.conf
	ln -sf /etc/doas.d/doas.conf /etc/doas.conf

	# chmod 600
	chmod 600 /etc/doas.d/doas.conf

	cat <<- _EOF_ >&2
	 * Your configuration in /etc/doas.conf was migrated to
	 * /etc/doas.d/doas.conf and a symlink was installed in its
	 * place.  For more information about the new doas configuration
	 * directory, consult doas.d(5).
	_EOF_
fi