lokinet/debian/lokinet.postinst
Jason Rhinelander 2cdf051fd5 Bundle default bootstrap.signed in deb
This avoids needing to download it on install, and matches what we do
now on mac/win.
2021-09-08 21:51:48 -03:00

37 lines
1.2 KiB
Bash

#!/bin/sh -e
set -e
if [ "$1" = configure ]; then
mkdir -p /etc/loki
datadir=/var/lib/lokinet
tn_datadir=/var/lib/lokinet/testnet
mkdir -p $datadir $tn_datadir
su -s /bin/sh _lokinet -c "test -O $datadir && test -G $datadir" || \
chown _lokinet:_loki $datadir
su -s /bin/sh _lokinet -c "test -O $tn_datadir && test -G $tn_datadir" || \
chown _lokinet:_loki $tn_datadir
tmpdir=$(mktemp --tmpdir -d lokinet.XXXXXXXXXX)
/usr/bin/lokinet -g $tmpdir/lokinet.ini
sed -i -e "s#$tmpdir#$datadir#" $tmpdir/lokinet.ini
chmod 640 $tmpdir/lokinet.ini
chgrp _loki $tmpdir/lokinet.ini
ucf $tmpdir/lokinet.ini /etc/loki/lokinet.ini
ucfr lokinet /etc/loki/lokinet.ini
tmpdir=$(mktemp --tmpdir -d lokinet.XXXXXXXXXX)
/usr/bin/lokinet -g $tmpdir/lokinet.ini
sed -i -e "s#$tmpdir#$tn_datadir#" $tmpdir/lokinet.ini
chmod 640 $tmpdir/lokinet.ini
chgrp _loki $tmpdir/lokinet.ini
ucf $tmpdir/lokinet.ini /etc/loki/lokinet-testnet.ini
ucfr lokinet /etc/loki/lokinet-testnet.ini
if [ -x /bin/systemctl ] && /bin/systemctl --quiet is-active systemd-resolved.service; then
/bin/systemctl restart systemd-resolved.service
fi
fi
#DEBHELPER#