make systemd service configurable via /etc/infnoise.conf

This commit is contained in:
Manuel Domke
2017-12-31 18:11:27 +01:00
parent e22753d078
commit 81f1c15995
5 changed files with 16 additions and 6 deletions

View File

@@ -290,8 +290,8 @@ int main(int argc, char **argv)
xArg++;
opts.serial = argv[xArg];
if(opts.serial == NULL || !strcmp("",opts.serial)) {
fputs("--serial without value\n", stderr);
return 1;
opts.serial = NULL;
fputs("WARNING: --serial without value\n", stderr);
}
} else if(!strcmp(argv[xArg], "--daemon")) {
opts.daemon = true;

View File

@@ -14,6 +14,7 @@ which start the service when the Infinite Noise TRNG is connected and also stops
- `infnoise.openrc`: OpenRC, ?
- `infnoise.conf`: Upstart, tested in Ubuntu 14.04, 16.04 (requires upstart install)
- `infnoise.service`: Systemd, works for CentOS, Ubuntu, Debian, ArchLinux
- `infnoise.service.bin`: Same as infnoise.service, binary path = /usr/bin/
- `infnoise.service.sbin`: Same as infnoise.service, binary path = /usr/sbin/
- `infnoise.service.bin`: Same as infnoise.service, binary path = /usr/bin/ - uses config file from /etc/infnoise.conf
- `infnoise.service.sbin`: Same as infnoise.service, binary path = /usr/sbin/ - uses config file from /etc/infnoise.conf
- `infnoise.conf.systemd`: Config file for the systemd service, to set multiplier and serial number of device
- `75-infnoise.rules`: udev rule to be used together with the systemd service

View File

@@ -0,0 +1,7 @@
# systemd configuration file for the Infinite Noise TRNG
INFNOISE_MULTIPLIER=1
# keccak multiplier, default = 1
INFNOISE_SERIAL=
# serial number of device, default: ""

View File

@@ -4,9 +4,10 @@ BindsTo=dev-infnoise.device
After=dev-infnoise.device
[Service]
EnvironmentFile=/etc/infnoise.conf
Type=forking
WorkingDirectory=/tmp
ExecStart=/usr/bin/infnoise --dev-random --daemon --pidfile /var/run/infnoise.pid
ExecStart=/usr/bin/infnoise --dev-random --daemon --pidfile /var/run/infnoise.pid --multiplier ${INFNOISE_MULTIPLIER} --serial ${INFNOISE_SERIAL}
User=root
Group=root
Restart=always

View File

@@ -4,9 +4,10 @@ BindsTo=dev-infnoise.device
After=dev-infnoise.device
[Service]
EnvironmentFile=/etc/infnoise.conf
Type=forking
WorkingDirectory=/tmp
ExecStart=/usr/sbin/infnoise --dev-random --daemon --pidfile /var/run/infnoise.pid
ExecStart=/usr/sbin/infnoise --dev-random --daemon --pidfile /var/run/infnoise.pid --multiplier ${INFNOISE_MULTIPLIER} --serial ${INFNOISE_SERIAL}
User=root
Group=root
Restart=always