Use environment variables in initsystem launch to configure email. Will fail by default if an email is not configured.

This commit is contained in:
idk
2021-12-03 14:41:49 -05:00
parent 694b2a67c0
commit 641eb5dfa4
5 changed files with 13 additions and 4 deletions

View File

@@ -64,8 +64,11 @@ tar:
install:
install -m755 reseed-tools-$(GOOS)-$(GOARCH) /usr/bin/reseed-tools
install -m644 etc/default/reseed /etc/default/reseed
install -m755 etc/init.d/reseed /etc/init.d/reseed
install -m644 etc/systemd/system/reseed.service /etc/systemd/system/reseed.service
mkdir -p /etc/systemd/system/reseed.d/
install -m644 etc/systemd/system/reseed.d/reseed.conf /etc/systemd/system/reseed.d/reseed.conf
install -m644 etc/systemd/system/reseed.d/reseed.service /etc/systemd/system/reseed.d/reseed.service
### You shouldn't need to use these now that the go mod require rule is fixed,
## but I'm leaving them in here because it made it easier to test that both

2
etc/default/reseed Normal file
View File

@@ -0,0 +1,2 @@
#Edit the contact/signing email used by your reseed server here
export RESEED_EMAIL=""

View File

@@ -12,12 +12,11 @@ SCRIPT='/usr/bin/reseed-tools'
RUNAS=i2psvc
NETDBDIR=/var/lib/i2p/i2p-config/netDb
RUNDIR=/var/lib/i2p/i2p-config/reseed
SIGNER=you@mail.i2p
MORE_OPTIONS=""
if [ -f /etc/default/reseed ]; then
. /etc/default/reseed
fi
RUNOPTS=" reseed --yes=true --signer=$SIGNER --netdb=$NETDBDIR $MORE_OPTIONS "
RUNOPTS=" reseed --yes=true --netdb=$NETDBDIR $MORE_OPTIONS "
start() {
start-stop-daemon --user $RUNAS --exec $SCRIPT --chdir $RUNDIR --make-pidfile $RUNDIR/reseed.pid --start -- $RUNOPTS

View File

@@ -0,0 +1,5 @@
# Use this file to configure the contact/signer email used for the reseed service.
# without it the reseed will fail to start.
[Service]
Environment="RESEED_EMAIL="

View File

@@ -7,7 +7,7 @@ Requires=i2p.service
[Service]
User=i2psvc
WorkingDirectory=/var/lib/i2p/i2p-config/reseed
ExecStart=/usr/bin/reseed-tools --yes=true --signer=you@mail.i2p --netdb=/var/lib/i2p/i2p-config/netDb
ExecStart=/usr/bin/reseed-tools --yes=true --netdb=/var/lib/i2p/i2p-config/netDb
Restart=always
RestartSec=10
RuntimeMaxSec=43200