mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-01 04:33:56 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1 @@
|
||||
config smtp 'default'
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
|
||||
START=90
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
validate_section() {
|
||||
uci_validate_section mail smtp "${1}" \
|
||||
'server:host' \
|
||||
'tls:bool:0' \
|
||||
'tls_starttls:bool:0' \
|
||||
'from:string' \
|
||||
'user:string' \
|
||||
'password:string' \
|
||||
'port:port:25'
|
||||
}
|
||||
|
||||
config_account() {
|
||||
local server tls tls_starttls from user password
|
||||
|
||||
validate_section "${1}" || {
|
||||
_err "validation failed"
|
||||
return 1
|
||||
}
|
||||
|
||||
cat > /tmp/msmtp.tmp <<-EOF
|
||||
account default
|
||||
host $server
|
||||
port $port
|
||||
EOF
|
||||
[ -n "$user" ] && [ -n "$password" ] && {
|
||||
cat >> /tmp/msmtp.tmp <<-EOF
|
||||
auth on
|
||||
user $user
|
||||
password $password
|
||||
EOF
|
||||
}
|
||||
[ -n "$from" ] && echo "from $from" >> /tmp/msmtp.tmp
|
||||
[ "$tls" = "1" ] && {
|
||||
cat >> /tmp/msmtp.tmp <<-EOF
|
||||
tls_trust_file /etc/ssl/certs/ca-certificates.crt
|
||||
tls on
|
||||
EOF
|
||||
} || {
|
||||
echo 'tls off' >> /tmp/msmtp.tmp
|
||||
}
|
||||
[ "$tls_starttls" = "1" ] && {
|
||||
echo 'tls_starttls on' >> /tmp/msmtp.tmp
|
||||
} || {
|
||||
echo 'tls_starttls off' >> /tmp/msmtp.tmp
|
||||
}
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load mail
|
||||
config_foreach config_account smtp
|
||||
[ -f "/tmp/msmtp.tmp" ] && mv /tmp/msmtp.tmp /etc/msmtprc
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger mail
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-mail.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-mail.json << EEOF
|
||||
{
|
||||
"config": "mail",
|
||||
"init": "mail"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@mail[-1]
|
||||
add ucitrack mail
|
||||
set ucitrack.@mail[-1].init=mail
|
||||
commit ucitrack
|
||||
EOF
|
||||
exit 0
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"admin/services/mail": {
|
||||
"title": "E-Mail",
|
||||
"order": 90,
|
||||
"action": {
|
||||
"type": "cbi",
|
||||
"path": "mail"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-mail" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-mail": {
|
||||
"description": "Grant UCI access for luci-app-mail",
|
||||
"read": {
|
||||
"uci": [ "mail" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "mail" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user