-
Notifications
You must be signed in to change notification settings - Fork 0
/
termux.sh
64 lines (46 loc) · 1.38 KB
/
termux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -eu
trap cleanup EXIT
BINDIR="${PREFIX}/bin"
WGET_OPTS="-qO"
KUBO_VERSION="${KUBO_VERSION:-v0.26.0}"
KUBO_TARBALL="kubo_${KUBO_VERSION}_linux-arm64.tar.gz"
KUBO_URL="https://dist.ipfs.tech/kubo/${KUBO_VERSION}/${KUBO_TARBALL}"
GO_MA_ACTOR_VERSION="${GO_MA_ACTOR_VERSION:-v0.2.4}"
GO_MA_ACTOR="go-ma-actor-android-arm64"
GO_MA_ACTOR_URL="https://github.com/bahner/go-ma-actor/releases/download/${GO_MA_ACTOR_VERSION}/${GO_MA_ACTOR}.xz"
# These are for generating config
export GO_MA_ACTOR_ACTOR_NICK="${GO_MA_ACTOR_ACTOR_NICK:-termux}"
export GO_MA_ACTOR_API_MADDR="/ip4/127.0.0.1/tcp/5001"
cleanup() {
rm -rf "${GO_MA_ACTOR}"*
rm -rf "${KUBO_TARBALL}"*
}
install_wget() {
pkg install wget
}
install_ipfs() {
wget "${WGET_OPTS}" "${KUBO_TARBALL}" "${KUBO_URL}"
tar xf "${KUBO_TARBALL}"
mv kubo/ipfs "${BINDIR}"
rm -rf "${KUBO_TARBALL}" kubo
ipfs init || true
}
run_ipfs() {
ipfs daemon &> /dev/null || true &
}
install_actor() {
wget "${WGET_OPTS}" "${GO_MA_ACTOR}.xz" "${GO_MA_ACTOR_URL}"
xz -d "${GO_MA_ACTOR}.xz"
chmod +x "${GO_MA_ACTOR}"
mv "${GO_MA_ACTOR}" "${BINDIR}/actor"
}
generate_actor() {
actor --generate --publish || true # No --force. Idempotency, you know.
}
# Install ipfs if not already installed
ipfs version &> /dev/null || install_ipfs
run_ipfs
test -x "${BINDIR}/wget" || install_wget
install_actor
actor