From 289d53d62d0268e665b46d048d6cdf1ded4d3c94 Mon Sep 17 00:00:00 2001 From: Admin Pupkin Date: Fri, 29 May 2026 21:59:47 +0300 Subject: [PATCH] Red Bear OS base baseline --- local/scripts/create-forks.sh | 104 ++++++++++++++++++++++++++++++++++ local/sources/kernel | 1 + local/sources/relibc | 1 + 3 files changed, 106 insertions(+) create mode 100644 local/scripts/create-forks.sh create mode 160000 local/sources/kernel create mode 160000 local/sources/relibc diff --git a/local/scripts/create-forks.sh b/local/scripts/create-forks.sh new file mode 100644 index 0000000000..f89da9dd38 --- /dev/null +++ b/local/scripts/create-forks.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# Create Red Bear source forks from frozen pre-patched release archives. +# Each fork becomes a git repo under local/sources// +# 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 diff --git a/local/sources/kernel b/local/sources/kernel new file mode 160000 index 0000000000..74f34118da --- /dev/null +++ b/local/sources/kernel @@ -0,0 +1 @@ +Subproject commit 74f34118daf9ebb19838f912783041a9a80c416c diff --git a/local/sources/relibc b/local/sources/relibc new file mode 160000 index 0000000000..f3775e7d52 --- /dev/null +++ b/local/sources/relibc @@ -0,0 +1 @@ +Subproject commit f3775e7d52a2bb98973f19eec860f9bd972a251c