aboutsummaryrefslogtreecommitdiff
path: root/mail/stalwart/files
diff options
context:
space:
mode:
Diffstat (limited to 'mail/stalwart/files')
-rw-r--r--mail/stalwart/files/patch-crates_cli_Cargo.toml19
-rw-r--r--mail/stalwart/files/patch-crates_main_Cargo.toml11
-rw-r--r--mail/stalwart/files/patch-crates_main_src_main.rs15
-rw-r--r--mail/stalwart/files/patch-tests_Cargo.toml9
-rw-r--r--mail/stalwart/files/patch-tests_src_lib.rs17
-rw-r--r--mail/stalwart/files/stalwart.in70
6 files changed, 141 insertions, 0 deletions
diff --git a/mail/stalwart/files/patch-crates_cli_Cargo.toml b/mail/stalwart/files/patch-crates_cli_Cargo.toml
new file mode 100644
index 000000000000..353d184aed13
--- /dev/null
+++ b/mail/stalwart/files/patch-crates_cli_Cargo.toml
@@ -0,0 +1,19 @@
+--- crates/cli/Cargo.toml.orig 2025-03-25 09:55:38 UTC
++++ crates/cli/Cargo.toml
+@@ -30,3 +30,16 @@ mail-auth = { version = "0.6" }
+ pwhash = "1.0.0"
+ rand = "0.9.0"
+ mail-auth = { version = "0.6" }
++
++[features]
++default = []
++sqlite = []
++foundationdb = []
++postgres = []
++mysql = []
++rocks = []
++elastic = []
++s3 = []
++redis = []
++azure = []
++enterprise = []
diff --git a/mail/stalwart/files/patch-crates_main_Cargo.toml b/mail/stalwart/files/patch-crates_main_Cargo.toml
new file mode 100644
index 000000000000..4f56d1534ebf
--- /dev/null
+++ b/mail/stalwart/files/patch-crates_main_Cargo.toml
@@ -0,0 +1,11 @@
+--- crates/main/Cargo.toml.orig 2025-01-28 10:08:11 UTC
++++ crates/main/Cargo.toml
+@@ -30,7 +30,7 @@ tokio = { version = "1.23", features = ["full"] }
+ utils = { path = "../utils" }
+ tokio = { version = "1.23", features = ["full"] }
+
+-[target.'cfg(not(target_env = "msvc"))'.dependencies]
++[target.'cfg(not(target_os = "freebsd"))'.dependencies]
+ jemallocator = "0.5.0"
+
+ [features]
diff --git a/mail/stalwart/files/patch-crates_main_src_main.rs b/mail/stalwart/files/patch-crates_main_src_main.rs
new file mode 100644
index 000000000000..c4d6b7224d27
--- /dev/null
+++ b/mail/stalwart/files/patch-crates_main_src_main.rs
@@ -0,0 +1,15 @@
+--- crates/main/src/main.rs.orig 2025-01-28 10:05:42 UTC
++++ crates/main/src/main.rs
+@@ -16,10 +16,10 @@ use utils::wait_for_shutdown;
+ use trc::Collector;
+ use utils::wait_for_shutdown;
+
+-#[cfg(not(target_env = "msvc"))]
++#[cfg(not(target_os = "freebsd"))]
+ use jemallocator::Jemalloc;
+
+-#[cfg(not(target_env = "msvc"))]
++#[cfg(not(target_os = "freebsd"))]
+ #[global_allocator]
+ static GLOBAL: Jemalloc = Jemalloc;
+
diff --git a/mail/stalwart/files/patch-tests_Cargo.toml b/mail/stalwart/files/patch-tests_Cargo.toml
new file mode 100644
index 000000000000..487a4e52c18b
--- /dev/null
+++ b/mail/stalwart/files/patch-tests_Cargo.toml
@@ -0,0 +1,9 @@
+--- tests/Cargo.toml.orig 2025-03-24 16:54:15 UTC
++++ tests/Cargo.toml
+@@ -67,5 +67,5 @@ form_urlencoded = "1.1.0"
+ biscuit = "0.7.0"
+ form_urlencoded = "1.1.0"
+
+-[target.'cfg(not(target_env = "msvc"))'.dependencies]
++[target.'cfg(not(target_os = "freebsd"))'.dependencies]
+ jemallocator = "0.5.0"
diff --git a/mail/stalwart/files/patch-tests_src_lib.rs b/mail/stalwart/files/patch-tests_src_lib.rs
new file mode 100644
index 000000000000..e75acaeaf2ad
--- /dev/null
+++ b/mail/stalwart/files/patch-tests_src_lib.rs
@@ -0,0 +1,17 @@
+--- tests/src/lib.rs.orig 2025-01-28 10:11:28 UTC
++++ tests/src/lib.rs
+@@ -6,12 +6,12 @@ use std::path::PathBuf;
+
+ use std::path::PathBuf;
+
+-#[cfg(not(target_env = "msvc"))]
++#[cfg(not(target_os = "freebsd"))]
+ use jemallocator::Jemalloc;
+ #[cfg(test)]
+ use trc::Collector;
+
+-#[cfg(not(target_env = "msvc"))]
++#[cfg(not(target_os = "freebsd"))]
+ #[global_allocator]
+ static GLOBAL: Jemalloc = Jemalloc;
+
diff --git a/mail/stalwart/files/stalwart.in b/mail/stalwart/files/stalwart.in
new file mode 100644
index 000000000000..7ecef0faf7f9
--- /dev/null
+++ b/mail/stalwart/files/stalwart.in
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# PROVIDE: stalwart
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name="stalwart"
+rcvar="stalwart_enable"
+
+load_rc_config stalwart
+
+: ${stalwart_enable:="NO"}
+: ${stalwart_user:="%%USERS%%"}
+: ${stalwart_group:="%%GROUPS%%"}
+: ${stalwart_config:="%%ETCDIR%%/config.toml"}
+: ${stalwart_log:="/var/log/stalwart.log"}
+: ${stalwart_path:="/var/db/stalwart"}
+
+pidfile="/var/run/stalwart/server.pid"
+procname="%%LOCALBASE%%/bin/stalwart"
+start_cmd="stalwart_start"
+start_precmd="stalwart_prestart"
+
+stalwart_env="STALWART_PATH=${stalwart_path} RUN_AS_USER=${stalwart_user} RUN_AS_GROUP=${stalwart_group}"
+
+stalwart_prestart() {
+ if [ ! -f "${stalwart_log}" ]; then
+ install -o ${stalwart_user} -g ${stalwart_group} -m 0640 /dev/null ${stalwart_log}
+ fi
+
+ if [ ! -d "/var/run/stalwart" ] ; then
+ install -d -o ${stalwart_user} -g ${stalwart_group} "/var/run/stalwart"
+ fi
+
+ # if empty, RocksDB needs to be initialized
+ if [ ! -d "${stalwart_path}" ] || [ -z "$(ls -A "${stalwart_path}" 2>/dev/null)" ]; then
+ stalwart_init
+ fi
+
+}
+
+stalwart_start()
+{
+ echo -n "Starting Stalwart: "
+
+ /usr/sbin/daemon -p ${pidfile} \
+ -T ${name} \
+ -o ${stalwart_log} \
+ ${procname} --config ${stalwart_config} \
+ ${stalwart_flags}
+
+ echo "done."
+}
+
+stalwart_init()
+{
+ mkdir -p ${stalwart_path}
+ /usr/bin/install -d -o ${stalwart_user} -g ${stalwart_group} -m 0755 ${stalwart_path}
+ # will tell user of a password it generated in the config we are throwing away
+ /usr/bin/su -m ${stalwart_user} -c "${procname} -I ${stalwart_path}" 2> /dev/null
+
+ # clean up autogenerated etc and logs directories we didn't want
+ rm -f ${stalwart_path}/etc/config.toml
+ rmdir ${stalwart_path}/etc
+ rmdir ${stalwart_path}/logs
+}
+
+run_rc_command "$1"