2018-11-13 13:37:35 +00:00
|
|
|
#!/usr/bin/env bash
|
2018-10-23 11:51:11 +00:00
|
|
|
# this shell script will be replaced by a proper program in the future (probably)
|
|
|
|
#
|
|
|
|
|
2018-12-18 05:52:34 +00:00
|
|
|
RED='\033[0;31m'
|
|
|
|
GREEN='\033[0;32m'
|
|
|
|
NC='\033[0m' # No Color
|
|
|
|
|
2018-12-08 04:37:48 +00:00
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
|
|
|
url="https://i2p.rocks/i2procks.signed"
|
|
|
|
else
|
|
|
|
url="$1"
|
|
|
|
fi
|
|
|
|
|
2018-10-23 11:51:11 +00:00
|
|
|
echo "downloading $url"
|
2018-12-08 04:37:48 +00:00
|
|
|
|
|
|
|
if [ ! -d "$HOME/.lokinet" ]
|
|
|
|
then
|
2018-11-21 03:07:34 +00:00
|
|
|
mkdir $HOME/.lokinet
|
|
|
|
fi
|
2018-12-08 04:37:48 +00:00
|
|
|
|
2019-01-07 11:37:15 +00:00
|
|
|
# use temp file to not overrwrite existing bootstrap file on fail
|
|
|
|
tmp=mktemp
|
|
|
|
|
2018-12-18 05:52:34 +00:00
|
|
|
# MacOS does not have wget without homebrew but does have curl
|
|
|
|
# Rick also had indicated most BSDs have curl too
|
2019-01-07 11:37:15 +00:00
|
|
|
curl "$url" > "$tmp" && \
|
|
|
|
(mv "$tmp" "$HOME/.lokinet/bootstrap.signed" && echo -e "${GREEN}lokinet successfully bootstrapped${NC}" ) \
|
|
|
|
|| echo -e "${RED}failed to download bootstrap from $url${NC}"
|
|
|
|
rm -f "$tmp"
|