-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_codeserver.sh
More file actions
executable file
·35 lines (29 loc) · 1.23 KB
/
Copy pathsetup_codeserver.sh
File metadata and controls
executable file
·35 lines (29 loc) · 1.23 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
#!/data/data/com.termux/files/usr/bin/bash
set -e
echo "=== 1. Updating Termux packages ==="
pkg update -y && pkg upgrade -y
echo "=== 2. Installing proot-distro ==="
pkg install proot-distro curl -y
echo "=== 3. Installing Ubuntu core ==="
# Check if already installed to avoid errors
if ! proot-distro list | grep -q "Installed: yes" | grep -q "ubuntu"; then
proot-distro install ubuntu
fi
echo "=== 4. Setting up Node.js 22 & Yarn inside Ubuntu ==="
proot-distro login ubuntu -- bash -c "
apt update && apt upgrade -y
apt install curl sudo -y
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
apt install -y nodejs
npm install -g yarn
yarn global add code-server
"
echo "=== 5. Creating Termux shortcut alias ==="
# Remove old alias if it exists, then append the new one
sed -i '/alias start-ide=/d' ~/.bashrc
echo "alias start-ide='proot-distro login ubuntu --bind /data/data/com.termux/files/home:/mnt -- code-server --bind-addr 127.0.0.1:8080 /mnt'" >> ~/.bashrc
echo "=================================================="
echo " SUCCESS! Setup complete."
echo " Please restart Termux or run: source ~/.bashrc"
echo " Then, simply type: start-ide"
echo "=================================================="