2020-04-10 19:17:11 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-04-14 21:48:33 +00:00
|
|
|
PERMS_OWNER=root
|
|
|
|
PERMS_GROUP=admin
|
|
|
|
CHOWN=$PERMS_OWNER:$PERMS_GROUP
|
|
|
|
|
2020-04-10 19:17:11 +00:00
|
|
|
# set up lokinet data dir
|
|
|
|
[ -e /var/lib/lokinet/ ] || mkdir /var/lib/lokinet
|
2020-04-14 21:48:33 +00:00
|
|
|
chown $CHOWN /var/lib/lokinet
|
|
|
|
chmod g+w /var/lib/lokinet
|
|
|
|
|
|
|
|
# mv files copied into $INSTALL_PREFIX/extra/ to their proper locations
|
2020-04-18 21:51:33 +00:00
|
|
|
mv /opt/lokinet/extra/lokinet_macos_daemon_script.sh /var/lib/lokinet
|
2020-04-14 21:48:33 +00:00
|
|
|
chown $CHOWN /var/lib/lokinet/lokinet_macos_daemon_script.sh
|
|
|
|
chmod 770 /var/lib/lokinet/lokinet_macos_daemon_script.sh
|
|
|
|
|
2020-04-18 21:51:33 +00:00
|
|
|
mv /opt/lokinet/extra/network.loki.lokinet.daemon.plist /Library/LaunchDaemons/
|
2020-04-14 21:48:33 +00:00
|
|
|
chown $CHOWN /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
|
|
|
|
chmod 640 /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
|
|
|
|
|
|
|
|
# clean up by removing 'extra/' (so long as it's empty)
|
2020-04-18 21:51:33 +00:00
|
|
|
rmdir /opt/lokinet/extra/
|
2020-04-14 21:48:33 +00:00
|
|
|
|
2020-04-10 19:17:11 +00:00
|
|
|
# bootstrap
|
2020-04-18 21:51:33 +00:00
|
|
|
/opt/lokinet/bin/lokinet-bootstrap mainnet /var/lib/lokinet/bootstrap.signed
|
2020-04-14 21:48:33 +00:00
|
|
|
chown $CHOWN /var/lib/lokinet/bootstrap.signed
|
|
|
|
|
2020-04-10 19:17:11 +00:00
|
|
|
# generate configs
|
2020-04-18 21:51:33 +00:00
|
|
|
/opt/lokinet/bin/lokinet -g /var/lib/lokinet/lokinet.ini
|
2020-04-14 21:48:33 +00:00
|
|
|
chown $CHOWN /var/lib/lokinet/lokinet.ini
|
|
|
|
|
|
|
|
# register with launchd and start
|
|
|
|
launchctl load /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
|
|
|
|
launchctl start network.loki.lokinet.daemon
|