diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -58,6 +58,7 @@ netif \ netoptions \ netwait \ + newaliases \ newsyslog \ nfsclient \ nfscbd \ diff --git a/libexec/rc/rc.d/newaliases b/libexec/rc/rc.d/newaliases new file mode 100644 --- /dev/null +++ b/libexec/rc/rc.d/newaliases @@ -0,0 +1,35 @@ +#!/bin/sh +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2025 SRI International +# +# This software was developed by SRI International, the University of +# Cambridge Computer Laboratory (Department of Computer Science and +# Technology), and Capabilities Limited under Defense Advanced Research +# Projects Agency (DARPA) Contract No. FA8750-24-C-B047 ("DEC"). +# + +# PROVIDE: newaliases +# REQUIRE: FILESYSTEMS +# BEFORE: mail +# KEYWORD: firstboot + +. /etc/rc.subr + +name="newaliases" +desc="Create email aliases database if required" +required_files="/etc/mail/aliases" +start_cmd="newaliases_start" +stop_cmd=":" + +load_rc_config $name + +newaliases_start() +{ + if [ ! -f "/etc/mail/aliases.db" ]; then + /usr/bin/newaliases + fi +} + +run_rc_command "$1"