Allow to customize VARLIBDIR at build
This commit is contained in:
parent
838981a4a9
commit
5a403eccae
4 changed files with 24 additions and 1 deletions
13
README.md
13
README.md
|
@ -12,6 +12,19 @@ DKIM filter for [OpenSMTPD](https://www.opensmtpd.org/).
|
|||
This is a work in progress, it is not supposed to work yet.
|
||||
|
||||
|
||||
## Building and packaging
|
||||
|
||||
```
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
Packagers may want to set the `VARLIBDIR` to a custom value (default is `/var/lib`):
|
||||
|
||||
```
|
||||
VARLIBDIR="/usr/local/var/lib" cargo build --release
|
||||
```
|
||||
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Does this filter signs outgoing emails using DKIM or check the DKIM signature of incoming emails?
|
||||
|
|
9
build.rs
Normal file
9
build.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
use std::env;
|
||||
|
||||
const DEFAULT_VARLIBDIR: &str = "/var/lib/";
|
||||
|
||||
fn main() {
|
||||
if let Err(_) = env::var("VARLIBDIR") {
|
||||
println!("cargo:rustc-env={}={}", "VARLIBDIR", DEFAULT_VARLIBDIR);
|
||||
}
|
||||
}
|
|
@ -109,6 +109,7 @@ fn process_key_data_base(opt: Option<PathBuf>) -> Option<PathBuf> {
|
|||
Some(p) => Some(p),
|
||||
None => {
|
||||
let mut path = PathBuf::from(crate::DEFAULT_LIB_DIR);
|
||||
path.push(env!("CARGO_PKG_NAME"));
|
||||
path.push(crate::DEFAULT_CNF_KEY_DB);
|
||||
Some(path)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ const DEFAULT_CNF_HEADERS: &str = "from:reply-to:subject:date:to:cc";
|
|||
const DEFAULT_CNF_HEADERS_OPT: &str = "resent-date:resent-from:resent-to:resent-cc:in-reply-to:references:list-id:list-help:list-unsubscribe:list-subscribe:list-post:list-owner:list-archive";
|
||||
const DEFAULT_CNF_KEY_DB: &str = "key-db.sqlite3";
|
||||
const DEFAULT_CNF_REVOCATION: u64 = 1728000;
|
||||
const DEFAULT_LIB_DIR: &str = "/var/lib/opensmtpd-filter-dkimout";
|
||||
const DEFAULT_LIB_DIR: &str = env!("VARLIBDIR");
|
||||
const DEFAULT_MSG_SIZE: usize = 1024 * 1024;
|
||||
const LOG_LEVEL_ENV_VAR: &str = "OPENSMTPD_FILTER_DKIMOUT_LOG_LEVEL";
|
||||
|
||||
|
|
Loading…
Reference in a new issue