-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# `initramfs-setup` module for startingpoint | ||
|
||
This `initramfs-setup` module is intended for including files into initramfs, including dracut ones, which are useful for modifying hardware behavior. | ||
It is similar to `rpm-ostree kargs` for this purpose, but `initramfs-setup` can load some modifications which are not possible to load with `rpm-ostree kargs`. | ||
|
||
Currently, it supports including file locations from `/etc` directory only by internally using `rpm-ostree initramfs-etc` component. | ||
|
||
Script which is responsible for this is located here: | ||
|
||
- `/usr/bin/initramfs-setup` | ||
|
||
It is run on every boot by this service: | ||
|
||
- `/usr/lib/systemd/system/initramfs-setup.service` | ||
|
||
Your modifications to initramfs are written to this file here: | ||
|
||
- `/etc/ublue-os/initramfs/tracked` | ||
|
||
Your modifications to dracut are written to this file here: | ||
|
||
- `/etc/ublue-os/initramfs/dracut-tracked` | ||
|
||
`tracked` & `dracut-tracked` files won't get written if you did not include modifications for those. This makes separation between OS & live-user modifications clearer. | ||
|
||
`initramfs-setup` detects your modifications & redundant file arguments, so your modification output is exactly matched to `rpm-ostree initramfs-etc` output. It also checks dracut configs the same way to trigger rebuild automatically only when necessary. When initramfs/dracut change is happening, you will see boot screen message which will say `Updating initramfs - System will reboot` or `Updating initramfs with dracut changes - System will reboot`, depending if `initramfs-setup` updates your initramfs or dracut modifications (or if it updates them both). | ||
|
||
To include your initramfs modifications, copy the modification files if you have those, than edit the "Example configuration" accordingly in `include`. | ||
Do the otherwise for deleting. | ||
|
||
To include `dracut` files, just copy those files to `/etc/dracut.conf.d/` directory. Than put them in `dracut_include`. Do the otherwise for deleting. | ||
|
||
## Example configuration | ||
|
||
```yaml | ||
type: initramfs-setup | ||
include: | ||
- /etc/crypttab | ||
- /etc/vconsole.conf | ||
- /etc/modprobe.d/my_config.conf | ||
dracut_include: | ||
- mydracut1.conf | ||
- mydracut2.conf | ||
- mydracut3.conf | ||
``` | ||
Live-user modification is available too. | ||
If live-user is not satisfied with initramfs modifications done by the OS, he can add them into this file here: | ||
`/etc/ublue-os/initramfs/tracked-custom` | ||
|
||
Files contain explanations on what those do & how those should be used. | ||
|
||
If live-user wants to include dracut files too, he can do that by copying files to `/etc/dracut.conf.d/` & editing: | ||
|
||
`/etc/ublue-os/initramfs/dracut-tracked-custom` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Tell build process to exit if there are any errors. | ||
set -euo pipefail | ||
|
||
# Uncomment this when it's ready for startingpoint/bling | ||
#BLING_DIRECTORY="${BLING_DIRECTORY:-"/tmp/bling"}" | ||
# | ||
#cp -r "$BLING_DIRECTORY"/files/usr/bin/initramfs-setup /usr/bin/initramfs-setup | ||
#cp -r "$BLING_DIRECTORY"/files/usr/lib/systemd/system/initramfs-setup.service /usr/lib/systemd/system/initramfs-setup.service | ||
|
||
get_yaml_array INCLUDE '.include[]' "$1" | ||
get_yaml_array DRACUT_INCLUDE '.dracut_include[]' "$1" | ||
|
||
echo "Installing initramfs-setup" | ||
|
||
if [[ ${#INCLUDE[@]} -gt 0 ]]; then | ||
|
||
printf "Configuring following initramfs files:\n" | ||
for file in "${INCLUDE[@]}"; do | ||
printf "%s\n" "$file" | ||
done | ||
|
||
mkdir -p /usr/etc/ublue-os/initramfs | ||
|
||
echo "Writing 'tracked' file to initramfs directory with modifications" | ||
|
||
echo -e "# This file should not be modified by the user, as it's used by the OS directly.\n" > /usr/etc/ublue-os/initramfs/tracked | ||
printf "%s" "${INCLUDE[@]}" >> /usr/etc/ublue-os/initramfs/tracked | ||
fi | ||
|
||
if [[ ${#DRACUT_INCLUDE[@]} -gt 0 ]]; then | ||
|
||
printf "Configuring following dracut files:\n" | ||
for file in "${DRACUT_INCLUDE[@]}"; do | ||
printf "%s\n" "$file" | ||
done | ||
|
||
mkdir -p /usr/etc/ublue-os/initramfs | ||
|
||
echo "Writing 'dracut_tracked' file to initramfs directory with modifications" | ||
|
||
echo -e "# This file should not be modified by the user, as it's used by the OS directly.\n" > /usr/etc/ublue-os/initramfs/dracut-tracked | ||
printf "%s" "${DRACUT_INCLUDE[@]}" >> /usr/etc/ublue-os/initramfs/dracut-tracked | ||
fi | ||
|
||
mkdir -p /usr/etc/ublue-os/initramfs | ||
|
||
echo "Writing 'tracked-custom' file to initramfs directory for live-user modifications" | ||
echo "# This file can be modified by live-users if they want to have custom file location arguments in initramfs. | ||
# Be sure to check if the arguments you want already exist in initramfs by issuing \`rpm-ostree initramfs-etc\` command before modifying this file. | ||
# Also don't forget to copy your initramfs modification files if you have those. | ||
# Here's an example on how to edit this file (ignore # symbol): | ||
# | ||
# /etc/vconsole.conf | ||
# /etc/crypttab | ||
# /etc/modprobe.d/my-modprobe.conf" > /usr/etc/ublue-os/initramfs/tracked-custom | ||
|
||
echo "Writing 'dracut-tracked-custom' file to initramfs directory for live-user modifications" | ||
echo "# This file can be modified by live-users if they want to have custom dracut configs. | ||
# Be sure that you copied your dracut configs to \`/etc/dracut.conf.d\` location before editing this file. | ||
# When you edit this file & reboot, you will notice boot screen message which says: \"Updating initramfs with dracut changes - System will reboot\" | ||
# Here's an example on how to edit this file (ignore # symbol): | ||
# | ||
# mydracut1.conf | ||
# mydracut2.conf | ||
# mydracut3.conf" > /usr/etc/ublue-os/initramfs/dracut-tracked-custom | ||
|
||
# Uncomment this when it's ready for startingpoint/bling | ||
#echo "Enabling initramfs-setup service" | ||
#mkdir -p /usr/etc/flatpak/{system,user} | ||
#systemctl enable -f initramfs-setup.service | ||
echo "Initramfs-setup is successfully installed & configured" |