mirror of
https://github.com/nchevsky/systemrescue-zfs.git
synced 2026-01-03 15:20:19 +01:00
Add scripts and documentation to help build the ISO image in a docker container
This commit is contained in:
parent
afcebda039
commit
9c46de1bfe
|
|
@ -5,6 +5,7 @@ SystemRescue ChangeLog
|
|||
9.02 (YYYY-MM-DD):
|
||||
-------------------------------------------------------------------------------
|
||||
* Fix the type of the default definition of parameter "ar_attempts" (#266)
|
||||
* Added scripts and documentation to help build the ISO image in a docker container
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
9.01 (2022-02-10):
|
||||
|
|
|
|||
|
|
@ -35,9 +35,14 @@ 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.
|
||||
|
||||
## Including your SystemRescueModules
|
||||
If you want to include your own [SystemRescueModules][srm], place their srm files
|
||||
in the [srm](./srm) directory of the repository before running the build script.
|
||||
|
||||
[srm]: https://www.system-rescue.org/Modules/
|
||||
|
||||
|
|
|
|||
6
docker/Dockerfile-build-iso-x86_64
Normal file
6
docker/Dockerfile-build-iso-x86_64
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
FROM archlinux:latest
|
||||
RUN mkdir -p /workspace
|
||||
COPY tmpfiles/pacman.conf /etc/pacman.conf
|
||||
RUN pacman -Syyu --noconfirm archiso binutils edk2-shell grub hugo mtools && rm -rf /var/cache/pacman/pkg/*
|
||||
CMD ["setarch","x86_64","/usr/bin/bash"]
|
||||
WORKDIR /workspace
|
||||
23
docker/build-docker-image.sh
Executable file
23
docker/build-docker-image.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Parameters
|
||||
architecture="x86_64"
|
||||
dockerimg="sysrescuebuildiso-${architecture}:latest"
|
||||
|
||||
# Determine the path to the git repository
|
||||
fullpath="$(realpath $0)"
|
||||
curdir="$(dirname ${fullpath})"
|
||||
repodir="$(realpath ${curdir}/..)"
|
||||
tmpdir="${repodir}/docker/tmpfiles"
|
||||
echo "fullpath=${fullpath}"
|
||||
echo "repodir=${repodir}"
|
||||
|
||||
# Copy configuration files
|
||||
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
|
||||
|
||||
# Cleanup
|
||||
rm -rf ${tmpdir}
|
||||
33
docker/build-iso-image.sh
Executable file
33
docker/build-iso-image.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Parameters
|
||||
architecture="x86_64"
|
||||
dockerimg="sysrescuebuildiso-${architecture}:latest"
|
||||
|
||||
# Make sure the docker image exists
|
||||
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
|
||||
fi
|
||||
|
||||
# Determine the path to the git repository
|
||||
fullpath="$(realpath $0)"
|
||||
curdir="$(dirname ${fullpath})"
|
||||
repodir="$(realpath ${curdir}/..)"
|
||||
echo "curdir=${curdir}"
|
||||
echo "repodir=${repodir}"
|
||||
|
||||
# Create a tmpfs for storing packages cache in memory
|
||||
pkgcache="/tmp/pkgcache"
|
||||
echo "pkgcache=${pkgcache}"
|
||||
mkdir -p ${pkgcache}
|
||||
if ! findmnt ${pkgcache} >/dev/null; then
|
||||
echo "Mounting ${pkgcache} as a tmpfs"
|
||||
sudo mount -t tmpfs tmpfs -o size=2G ${pkgcache}
|
||||
fi
|
||||
|
||||
# Run the build process in the container
|
||||
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 "$@"
|
||||
Loading…
Reference in a new issue