Skip to content

Commit

Permalink
Add option to use initoverlayfs as an init system
Browse files Browse the repository at this point in the history
- Introduced a new command-line option (--initoverlayfs-init) to enable
  initoverlayfs as an init system and mount storage immediately.
- Modified the script to handle the new option and update the configuration
  accordingly.
- Updated the version to 0.993.
- Added changelog entry for the new release.
- Updated the build scripts and spec file to include necessary dependencies
  and handle the new option.
- Modified the dracut module setup to check for the new option and adjust the
  installation accordingly.
- Updated the build script to include the necessary library (libblkid) for
  linking.
- Improved error handling and logging in the main script.
- Updated systemd integration to conditionally include systemd units based on
  the new option.
- Improved build scripts for better compatibility and error handling.
  • Loading branch information
ericcurtin committed Mar 11, 2024
1 parent 3749f08 commit 9c7e1e1
Show file tree
Hide file tree
Showing 9 changed files with 436 additions and 77 deletions.
21 changes: 18 additions & 3 deletions bin/initoverlayfs-install
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,19 @@ extract_initrd_into_initoverlayfs() {
# main()

args="$*"
initoverlayfs_init="false"
while [[ $# -gt 0 ]]; do
echo "$1"
case $1 in
--kver)
kver="$2"
shift 2
;;
--initoverlayfs-init)
initoverlayfs_init="true"
args=$(echo "$args" | sed "s/--initoverlayfs-init//g")
shift 1
;;
*)
shift 1
;;
Expand All @@ -149,11 +155,16 @@ detect_path_initramfs
if ! [ -e "$INITOVERLAYFS_CONF" ] || ! grep -q '[^[:space:]]' "$INITOVERLAYFS_CONF"; then
boot_partition=$(< /etc/fstab grep "${INITRAMFS_DIR}.*ext4" | awk '{print $1}')

printf "%s\n%s\n%s\n%s\n" \
printf "%s\n%s\n%s\n%s" \
"bootfs $boot_partition" \
"bootfstype ext4" \
"initoverlayfs_builder dracut -M -o \"initoverlayfs fcoe\"" \
"initrd_builder dracut -M -m \"kernel-modules udev-rules initoverlayfs systemd base\" -o \"bash systemd-initrd i18n kernel-modules-extra rootfs-block dracut-systemd usrmount fs-lib microcode_ctl-fw_dir_override shutdown nss-softokn\"" > $INITOVERLAYFS_CONF
"initoverlayfs_builder dracut -M -o \"initoverlayfs fcoe\"" > $INITOVERLAYFS_CONF

if $initoverlayfs_init; then
printf "%s\n" "initrd_builder dracut -M -m \"initoverlayfs\" -o \"kernel-modules udev-rules systemd base bash systemd-initrd i18n kernel-modules-extra rootfs-block dracut-systemd usrmount fs-lib microcode_ctl-fw_dir_override shutdown nss-softokn\"" >> $INITOVERLAYFS_CONF
else
printf "%s\n" "initrd_builder dracut -M -m \"kernel-modules udev-rules initoverlayfs systemd base\" -o \"bash systemd-initrd i18n kernel-modules-extra rootfs-block dracut-systemd usrmount fs-lib microcode_ctl-fw_dir_override shutdown nss-softokn\"" >> $INITOVERLAYFS_CONF
fi

erofs_compression_supported="true"
# shellcheck disable=SC2034
Expand All @@ -167,6 +178,10 @@ if ! [ -e "$INITOVERLAYFS_CONF" ] || ! grep -q '[^[:space:]]' "$INITOVERLAYFS_CO
fi
done

if $initoverlayfs_init; then
printf "%s\n" "initoverlayfs_init true" >> $INITOVERLAYFS_CONF
fi

if $erofs_compression_supported; then
printf "%s\n" "erofs_compression -zlz4hc,11" >> $INITOVERLAYFS_CONF
fi
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later

# Current version of initoverlayfs
VERSION=0.992
VERSION=0.993
# Specify if build is a official release or a snapshot build
IS_RELEASE=false
# Used for official releases. Increment if necessary
Expand Down
Loading

0 comments on commit 9c7e1e1

Please sign in to comment.