Support for building the i686 edition in docker

This commit is contained in:
Francois Dupoux 2022-02-26 17:38:12 +00:00
parent ac6cea3a87
commit 91b0ce1cb6
4 changed files with 51 additions and 13 deletions

View file

@ -35,11 +35,26 @@ The build process can be started by running the build.sh script. It will create
a large "work" sub-directory and the ISO file will be written in the "out"
sub-directory.
If you are not running archlinux, you can run the build process in docker.
You need to have a Linux system running with docker installed and configured.
You can use the scripts provided in the `docker` folder of this repository.
First you need to run the script which builds a new docker image, and then you
need to run the script which uses this docker image to builds the ISO image.
## Building SystemRescue with docker
If you are not running archlinux, you can run the build process in docker
containers. You need to have a Linux system running with docker installed
and configured. You can use the scripts provided in the `docker` folder of
this repository.
You must export the environment variable named `sysrescuearch` before you
run the two helper scripts. It should be set as either `x86_64` or `i686`
depending on the target architecture for which you want to build the ISO image.
After this, you need to run the script which builds a new docker image, and
then the script which uses this docker image to builds the ISO image. The second
script will pass the arguments it receives to the main `build.sh` script.
For example you can build a 64bit version of SystemRescue in docker using these commands:
```
export sysrescuearch="x86_64"
./docker/build-docker-image.sh
./docker/build-iso-image.sh -v
```
## Including your SystemRescueModules
If you want to include your own [SystemRescueModules][srm], place their srm files

View file

@ -0,0 +1,7 @@
FROM fdupoux/archlinux32
RUN mkdir -p /workspace
COPY tmpfiles/pacman.conf /etc/pacman.conf
RUN sed -i -e 's/^Architecture.*$/Architecture = i686/' /etc/pacman.conf
RUN pacman -Syyu --noconfirm archiso binutils edk2-shell grub hugo mtools && rm -rf /var/cache/pacman/pkg/*
CMD ["setarch","i686","/usr/bin/bash"]
WORKDIR /workspace

View file

@ -1,8 +1,15 @@
#!/bin/bash
# Parameters
architecture="x86_64"
dockerimg="sysrescuebuildiso-${architecture}:latest"
# Parameters validation
if [ -z "${sysrescuearch}" ] ; then
echo "ERROR: You must define the environment variable 'sysrescuearch' as either 'x86_64' or 'i686' before you run this script"
exit 1
fi
if [ "${sysrescuearch}" != "x86_64" ] && [ "${sysrescuearch}" != "i686" ] ; then
echo "Value '${sysrescuearch}' is invalid for environment variable 'sysrescuearch'. Only 'x86_64' and 'i686' are supported"
exit 1
fi
# Determine the path to the git repository
fullpath="$(realpath $0)"
@ -17,7 +24,8 @@ mkdir -p ${tmpdir}
cp -a ${repodir}/pacman.conf ${tmpdir}
# Build the docker image
docker build -t ${dockerimg} -f ${repodir}/docker/Dockerfile-build-iso-${architecture} ${repodir}/docker
dockerimg="sysrescuebuildiso-${sysrescuearch}:latest"
docker build -t ${dockerimg} -f ${repodir}/docker/Dockerfile-build-iso-${sysrescuearch} ${repodir}/docker
# Cleanup
rm -rf ${tmpdir}

View file

@ -1,10 +1,18 @@
#!/bin/bash
# Parameters
architecture="x86_64"
dockerimg="sysrescuebuildiso-${architecture}:latest"
# Parameters validation
if [ -z "${sysrescuearch}" ] ; then
echo "ERROR: You must define the environment variable 'sysrescuearch' as either 'x86_64' or 'i686' before you run this script"
exit 1
fi
if [ "${sysrescuearch}" != "x86_64" ] && [ "${sysrescuearch}" != "i686" ] ; then
echo "Value '${sysrescuearch}' is invalid for environment variable 'sysrescuearch'. Only 'x86_64' and 'i686' are supported"
exit 1
fi
# Make sure the docker image exists
dockerimg="sysrescuebuildiso-${sysrescuearch}:latest"
if ! docker inspect ${dockerimg} >/dev/null 2>/dev/null ; then
echo "ERROR: You must build the following docker image before you run this script: ${dockerimg}"
exit 1
@ -30,4 +38,4 @@ fi
docker run --user 0:0 --privileged -it --workdir /workspace \
--volume=${repodir}:/workspace \
--volume=${pkgcache}:/var/cache/pacman/pkg \
${dockerimg} setarch ${architecture} /bin/bash -x /workspace/build.sh "$@"
${dockerimg} setarch ${sysrescuearch} /bin/bash /workspace/build.sh "$@"