forked from DreamLab-AI/origin-logseq-AR
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathinstall-termux.sh
More file actions
executable file
·81 lines (71 loc) · 2.65 KB
/
install-termux.sh
File metadata and controls
executable file
·81 lines (71 loc) · 2.65 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/data/data/com.termux/files/usr/bin/bash
#
# PhonePod Installer for Termux
#
# Usage:
# curl -sL https://raw.githubusercontent.com/JavaScriptSolidServer/JavaScriptSolidServer/gh-pages/scripts/install-termux.sh | bash
#
set -e
echo ""
echo " ╔═══════════════════════════════════════╗"
echo " ║ PhonePod Installer ║"
echo " ║ Solid + Nostr + Git on your phone ║"
echo " ╚═══════════════════════════════════════╝"
echo ""
# Check we're in Termux
if [ ! -d "/data/data/com.termux" ]; then
echo "✗ This script is for Termux on Android"
echo " Install Termux from F-Droid: https://f-droid.org/packages/com.termux/"
exit 1
fi
echo "→ Installing dependencies..."
pkg update -y
pkg install -y nodejs-lts openssh autossh git
echo "→ Installing PM2 and JSS..."
npm install -g pm2 javascript-solid-server
# Fix PATH for npm global bins
NPM_BIN="$(npm config get prefix)/bin"
if [[ ":$PATH:" != *":$NPM_BIN:"* ]]; then
echo "export PATH=\"\$PATH:$NPM_BIN\"" >> ~/.bashrc
export PATH="$PATH:$NPM_BIN"
fi
echo "→ Setting up boot persistence..."
mkdir -p ~/.termux/boot
cat > ~/.termux/boot/start-pod.sh << 'BOOT'
#!/data/data/com.termux/files/usr/bin/bash
# Start PhonePod on boot
termux-wake-lock
export PATH="$PATH:$(npm config get prefix)/bin"
pm2 resurrect
BOOT
chmod +x ~/.termux/boot/start-pod.sh
echo "→ Starting JSS..."
pm2 start jss -- start --port 8080 --nostr --git
pm2 save
# Get local IP
LOCAL_IP=$(ip route get 1 2>/dev/null | awk '{print $7}' | head -1)
echo ""
echo " ╔═══════════════════════════════════════╗"
echo " ║ ✓ PhonePod Installed! ║"
echo " ╚═══════════════════════════════════════╝"
echo ""
echo " Local: http://localhost:8080"
if [ -n "$LOCAL_IP" ]; then
echo " Network: http://$LOCAL_IP:8080"
fi
echo ""
echo " Features enabled:"
echo " • Solid pod (LDP, WAC, WebID)"
echo " • Nostr relay (wss://localhost:8080/relay)"
echo " • Git server (git clone http://localhost:8080/)"
echo ""
echo " Commands:"
echo " pm2 status - check status"
echo " pm2 logs jss - view logs"
echo " pm2 restart jss - restart server"
echo ""
echo " For public access, setup a tunnel:"
echo " https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/46"
echo ""
echo " NOTE: Install Termux:Boot from F-Droid for auto-start on reboot"
echo ""