main
 1#!/data/data/com.termux/files/usr/bin/bash
 2# Sync Boox Termux config from the home repo
 3# Run after cloning: ~/src/home/android/boox/sync.sh
 4set -euo pipefail
 5
 6DEVICE_DIR="$HOME/src/home/android/osaka"
 7COMMON_DIR="$HOME/src/home/android/common"
 8
 9if [ ! -d "$DEVICE_DIR" ]; then
10    echo "Error: home repo not found at ~/src/home"
11    echo "Clone it first: git clone <repo> ~/src/home"
12    exit 1
13fi
14
15echo "==> Installing packages..."
16pkg install -y openssh git zsh curl wget rsync jq mosh python nmap age passage htop ripgrep 2>/dev/null || true
17
18echo "==> Syncing SSH config..."
19mkdir -p ~/.ssh
20chmod 700 ~/.ssh
21ln -snf "$COMMON_DIR/ssh_config" ~/.ssh/config
22chmod 600 ~/.ssh/config 2>/dev/null || true
23
24echo "==> Syncing Termux config..."
25mkdir -p ~/.termux
26ln -snf "$DEVICE_DIR/termux.properties" ~/.termux/termux.properties
27ln -snf "$DEVICE_DIR/colors.properties" ~/.termux/colors.properties
28# Font (optional - uncomment if you add a font.ttf)
29# ln -snf "$BOOX_DIR/font.ttf" ~/.termux/font.ttf
30
31echo "==> Syncing shell config..."
32ln -snf "$DEVICE_DIR/zshrc" ~/.zshrc
33
34echo "==> Syncing bin..."
35mkdir -p ~/bin
36for f in "$COMMON_DIR"/bin/*; do
37    ln -snf "$f" ~/bin/"$(basename "$f")"
38done
39
40echo "==> Reloading Termux settings..."
41termux-reload-settings 2>/dev/null || true
42
43echo "==> Setting zsh as default shell..."
44chsh -s zsh 2>/dev/null || chsh -s "$PREFIX/bin/zsh" 2>/dev/null || true
45
46echo "==> Pulling latest from repo..."
47(cd ~/src/home && git pull --ff-only 2>/dev/null || echo "  ⚠️  Could not fast-forward, run git pull manually")
48
49echo "✅ Sync complete!"