lokinet/osx-setup/scripts/postinstall

28 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/bin/sh
echo "Running postinstall" > /tmp/lokinet_postinstall.log
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
rm $HOME/.lokinet/*.signed >> /tmp/lokinet_postinstall.log
rm $HOME/.lokinet/*.key >> /tmp/lokinet_postinstall.log
rm $HOME/.lokinet/*.private >> /tmp/lokinet_postinstall.log
rm -fr $HOME/.lokinet/netdb >> /tmp/lokinet_postinstall.log
url="https://i2p.rocks/i2procks.signed"
echo "downloading $url" >> /tmp/lokinet_postinstall.log
echo "to $HOME/.lokinet/bootstrap.signed" >> /tmp/lokinet_postinstall.log
# use temp file to not overrwrite existing bootstrap file on fail
tmp=/tmp/bootstrap.tmp
# MacOS does not have wget without homebrew but does have curl
# Rick also had indicated most BSDs have curl too
curl "$url" > "$tmp" && \
(mv "$tmp" "$HOME/.lokinet/bootstrap.signed" && echo "${GREEN}lokinet successfully bootstrapped${NC}" >> /tmp/lokinet_postinstall.log) \
|| echo "${RED}failed to download bootstrap from $url${NC}" >> /tmp/lokinet_postinstall.log
rm -f "$tmp"
exit 0 # all good