Skip to content

Commit

Permalink
Merge pull request #5052 from jkonecny12/master-fix-root-owning-files…
Browse files Browse the repository at this point in the history
…-after-iso-build

Improve build of the ISO creating containers
  • Loading branch information
jkonecny12 authored Aug 23, 2023
2 parents 1113e8e + 2cb2b61 commit 3d84202
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 16 deletions.
19 changes: 12 additions & 7 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,15 @@ There are two options to develop and test changes which are not yet released.

To find out more information about quick way to propagate your changes into the existing installation ISO image see `this blogpost <https://rhinstaller.wordpress.com/2019/10/11/anaconda-debugging-and-testing-part-1/>`_.

Another way is to build the boot.iso directly (takes more time but it's easier to do). See the next section to find out how to build the ISO.

Building installation images
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bulding the ISO is the most precise way to find the behavior of Anaconda in the installation environment. However, it needs a lot of HW resources and time to build.
During the build, you will be ask for ``sudo`` password. Unfortunately, it is required to run the build as root because the build process needs to work with ``/dev/loop`` devices.
Please do not use `toolbx <https://github.com/containers/toolbox>`_ or `distrobox <https://github.com/89luca89/distrobox>`_ because the commands below are calling podman under root which is hard to achieve from inside of other container.

Another way is to build the boot.iso or Live image directly (takes more time but it's easier to do).
Follow these steps to build the ISO you need.

**First build Anaconda RPM files with our container**::

Expand All @@ -137,18 +142,18 @@ Then build an image containing those RPMs.

To build a regular boot.iso from these RPMs use (loop device mounting requires root privileges)::

sudo make -f ./Makefile.am anaconda-iso-creator-build # to build the container if it doesn't exists already
sudo make -f ./Makefile.am container-iso-build
make -f ./Makefile.am anaconda-iso-creator-build # to build the container if it doesn't exists already
make -f ./Makefile.am container-iso-build

To build a Web UI boot.iso run::

sudo make -f ./Makefile.am anaconda-iso-creator-build # to build the container if it doesn't exists already
sudo make -f ./Makefile.am container-webui-iso-build
make -f ./Makefile.am anaconda-iso-creator-build # to build the container if it doesn't exists already
make -f ./Makefile.am container-webui-iso-build

To build a Web UI in Live image run::

sudo make -f ./Makefile.am anaconda-live-iso-creator-build # to build the container if it doesn't exists already
sudo make -f ./Makefile.am container-live-iso-build
make -f ./Makefile.am anaconda-live-iso-creator-build # to build the container if it doesn't exists already
make -f ./Makefile.am container-live-iso-build

The resulting ISO will be stored in ``./result/iso`` directory.

Expand Down
8 changes: 6 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,19 @@ anaconda-release-build: anaconda-rpm-build
$(RELEASE_DOCKERFILE)

anaconda-iso-creator-build:
$(CONTAINER_ENGINE) build \
@sudo -nv 2>/dev/null || echo "You will be prompted for sudo password because this container has to be used under root!"

sudo $(CONTAINER_ENGINE) build \
$(CONTAINER_BUILD_ARGS) --pull-always \
$(CONTAINER_ADD_ARGS) \
--build-arg=image=$(BASE_CONTAINER) \
-t $(ISO_CREATOR_NAME):$(CI_TAG) \
$(ISO_CREATOR_DOCKERFILE)

anaconda-live-iso-creator-build:
$(CONTAINER_ENGINE) build \
@sudo -nv 2>/dev/null || echo "You will be prompted for sudo password because this container has to be used under root!"

sudo $(CONTAINER_ENGINE) build \
$(CONTAINER_BUILD_ARGS) --pull-always \
$(CONTAINER_ADD_ARGS) \
--build-arg=image=$(BASE_CONTAINER) \
Expand Down
8 changes: 6 additions & 2 deletions dockerfile/anaconda-iso-creator/lorax-build
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mknod -m 0660 /dev/loop0 b 7 0 2> /dev/null || true
mknod -m 0660 /dev/loop1 b 7 1 2> /dev/null || true

INPUT_RPMS=/anaconda-rpms/
OUT_DIR=/images/
REPO_DIR=/tmp/anaconda-rpms/

# create repo from provided Anaconda RPMs
Expand All @@ -37,6 +38,9 @@ lorax -p Fedora -v "$VERSION_ID" -r "$VERSION_ID" \
-s http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/ \
-s file://$REPO_DIR/ \
"$@" \
output || cp *.log /images/
output || cp *.log "$OUT_DIR"

cp output/images/boot.iso /images/
cp output/images/boot.iso "$OUT_DIR"

# fix permissions to user permissions on the built artifacts
chown -Rv --reference="$INPUT_RPMS" "$OUT_DIR"
8 changes: 6 additions & 2 deletions dockerfile/anaconda-iso-creator/lorax-build-webui
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ mknod -m 0660 /dev/loop0 b 7 0 2> /dev/null || true
mknod -m 0660 /dev/loop1 b 7 1 2> /dev/null || true

INPUT_RPMS=/anaconda-rpms/
OUT_DIR=/images/
REPO_DIR=/tmp/anaconda-rpms/

# create repo from provided Anaconda RPMs
Expand All @@ -49,6 +50,9 @@ lorax -p Fedora -v "$VERSION_ID" -r "$VERSION_ID" \
-s file://$REPO_DIR/ \
-i anaconda-webui -i webui_payload -i cockpit-ws -i cockpit-bridge -i firefox -i dbus-glib --rootfs-size 5 \
"$@" \
output || cp *.log /images/
output || cp *.log "$OUT_DIR"

cp output/images/boot.iso /images/
cp output/images/boot.iso "$OUT_DIR"

# fix permissions to user permissions on the built artifacts
chown -Rv --reference="$INPUT_RPMS" "$OUT_DIR"
10 changes: 7 additions & 3 deletions dockerfile/anaconda-live-iso-creator/lmc-build
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ set -eux

INPUT_RPMS=/anaconda-rpms/
REPO_DIR=/tmp/anaconda-rpms/
LOG_DIR=/images/logs/
OUT_DIR=/images/
LOG_DIR="$OUT_DIR"/logs/
# fedora-kickstarts clone during the Anaconda build
# https://pagure.io/fedora-kickstarts/tree/main
WORKSTATION_KS=/lorax/workstation.ks
Expand Down Expand Up @@ -108,9 +109,12 @@ livemedia-creator \
--ram=$proposed_mem \
--iso=/lorax/fedora-rawhide-boot.iso \
--ks=$WORKSTATION_KS \
--logfile=/images/logs/build.log \
--logfile="$LOG_DIR/build.log" \
--resultdir=/lorax/result

stop_http_server

cp ./result/Fedora-Workstation.iso /images/
cp ./result/Fedora-Workstation.iso "$OUT_DIR"

# fix permissions to user permissions on the built artifacts
chown -Rv --reference="$INPUT_RPMS" "$OUT_DIR"

0 comments on commit 3d84202

Please sign in to comment.