summaryrefslogtreecommitdiff
path: root/repo/doas/doas.post-upgrade
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-06-04 15:08:04 +0100
committerdavidovski <david@davidovski.xyz>2022-06-04 15:08:04 +0100
commit873665024ebfaa761ee49b508a79db7178aeb778 (patch)
tree6cd3b4ce3a9f4b0586ffa48e73a6ba4c8da2db43 /repo/doas/doas.post-upgrade
parent4445f6e15185f58dc599390ab74df3ca19b437b7 (diff)
added gnupg
Diffstat (limited to 'repo/doas/doas.post-upgrade')
-rwxr-xr-xrepo/doas/doas.post-upgrade37
1 files changed, 37 insertions, 0 deletions
diff --git a/repo/doas/doas.post-upgrade b/repo/doas/doas.post-upgrade
new file mode 100755
index 0000000..731b351
--- /dev/null
+++ b/repo/doas/doas.post-upgrade
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+[ -d /etc/doas.d ] || install -d -m 0750 /etc/doas.d
+# fix perms when upgrading from 6.8.1-r6
+if [ -d /etc/doas.d ] && [ "$(stat -c "%a" /etc/doas.d)" = "755" ]; then
+ chmod 0750 /etc/doas.d
+fi
+
+[ -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_
+fi
+
+# 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_