feat: add Stalwart Mail Server and FoundationDB library packages
Build / build-8 (pull_request) Successful in 58s
Build / build-9 (pull_request) Successful in 2m17s

- add stalwart: main mail server with systemd integration and user management
- add stalwart-cli: command line interface tool for server administration
- add stalwart-foundationdb: FoundationDB-enabled version with proper dependencies
- add libfoundationdb: FoundationDB client library (libfdb_c.so) package

All packages include proper conflict resolution, systemd services, and follow
repository packaging conventions. stalwart and stalwart-foundationdb are
mutually exclusive to prevent installation conflicts.
This commit is contained in:
2025-10-19 17:38:55 +11:00
parent fdf9a11a4c
commit e07235ca98
31 changed files with 556 additions and 0 deletions
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Create default configuration if it doesn't exist
if [ ! -f /opt/stalwart/etc/config.toml ]; then
cat > /opt/stalwart/etc/config.toml << 'EOF'
# Stalwart Mail Server Configuration
# This is a minimal configuration file. Please customize according to your needs.
# Full documentation: https://stalw.art/docs/
[server]
hostname = "localhost"
[server.listener.smtp]
bind = ["127.0.0.1:25"]
protocol = "smtp"
[server.listener.submission]
bind = ["127.0.0.1:587"]
protocol = "smtp"
[server.listener.imap]
bind = ["127.0.0.1:143"]
protocol = "imap"
[server.listener.http]
bind = ["127.0.0.1:8080"]
protocol = "http"
[storage]
data = "sqlite"
fts = "sqlite"
blob = "fs"
lookup = "sqlite"
directory = "internal"
[store."sqlite"]
type = "sqlite"
path = "/var/lib/stalwart/stalwart.db"
[store."fs"]
type = "fs"
path = "/var/lib/stalwart/blobs"
[directory."internal"]
type = "internal"
store = "sqlite"
EOF
chown stalwart:stalwart /opt/stalwart/etc/config.toml
chmod 600 /opt/stalwart/etc/config.toml
fi
# Reload systemd
systemctl daemon-reload
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Reload systemd after service file removal
systemctl daemon-reload
# Note: We don't remove user data, logs, or configuration files
# to preserve user data in case of reinstallation
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Create stalwart user and group
if ! getent group stalwart >/dev/null; then
groupadd -r stalwart
fi
if ! getent passwd stalwart >/dev/null; then
useradd -r -g stalwart -d /opt/stalwart -s /sbin/nologin -c "Stalwart Mail Server" stalwart
fi
# Create required directories
mkdir -p /opt/stalwart/{bin,etc,data,logs}
mkdir -p /var/lib/stalwart
mkdir -p /var/log/stalwart
# Set ownership
chown -R stalwart:stalwart /opt/stalwart
chown -R stalwart:stalwart /var/lib/stalwart
chown -R stalwart:stalwart /var/log/stalwart
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Stop and disable the service if it's running
if systemctl is-enabled stalwart.service >/dev/null 2>&1; then
systemctl stop stalwart.service
systemctl disable stalwart.service
fi