-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation for storing Agama configuration provided by ke…
…rnel cmdline (#1866) ## Problem As part of the linuxrc compatibilty Jira entry, we want to make sure several boot arguments are translated to environment variables that indeed affect the execution of Agama. That includes the following patterns: LIBSTORAGE_*, YAST_*, Y2*, ZYPP_FULLLOG. Some examples (useful for verifying everything actually works): LIBSTORAGE_MULTIPATH_AUTOSTART, LIBSTORAGE_MDPART, YAST_ACTIVATE_LUKS, YAST_REUSE_LVM, Y2DEBUG, ZYPP_FULLLOG - https://trello.com/c/WDefGcX1 ## Solution The configuration that is provided by the kernel cmdline will be stored to /etc/agama.d/cmdline.conf and the agama services will use it as an EnvironmentFile. It is an initial implementation an probably would need some more work. ## Testing - *Tested manually*
- Loading branch information
Showing
8 changed files
with
86 additions
and
8 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,6 @@ | ||
dracut agama-cmdline module | ||
------------------------------- | ||
|
||
This module writes any agama configuration given through the kernel cmdline | ||
to its own cmdline conf file copying it to the sysroot. | ||
|
31 changes: 31 additions & 0 deletions
31
live/root/usr/lib/dracut/modules.d/99agama-cmdline/agama-cmdline-conf.sh
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,31 @@ | ||
#! /bin/sh | ||
|
||
[ -e /dracut-state.sh ] && . /dracut-state.sh | ||
|
||
. /lib/dracut-lib.sh | ||
|
||
get_agama_args() { | ||
local _i _found | ||
|
||
for _i in $CMDLINE; do | ||
case $_i in | ||
LIBSTORAGE_* | YAST_* | agama* | Y2* | ZYPP_*) | ||
_found=1 | ||
;; | ||
esac | ||
|
||
if [ -n "$_found" ]; then | ||
printf "Agama variable found ($_i)" | ||
if ! strstr "$_i" "="; then | ||
# Set the variable as a boolean if there is no assignation | ||
_i="${_i}=1" | ||
fi | ||
echo $_i >>/etc/cmdline.d/99-agama-cmdline.conf | ||
fi | ||
unset _found | ||
done | ||
|
||
return 0 | ||
} | ||
|
||
get_agama_args |
21 changes: 21 additions & 0 deletions
21
live/root/usr/lib/dracut/modules.d/99agama-cmdline/module-setup.sh
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,21 @@ | ||
#!/bin/bash | ||
|
||
# called by dracut | ||
check() { | ||
return 0 | ||
} | ||
|
||
# called by dracut | ||
depends() { | ||
return 0 | ||
} | ||
|
||
installkernel() { | ||
return 0 | ||
} | ||
|
||
# called by dracut | ||
install() { | ||
inst_hook cmdline 99 "$moddir/agama-cmdline-conf.sh" | ||
inst_hook pre-pivot 99 "$moddir/save-agama-conf.sh" | ||
} |
11 changes: 11 additions & 0 deletions
11
live/root/usr/lib/dracut/modules.d/99agama-cmdline/save-agama-conf.sh
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,11 @@ | ||
#! /bin/sh | ||
|
||
[ -e /dracut-state.sh ] && . /dracut-state.sh | ||
|
||
. /lib/dracut-lib.sh | ||
|
||
if [ -e /etc/cmdline.d/99-agama-cmdline.conf ]; then | ||
echo "Creating agama conf" | ||
mkdir -p "$NEWROOT/etc/agama.d" | ||
cp /etc/cmdline.d/99-agama-cmdline.conf "$NEWROOT/etc/agama.d/cmdline.conf" | ||
fi |
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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
------------------------------------------------------------------- | ||
Wed Jan 8 12:10:39 UTC 2025 - Knut Anderssen <[email protected]> | ||
|
||
- Make agama kernel cmdline options available in the sysroot at | ||
/etc/agama.d/cmdline.conf and set it as a EnvironmentFile | ||
in Agama related services (gh#agama-project/agama#1866). | ||
|
||
------------------------------------------------------------------- | ||
Tue Dec 10 12:46:06 UTC 2024 - Michal Filka <[email protected]> | ||
|
||
|
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
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
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