feat: add Stalwart Mail Server and FoundationDB library packages
- 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:
@@ -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 with FoundationDB
|
||||
# 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 = "foundationdb"
|
||||
fts = "foundationdb"
|
||||
blob = "fs"
|
||||
lookup = "foundationdb"
|
||||
directory = "internal"
|
||||
|
||||
[store."foundationdb"]
|
||||
type = "foundationdb"
|
||||
cluster = "/etc/foundationdb/fdb.cluster"
|
||||
|
||||
[store."fs"]
|
||||
type = "fs"
|
||||
path = "/var/lib/stalwart/blobs"
|
||||
|
||||
[directory."internal"]
|
||||
type = "internal"
|
||||
store = "foundationdb"
|
||||
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-foundationdb.service >/dev/null 2>&1; then
|
||||
systemctl stop stalwart-foundationdb.service
|
||||
systemctl disable stalwart-foundationdb.service
|
||||
fi
|
||||
Reference in New Issue
Block a user