ffbe098ef8
TLC (Twilight Commander) was missing from both ISO configs. Added
tlc = {} to [packages] in redbear-mini.toml and redbear-full.toml.
Created missing symlink: recipes/tui/tlc -> ../../local/recipes/tui/tlc.
105 lines
3.5 KiB
Bash
105 lines
3.5 KiB
Bash
#!/bin/bash
|
|
# Create Red Bear source forks from frozen pre-patched release archives.
|
|
# Each fork becomes a git repo under local/sources/<component>/
|
|
# The pre-patched archive is extracted, upstream .git removed, and the
|
|
# result committed as the initial Red Bear baseline.
|
|
|
|
set -e
|
|
PROJECT_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
ARCHIVE_DIR="$PROJECT_ROOT/sources/redbear-0.1.0/tarballs"
|
|
SOURCES_DIR="$PROJECT_ROOT/local/sources"
|
|
TMPDIR="${TMPDIR:-/tmp}/rb-fork-$$"
|
|
|
|
mkdir -p "$SOURCES_DIR"
|
|
|
|
create_fork() {
|
|
local component="$1"
|
|
local archive_pattern="$2"
|
|
|
|
local archive=$(ls "$ARCHIVE_DIR"/$archive_pattern 2>/dev/null | head -1)
|
|
if [ -z "$archive" ]; then
|
|
echo "SKIP: $component — no archive found for pattern $archive_pattern"
|
|
return 0
|
|
fi
|
|
|
|
local dest="$SOURCES_DIR/$component"
|
|
if [ -d "$dest/.git" ]; then
|
|
echo "SKIP: $component — already exists at $dest"
|
|
return 0
|
|
fi
|
|
|
|
echo "CREATE: $component from $(basename "$archive")"
|
|
rm -rf "$TMPDIR"
|
|
mkdir -p "$TMPDIR"
|
|
|
|
# Extract the archive
|
|
tar xf "$archive" -C "$TMPDIR" 2>/dev/null
|
|
|
|
# Locate the source directory (may be one level deep)
|
|
local src=""
|
|
if [ -d "$TMPDIR/source" ]; then
|
|
src="$TMPDIR/source"
|
|
elif [ -d "$TMPDIR/$component/source" ]; then
|
|
src="$TMPDIR/$component/source"
|
|
else
|
|
# Find any directory containing Cargo.toml or Makefile
|
|
src=$(find "$TMPDIR" -maxdepth 2 -name "Cargo.toml" -o -name "Makefile" -o -name "CMakeLists.txt" 2>/dev/null | head -1 | xargs dirname 2>/dev/null)
|
|
fi
|
|
|
|
if [ -z "$src" ] || [ ! -d "$src" ]; then
|
|
echo "FAIL: $component — could not locate source directory in archive"
|
|
return 1
|
|
fi
|
|
|
|
# Copy source to fork location, excluding .git
|
|
rm -rf "$dest"
|
|
mkdir -p "$dest"
|
|
# Use rsync to copy excluding .git (if it exists as submodule)
|
|
if [ -d "$src/.git" ]; then
|
|
# The source is a git repo (upstream clone) — copy everything except .git
|
|
rsync -a --exclude='.git' "$src/" "$dest/"
|
|
else
|
|
rsync -a "$src/" "$dest/"
|
|
fi
|
|
|
|
# Init git repo and commit
|
|
cd "$dest"
|
|
git init -q
|
|
git config user.name "Red Bear OS"
|
|
git config user.email "build@redbearos.org"
|
|
git add -A
|
|
git commit -q -m "Red Bear OS $component baseline
|
|
|
|
From release 0.1.0 pre-patched archive.
|
|
This includes all Red Bear modifications previously maintained
|
|
as patches in local/patches/$component/." 2>/dev/null || true
|
|
|
|
local commits=$(git rev-list --count HEAD 2>/dev/null || echo 0)
|
|
local files=$(git ls-files 2>/dev/null | wc -l)
|
|
echo " OK: $commits commit(s), $files files"
|
|
|
|
rm -rf "$TMPDIR"
|
|
}
|
|
|
|
echo "=== Creating Red Bear source forks ==="
|
|
echo ""
|
|
|
|
# Core system components (priority order)
|
|
create_fork "kernel" "core-kernel-*-patched.tar.gz"
|
|
create_fork "relibc" "core-relibc-*-patched.tar.gz"
|
|
create_fork "base" "core-base-*-patched.tar.gz"
|
|
create_fork "bootloader" "core-bootloader-*-patched.tar.gz"
|
|
create_fork "installer" "core-installer-*-patched.tar.gz"
|
|
create_fork "redoxfs" "core-redoxfs-*-patched.tar.gz"
|
|
create_fork "userutils" "core-userutils-*-patched.tar.gz"
|
|
|
|
# Libraries with patches
|
|
create_fork "mesa" "libs-mesa-*-patched.tar.gz"
|
|
|
|
echo ""
|
|
echo "=== Fork creation complete ==="
|
|
echo "Forks created in: $SOURCES_DIR"
|
|
ls -d "$SOURCES_DIR"/*/ 2>/dev/null | while read d; do
|
|
echo " $(basename "$d"): $(git -C "$d" rev-list --count HEAD 2>/dev/null || echo 0) commits, $(git -C "$d" ls-files 2>/dev/null | wc -l) files"
|
|
done
|