diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 93d6156..dfaa348 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -17,7 +17,7 @@ jobs: uses: mr-smithers-excellent/docker-build-push@v6 with: image: rosbe-unix-release-engineering - dockerfile: Docker/Dockerfile + dockerfile: Dockerfile registry: ghcr.io addLatest: true username: ${{ github.actor }} diff --git a/Docker/README.md b/Docker/README.md deleted file mode 100644 index 4e7de45..0000000 --- a/Docker/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# RosBE-Unix on Ubuntu with Release Engineering scripts - -Normally this docker container can be used from ghcr.io - -Below steps outline the process of running it locally. - -## Building the container - - - Create an image named `reactos-base`: - - `docker build --pull --rm -f "Dockerfile" -t reactos-base "."` - - Create a container named `reactos-builder` from the `reactos-base` image - - `docker run --name reactos-builder -it reactos-base` - - `exit` to close the container - -## Running the container - - - Run the `reactos-builder`: - - `docker start reactos-builder` - - Show all docker containers: - - `docker ps` - - Attach to the running `reactos-builder`: - - `docker attach 03e11af06800` (where `03e11af06800` is the `CONTAINER ID` from the running container) - -## Building a release - -```bash -Release_Configure -# Answer the prompts -Release_ISOs -Release_Source -``` diff --git a/Docker/Dockerfile b/Dockerfile similarity index 80% rename from Docker/Dockerfile rename to Dockerfile index 54d7ceb..9553d7e 100644 --- a/Docker/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM ubuntu:24.04 -LABEL org.opencontainers.image.authors="Mark Jansen " +LABEL org.opencontainers.image.authors="Mark Jansen , Carl Bialorucki " LABEL Description="RosBE-Unix on Ubuntu with Release Engineering scripts" WORKDIR /work @@ -31,8 +31,8 @@ RUN wget https://downloads.sourceforge.net/reactos/RosBE-Unix-2.2.1.tar.bz2 \ && cd .. \ && rm -rf RosBE-Unix-2.2.1 -RUN git clone https://github.com/reactos/Release_Engineering \ - && mv Release_Engineering/Release_* /usr/local/bin \ - && rm -rf Release_Engineering +COPY Scripts/* /usr/local/bin -CMD ["/usr/local/RosBE/RosBE.sh", "/work"] +RUN git clone https://github.com/reactos/reactos.git /reactos + +CMD ["/usr/local/RosBE/RosBE.sh", "/reactos"] diff --git a/README.md b/README.md index a85e174..38741c9 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,43 @@ This repository contains the scripts used to create ReactOS release images. -The docker image is created from the [Docker](Docker) folder. +## Building a release using Docker +You can build ReactOS releases locally in three easy steps, assuming you have Docker Desktop installed. + +#### 1. Building the container +Clone this git repository and `cd` into it. From the root of the repository, run the commands below. This will create a Docker image called `reactos-base` and a Docker container called `reactos-builder`. + +```bash +docker build -t reactos-base . +docker run --name reactos-builder -it reactos-base +``` +Your container will now be set up and your terminal will be connected to it. To disconnect from the container, run `exit`. + +If you disconnect from your container, you can reconnect to it using this command: +```bash +docker start -ai reactos-builder +``` + +#### 2. Building release deliverables +Once you connect to your container, you will be in the `/reactos` directory. This contains a git clone of the ReactOS repository. To build release deliverables, simply checkout the branch with the release you want to make and run `release`. +```bash +git checkout {release branch} +release +``` +The release script will handle fetching the latest commits from origin, downloading optional modules, building ReactOS, and creating the deliverables. When there is no internet connection, the release script is smart enough to continue if optional modules were downloaded previously and warn about not fetching from origin. + +#### 3. Copying the deliverables +When complete, the release script will display a message similar to this: + +``` +******************************************************************************* +Successfully created the following packages: + /reactos/deliverables/ReactOS-0.4.16-dev-2669-i386.zip + /reactos/deliverables/ReactOS-0.4.16-dev-2669-src.zip +******************************************************************************* +``` + +Simply copy the release deliverables from the `/reactos/deliverables` folder to your computer to use them as needed. You can copy them from the container using Docker Desktop's graphical interface, or you can use the Docker command line interface. For example, this will copy the contents of `/reactos/deliverables` to the current working directory if your container name is `reactos-builder`: +```bash +docker cp reactos-builder:/reactos/deliverables/. . +``` diff --git a/Release_Configure b/Release_Configure deleted file mode 100755 index 8aaad87..0000000 --- a/Release_Configure +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# ReactOS Release Engineering Scripts -# Release_Configure - Set up a release configuration. First script to execute! - -# Sanity checks -if [ "$ROS_ARCH" = "" ]; then - echo "Please run this script inside RosBE!" - exit 1 -fi - -# Constants -ORIGDIR="$PWD" -REPODIR="$PWD/Release_WorkDir/Repo" - -echo "*******************************************************************************" -echo "* ReactOS Release Engineering Scripts *" -echo "*******************************************************************************" -echo - -# Ask for the version -echo "What ReactOS version do you want to release? (e.g. \"0.4.12\")" -echo "This will be used as suffix for the built files." -echo "If this is an RC, just hit RETURN without entering anything to use a suffix determined by Git (e.g. \"0.4.12-RC-5-g8449527\")." -read version -echo - -# Ask for the branch name -while [ "$branch_name" = "" ]; do - echo "What is the name of the Git branch? (e.g. \"releases/0.4.12\")" - read branch_name - echo -done - -# Check out the Git repository -if [ -d "${REPODIR}/.git" ]; then - cd "${REPODIR}" || exit 1 - git clean -d -f -f -x || exit 1 - git remote set-url origin https://github.com/reactos/reactos.git || exit 1 - git fetch origin || exit 1 - git checkout "${branch_name}" || exit 1 - git reset --hard "origin/${branch_name}" || exit 1 -else - rm -rf "${REPODIR}" - git clone https://github.com/reactos/reactos.git "${REPODIR}" || exit 1 - cd "${REPODIR}" || exit 1 - git checkout "${branch_name}" || exit 1 -fi - -# Get the version from Git if none was entered. -if [ "${version}" = "" ]; then - # Output something like '0.4.15-4-ge1e96bf467b5ea' - version_with_hash=`git describe --always` - # Extract the part before the last dash to ignore the commit hash - version=${version_with_hash%-*} -fi - -# Write the config file -cd "${ORIGDIR}" -echo "REPODIR=${REPODIR}" > Release_Config -echo "version=${version}" >> Release_Config -echo "branch_name=${branch_name}" >> Release_Config - -# All done! -echo "Release configured!" -echo "Now you can use the other Release_* commands to create the packages." diff --git a/Release_ISOs b/Release_ISOs deleted file mode 100755 index 9623049..0000000 --- a/Release_ISOs +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# ReactOS Release Engineering Scripts -# Release_ISOs - Create the "-iso.zip" and "-live.zip" packages - -# Sanity checks -if ! source ./Release_Config; then - echo "Please run Release_Configure first!" - exit 1 -fi - -if [ "$ROS_ARCH" = "" ]; then - echo "Please run this script inside RosBE!" - exit 1 -fi - -if [ "$ROS_ARCH" = "i386" ]; then - ROS_PRETTY_ARCH="x86" -else - ROS_PRETTY_ARCH="$ROS_ARCH" -fi - - -# Constants -ROOTDIR="$PWD" -OUTPUTDIR="output-MinGW-i386" -BOOTCDISO="ReactOS-${version}-${ROS_PRETTY_ARCH}.iso" -BOOTCDZIP="ReactOS-${version}-${ROS_PRETTY_ARCH}-iso.zip" -LIVECDISO="ReactOS-${version}-${ROS_PRETTY_ARCH}-live.iso" -LIVECDZIP="ReactOS-${version}-${ROS_PRETTY_ARCH}-live.zip" - -# Start from a clean state -rm -f "${ROOTDIR}/${BOOTCDZIP}" -rm -f "${ROOTDIR}/${LIVECDZIP}" - -# Download the "optional" folder from svn.reactos.org -mkdir "${REPODIR}/modules/optional" || exit 1 -cd "${REPODIR}/modules/optional" || exit 1 -wget --recursive --level=1 --no-directories --no-parent --execute robots=off "https://svn.reactos.org/optional" || exit 1 - -# Check that all mandatory files exist in the "optional" folder. -if ! [ -f "DroidSansFallback.ttf" ]; then - echo "DroidSansFallback CJK font missing!" - exit 1 -fi - -if ! compgen -G "wine_gecko*.msi" > /dev/null; then - echo "wine_gecko MSI package missing!" - exit 1 -fi - -# Build ReactOS -cd "${REPODIR}" || exit 1 -./configure.sh -DENABLE_ROSAPPS=1 -DENABLE_WALLPAPERS=1 || exit 1 -cd "${REPODIR}/${OUTPUTDIR}" || exit 1 -ninja bootcd || exit 1 -ninja livecd || exit 1 - -# Create the ZIP packages -mv "bootcd.iso" "${BOOTCDISO}" || exit 1 -zip -9 "${ROOTDIR}/${BOOTCDZIP}" "${BOOTCDISO}" || exit 1 -mv "livecd.iso" "${LIVECDISO}" || exit 1 -zip -9 "${ROOTDIR}/${LIVECDZIP}" "${LIVECDISO}" || exit 1 - -# We're done! -echo -echo "*******************************************************************************" -echo "Successfully created the following packages:" -echo -echo " - ${BOOTCDZIP}" -echo " - ${LIVECDZIP}" -echo "*******************************************************************************" -echo diff --git a/Release_Source b/Release_Source deleted file mode 100755 index 52927b4..0000000 --- a/Release_Source +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# ReactOS Release Engineering Scripts -# Release_Source - Create the "-src.zip" package - -# Sanity checks -if ! source ./Release_Config; then - echo "Please run Release_Configure first!" - exit 1 -fi - -if [ "$ROS_ARCH" = "" ]; then - echo "Please run this script inside RosBE!" - exit 1 -fi - -# Constants -ROOTDIR="$PWD" -EXPORTDIR="ReactOS-${version}" -SOURCEZIP="ReactOS-${version}-src.zip" - -# Start from a clean state -rm -f "${ROOTDIR}/${SOURCEZIP}" - -# Create the ZIP package -cd "${REPODIR}" -git archive --format=zip --prefix="${EXPORTDIR}/" -9 --output="${ROOTDIR}/${SOURCEZIP}" "${branch_name}" || exit 1 - -# We're done! -echo -echo "*******************************************************************************" -echo "Successfully created the following packages:" -echo -echo " - ${SOURCEZIP}" -echo "*******************************************************************************" -echo diff --git a/Scripts/release b/Scripts/release new file mode 100644 index 0000000..0e0af2c --- /dev/null +++ b/Scripts/release @@ -0,0 +1,131 @@ +#!/bin/bash +# Fail immediately if there's any errors in the script +set -euo pipefail + +# Constants +ROOTDIR="$PWD" +OPTMODDIR="modules/optional" +OUTPUTDIR="output-MinGW-i386" + +echo +echo "*******************************************************************************" +echo "* ReactOS Release Script *" +echo "*******************************************************************************" +echo + +# Ensure we are in RosBE. +if [ "$ROS_ARCH" = "" ]; then + echo "FAILED: Release script must be run inside RosBE." + exit 1 +fi + +# Ensure this is running inside a git directory. +if [ ! -d "${ROOTDIR}/.git" ]; then + echo "FAILED: Release script must be run inside a ReactOS git directory." + exit 1 +fi + +# Check for internet connection. +wget -q --spider https://reactos.org + +if [ $? -eq 0 ]; then + internet=true +else + echo "Warning: No internet connection detected." + echo "Optional modules cannot be downloaded and origin cannot be fetched." + echo +fi + +# Get version (ex: 0.4.15-4-ge1e96bf467b5ea). +version=$(git describe) +# Remove git hash at end of the version. +version=${version%-*} +# Change "release" to "rls", if it is in the version name. +version=${version/release/rls} + +echo "ReactOS version is ${version}" +echo "ReactOS branch name is $(git rev-parse --abbrev-ref HEAD)" +echo + +# Ensure version is not null. +if [ "$version" = "" ]; then + echo "FAILED: Version is NULL." + exit 1 +fi + +# Clean repository, excluding the modules/optional folder and its contents. +git clean -d -f -f -x --exclude="/modules/optional/*" +# Fetch changes from origin if we have an internet connection. +if [ "$internet" ]; then + git fetch origin +fi +# Reset to the head of the branch +git reset --hard HEAD +echo + +# Download the "optional" folder from svn.reactos.org if it isn't already downloaded. +# Ensure the optional modules folder is there and contains the modules we need. +if [ -d "${OPTMODDIR}" ] && [ -f "${OPTMODDIR}/DroidSansFallback.ttf" ] && compgen -G "${OPTMODDIR}/wine_gecko*.msi" > /dev/null; then + echo "Optional modules already downloaded. Skipping." + echo "If you have an issue with the optional modules, re-run this script after deleting the directory:" + echo " ${ROOTDIR}/${OPTMODDIR}" +elif [ "${internet}" ]; then + echo "Downloading optional modules..." + if [ -d "${OPTMODDIR}" ]; then + rm -rf "${OPTMODDIR}" + fi + mkdir "${OPTMODDIR}" + cd "${OPTMODDIR}" + wget --recursive --level=1 --no-directories --no-parent --execute robots=off "https://svn.reactos.org/optional" + # Check that all mandatory files were downloaded. + if [ ! -f "DroidSansFallback.ttf" ]; then + echo "DroidSansFallback CJK font missing!" + exit 1 + fi + if ! compgen -G "wine_gecko*.msi" > /dev/null; then + echo "wine_gecko MSI package missing!" + exit 1 + fi +else + echo "FAILED: Missing optional modules and no internet connection." + exit 1 +fi +echo + +# BootCD deliverable constants +BOOTCDISO="ReactOS-${version}-${ROS_ARCH}.iso" +BOOTCDZIP="ReactOS-${version}-${ROS_ARCH}.zip" +EXPORTDIR="ReactOS-${version}" +SOURCEZIP="ReactOS-${version}-src.zip" +DELIVERDIR="deliverables" +mkdir -p "${ROOTDIR}/${DELIVERDIR}" + +# Build ReactOS +cd "${ROOTDIR}" +./configure.sh -DENABLE_ROSAPPS=1 -DENABLE_WALLPAPERS=1 +cd "${OUTPUTDIR}" +ninja bootcd + +# Create the ZIP packages for BootCD +echo "Creating BootCD ISO ZIP package..." +mv "bootcd.iso" "${BOOTCDISO}" +zip -9 "${ROOTDIR}/${DELIVERDIR}/${BOOTCDZIP}" "${BOOTCDISO}" + +# Create the ZIP package for the source deliverable +echo "Creating source ZIP package..." +cd "${ROOTDIR}" +git archive --format=zip --prefix="${EXPORTDIR}/" -9 --output="${ROOTDIR}/${DELIVERDIR}/${SOURCEZIP}" "$(git rev-parse HEAD)" + +# We're done! +if [ -z "$internet" ]; then + echo + echo "Warning: No internet connection. HEAD may be stale." + echo " HEAD: $(git describe)" +fi +echo +echo "*******************************************************************************" +echo "Successfully created the following packages:" +echo " ${ROOTDIR}/${DELIVERDIR}/${BOOTCDZIP}" +echo " ${ROOTDIR}/${DELIVERDIR}/${SOURCEZIP}" +echo "*******************************************************************************" +echo