2018-10-23 11:45:14 +00:00
|
|
|
#!/bin/sh -e
|
2019-07-25 20:30:15 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ "$1" = configure ]; then
|
2019-10-29 18:34:01 +00:00
|
|
|
mkdir -p /etc/loki
|
|
|
|
datadir=/var/lib/lokinet
|
2019-12-16 03:20:08 +00:00
|
|
|
tn_datadir=/var/lib/lokinet/testnet
|
|
|
|
mkdir -p $datadir $tn_datadir
|
2019-10-29 18:34:01 +00:00
|
|
|
su -s /bin/sh _lokinet -c "test -O $datadir && test -G $datadir" || \
|
|
|
|
chown _lokinet:_loki $datadir
|
2019-12-16 03:20:08 +00:00
|
|
|
su -s /bin/sh _lokinet -c "test -O $tn_datadir && test -G $tn_datadir" || \
|
|
|
|
chown _lokinet:_loki $tn_datadir
|
2019-10-29 18:34:01 +00:00
|
|
|
|
|
|
|
if ! [ -e /var/lib/lokinet/bootstrap.signed ]; then
|
2019-12-16 03:20:08 +00:00
|
|
|
/usr/bin/lokinet-bootstrap lokinet /var/lib/lokinet/bootstrap.signed
|
2019-10-29 18:34:01 +00:00
|
|
|
chown _lokinet:_loki /var/lib/lokinet/bootstrap.signed
|
2019-07-25 20:30:15 +00:00
|
|
|
fi
|
|
|
|
|
2019-12-16 03:20:08 +00:00
|
|
|
if ! [ -e /var/lib/lokinet/testnet/bootstrap.signed ]; then
|
|
|
|
/usr/bin/lokinet-bootstrap testnet /var/lib/lokinet/testnet/bootstrap.signed
|
|
|
|
chown _lokinet:_loki /var/lib/lokinet/testnet/bootstrap.signed
|
|
|
|
fi
|
|
|
|
|
2019-10-29 18:34:01 +00:00
|
|
|
tmpdir=$(mktemp --tmpdir -d lokinet.XXXXXXXXXX)
|
|
|
|
/usr/bin/lokinet -g $tmpdir/lokinet.ini
|
2019-12-16 03:20:08 +00:00
|
|
|
sed -i -e "s#$tmpdir#$datadir#" $tmpdir/lokinet.ini
|
2019-10-29 18:34:01 +00:00
|
|
|
chmod 640 $tmpdir/lokinet.ini
|
|
|
|
chgrp _loki $tmpdir/lokinet.ini
|
|
|
|
ucf $tmpdir/lokinet.ini /etc/loki/lokinet.ini
|
|
|
|
ucfr lokinet /etc/loki/lokinet.ini
|
2019-07-25 20:30:15 +00:00
|
|
|
|
2019-12-16 03:20:08 +00:00
|
|
|
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
|
|
|
|
|
2019-10-29 18:34:01 +00:00
|
|
|
if [ -x /bin/systemctl ] && /bin/systemctl --quiet is-active systemd-resolved.service; then
|
|
|
|
/bin/systemctl restart systemd-resolved.service
|
2019-07-26 21:13:06 +00:00
|
|
|
fi
|
2019-07-25 20:30:15 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
#DEBHELPER#
|