Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2021-01-06 11:59:53 +0100
committerChristian Hesse <mail@eworm.de>2021-01-26 10:00:38 +0100
commitb30d1cad9bdf925b976b5d038a3ad741a70267c6 (patch)
treebf0cb3d817af2f2a801ef9b8718b46ba80b4b262
parentd153b4861364daa2e056d4cc70c57a60ab286b71 (diff)
mkarchiso: add version information
To date the iso version was used for iso volume information and iso file name. In my custom builds I do use it a lot more: * Inside the root fs: The system knows about its own version. I use this to: -> report the version to a server (poor man's inventory) -> let the system update itself * On the iso fs: The files are served via rsync, running systems transfer version file first to check for available update. * A grub environment file on the iso fs: Booting the iso from grub allows to create cow directory per version: loopback loop archlinux.iso load_env -f (loop)/arch/grubenv linux (loop)/arch/boot/x86_64/vmlinuz-linux ... \ cow_directory=archlinux/${VERSION} ... So let's just create these files.
-rw-r--r--README.rst13
-rwxr-xr-xarchiso/mkarchiso11
2 files changed, 23 insertions, 1 deletions
diff --git a/README.rst b/README.rst
index 03420b4..00e79e1 100644
--- a/README.rst
+++ b/README.rst
@@ -118,6 +118,19 @@ Optionally install archiso's mkinitcpio hooks:
make install-initcpio
+Optional Features
+=================
+
+The iso image contains a grub environment block holding the iso version. This allows to boot the iso image from grub
+with a version specific cow directory to mitigate overlay clashes.
+
+ .. code:: grub
+ loopback loop archlinux.iso
+ load_env -f (loop)/arch/grubenv
+ linux (loop)/arch/boot/x86_64/vmlinuz-linux ... \
+ cow_directory=archlinux/${VERSION} ...
+ initrd (loop)/arch/boot/x86_64/initramfs-linux-lts.img
+
Contribute
==========
diff --git a/archiso/mkarchiso b/archiso/mkarchiso
index b83f104..edad3a8 100755
--- a/archiso/mkarchiso
+++ b/archiso/mkarchiso
@@ -834,11 +834,19 @@ _set_overrides() {
_msg_info "Done!"
}
-
_export_gpg_publickey() {
gpg --batch --output "${work_dir}/pubkey.gpg" --export "${gpg_key}"
}
+_make_version() {
+ install -d -m 0755 -- "${isofs_dir}/${install_dir}"
+ _msg_info "Creating files with iso version..."
+ printf '%s\n' "${iso_version}" > "${airootfs_dir}/version"
+ printf '%s\n' "${iso_version}" > "${isofs_dir}/${install_dir}/version"
+ printf '%.1024s' "$(printf '# GRUB Environment Block\nVERSION=%s\n%s' "${iso_version}" \
+ "$(printf '%0.1s' "#"{1..1024})")" > "${isofs_dir}/${install_dir}/grubenv"
+ _msg_info "Done!"
+}
_make_pkglist() {
install -d -m 0755 -- "${isofs_dir}/${install_dir}"
@@ -867,6 +875,7 @@ _build_profile() {
[[ -n "${gpg_key}" ]] && _run_once _export_gpg_publickey
_run_once _make_custom_airootfs
_run_once _make_packages
+ _run_once _make_version
_run_once _make_customize_airootfs
_run_once _make_pkglist
_make_bootmodes