mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-17 15:25:35 +00:00
503b4cb258
This avoids needing to download it on install, and matches what we do now on mac/win.
37 lines
1.2 KiB
Bash
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#
|