main
 1#!/data/data/com.termux/files/usr/bin/bash
 2# Boox Termux bootstrap script
 3# Run once after fresh Termux install:
 4#   curl -sL https://raw.githubusercontent.com/<your-repo>/main/android/osaka/bootstrap.sh | bash
 5# Or copy via adb and run locally.
 6set -euo pipefail
 7
 8echo "==> Updating packages..."
 9pkg update -y && pkg upgrade -y
10
11echo "==> Installing essentials..."
12pkg install -y openssh git zsh curl wget rsync jq
13
14echo "==> Generating SSH key..."
15mkdir -p ~/.ssh
16if [ ! -f ~/.ssh/id_ed25519 ]; then
17    ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" -C "osaka-termux"
18    echo ""
19    echo "╔══════════════════════════════════════════════════════════╗"
20    echo "║  Add this public key to your homelab config:            ║"
21    echo "╚══════════════════════════════════════════════════════════╝"
22    echo ""
23    cat ~/.ssh/id_ed25519.pub
24    echo ""
25    echo "Add it to globals.nix ssh.vincent and rebuild."
26    echo ""
27else
28    echo "SSH key already exists, skipping."
29fi
30
31echo "==> Cloning home repo..."
32REPO_DIR="$HOME/src/home"
33if [ ! -d "$REPO_DIR" ]; then
34    mkdir -p "$HOME/src"
35    # First clone uses the VPN IP directly since SSH config isn't set up yet
36    echo "You need to add the SSH key first. Once added, run:"
37    echo "  git clone git@github.com:<user>/home.git ~/src/home"
38    echo ""
39    echo "Then run: ~/src/home/android/osaka/sync.sh"
40else
41    echo "Repo already cloned."
42fi
43
44echo "==> Setting up Termux properties..."
45mkdir -p ~/.termux
46cp "$REPO_DIR/android/osaka/termux.properties" ~/.termux/termux.properties 2>/dev/null || true
47cp "$REPO_DIR/android/osaka/colors.properties" ~/.termux/colors.properties 2>/dev/null || true
48
49echo "==> Setting zsh as default shell..."
50chsh -s zsh 2>/dev/null || true
51
52echo "==> Done! Restart Termux."