#!/bin/bash # Move AOSP source to a second drive so the OS drive doesn't fill up. # $1 = NVMe path to create as AOSP source root (e.g. /mnt/ssd/AOSP-Source) # $2 = local path environ.py expects (e.g. /home/oxmc/PawletOS-Build/AOSP-Source) # # out/ will be created inside the NVMe source dir naturally — no OUT_DIR needed. if [ -z "$1" ] || [ -z "$2" ]; then echo "Usage: ./setup-2drive-build.sh " echo " e.g.: ./setup-2drive-build.sh /mnt/ssd/AOSP-Source /home/oxmc/PawletOS-Build/AOSP-Source" exit 1 fi NVME_SOURCE="$1" LOCAL_SOURCE="$2" BASHRC="$HOME/.bashrc" mkdir -p "$NVME_SOURCE" if [ -L "$LOCAL_SOURCE" ]; then echo "Existing symlink found, relinking..." unlink "$LOCAL_SOURCE" elif [ -d "$LOCAL_SOURCE" ]; then echo "ERROR: $LOCAL_SOURCE is a real directory (has data on the OS drive)." echo "Remove it first: rm -rf '$LOCAL_SOURCE'" exit 1 fi ln -s "$NVME_SOURCE" "$LOCAL_SOURCE" # Remove OUT_DIR from ~/.bashrc — out/ lives inside the NVMe source dir, no override needed if grep -q 'OUT_DIR' "$BASHRC"; then sed -i '/OUT_DIR/d' "$BASHRC" echo "Removed OUT_DIR from $BASHRC" fi echo "Done." echo " AOSP source : $LOCAL_SOURCE -> $NVME_SOURCE" echo " Build output: $NVME_SOURCE/out (on NVMe, no OUT_DIR override needed)"