mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-05 08:17:14 +02:00
33 lines
853 B
Bash
33 lines
853 B
Bash
#!/sbin/openrc-run
|
|
|
|
name="stalwart-mail"
|
|
description="Stalwart mail server"
|
|
supervisor="supervise-daemon"
|
|
command="/usr/bin/stalwart-mail"
|
|
command_user="${command_user:-stalwart:stalwart}"
|
|
command_args_foreground="--config $CONF_DIR/config.toml"
|
|
capabilities="^cap_net_bind_service"
|
|
|
|
depend() {
|
|
need localmount net
|
|
after firewall
|
|
before provide mta
|
|
}
|
|
|
|
start_pre() {
|
|
checkpath -m 0755 -d -o "$command_user" "$DATA_DIR"
|
|
checkpath -m 0755 -d -o "$command_user" "$CONF_DIR"
|
|
checkpath -m 0755 -d -o "$command_user" "$LOG_DIR"
|
|
|
|
if [ ! -f "$CONF_DIR"/config.toml ]; then
|
|
stalwart-mail --init "$DATA_DIR" 2> >(grep password)
|
|
chown "$command_user" "$DATA_DIR"/data
|
|
mv "$DATA_DIR"/etc/config.toml \
|
|
"$CONF_DIR"/config.toml
|
|
sed -i 's:lib/stalwart/logs:log/stalwart:g' \
|
|
"$CONF_DIR"/config.toml
|
|
rmdir "$DATA_DIR"/logs "$DATA_DIR"/etc
|
|
fi
|
|
|
|
}
|
|
|