mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-03 23:15:52 +00:00
4561c8c651
The regex replacement was broken, leaving it at enabled=false.
54 lines
1.9 KiB
Bash
54 lines
1.9 KiB
Bash
#!/bin/sh -e
|
|
|
|
set -e
|
|
|
|
if [ "$1" = configure ]; then
|
|
mkdir -p /etc/loki
|
|
datadir=/var/lib/lokinet/router
|
|
tn_datadir=/var/lib/lokinet/testnet-router
|
|
mkdir -p $datadir $tn_datadir /var/lib/lokinet/testnet
|
|
for d in $datadir $tn_datadir /var/lib/lokinet/testnet; do
|
|
su -s /bin/sh _lokinet -c "test -O $d && test -G $d" || \
|
|
chown _lokinet:_loki $d
|
|
done
|
|
|
|
if ! [ -e /var/lib/lokinet/bootstrap.signed ]; then
|
|
/usr/bin/lokinet-bootstrap lokinet /var/lib/lokinet/bootstrap.signed
|
|
chown _lokinet:_loki /var/lib/lokinet/bootstrap.signed
|
|
fi
|
|
|
|
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
|
|
|
|
tmpdir=$(mktemp --tmpdir -d lokinet.XXXXXXXXXX)
|
|
/usr/bin/lokinet -r $tmpdir/lokinet.ini
|
|
perl -pi -e "
|
|
s#$tmpdir#$datadir#;
|
|
s#$datadir/bootstrap.signed#/var/lib/lokinet/bootstrap.signed#;
|
|
if (/^\[lokid/ ... /^\[/) {
|
|
s#enabled=false#enabled=true#;
|
|
}" $tmpdir/lokinet.ini
|
|
chmod 640 $tmpdir/lokinet.ini
|
|
chgrp _loki $tmpdir/lokinet.ini
|
|
ucf $tmpdir/lokinet.ini /etc/loki/lokinet-router.ini
|
|
ucfr lokinet /etc/loki/lokinet-router.ini
|
|
|
|
tmpdir=$(mktemp --tmpdir -d lokinet.XXXXXXXXXX)
|
|
/usr/bin/lokinet -r $tmpdir/lokinet.ini
|
|
perl -pi -e "
|
|
s#$tmpdir#$tn_datadir#;
|
|
s#$tn_datadir/bootstrap.signed#/var/lib/lokinet/testnet/bootstrap.signed#;
|
|
if (/^\[lokid/ ... /^\[/) {
|
|
s#enabled=false#enabled=true#;
|
|
s#jsonrpc=127\.0\.0\.1:22023#jsonrpc=127.0.0.1:38157#;
|
|
}" $tmpdir/lokinet.ini
|
|
chmod 640 $tmpdir/lokinet.ini
|
|
chgrp _loki $tmpdir/lokinet.ini
|
|
ucf $tmpdir/lokinet.ini /etc/loki/lokinet-testnet-router.ini
|
|
ucfr lokinet /etc/loki/lokinet-testnet-router.ini
|
|
fi
|
|
|
|
#DEBHELPER#
|