-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Info file parameter support #1896
Open
jreidinger
wants to merge
16
commits into
master
Choose a base branch
from
info_param
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
74b1d46
create also file with kernel only files for bootloader proposal
jreidinger 0d11399
Revert "create also file with kernel only files for bootloader proposal"
jreidinger 6cc2517
add script to filter out kernel cmdline to live root
jreidinger 8d4679f
add systemd service for filtering kernel
jreidinger ae97e49
remove space and add note
jreidinger 10a9a8f
first version of info expansion script
jreidinger d761a98
change param from info to agama.info
jreidinger b476c61
update systemd services config and scripts
jreidinger feb8ef7
Merge remote-tracking branch 'origin/master' into info_param
jreidinger cf47628
fix matching start of line
jreidinger c3e5920
remove debug output and fix sed
jreidinger e35af4e
allow password on kernel command line to handle new lines
jreidinger 0138767
remove properly info param
jreidinger c693a25
add ci for live directory
jreidinger 4960315
Update live/test/info_cmdline_test.rb
jreidinger 67abcfc
fix ci name
jreidinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,59 @@ | ||
name: CI - ISO definition | ||
|
||
on: | ||
push: | ||
paths: | ||
# NOTE: GitHub Actions do not allow using YAML references, the same path | ||
# list is used below for the pull request event. Keep both lists in sync!! | ||
|
||
# this file as well | ||
- .github/workflows/ci-live.yml | ||
# any change in the service subfolder | ||
- live/** | ||
|
||
pull_request: | ||
paths: | ||
# NOTE: GitHub Actions do not allow using YAML references, the same path | ||
# list is used above for the push event. Keep both lists in sync!! | ||
|
||
# this file as well | ||
- .github/workflows/ci-live.yml | ||
# any change in the service subfolder | ||
- live/** | ||
|
||
# allow running manually | ||
workflow_dispatch: | ||
|
||
jobs: | ||
ruby_tests: | ||
runs-on: ubuntu-latest | ||
env: | ||
COVERAGE: 1 | ||
|
||
defaults: | ||
run: | ||
working-directory: ./live | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
distro: [ "tumbleweed" ] | ||
|
||
container: | ||
image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby | ||
|
||
steps: | ||
|
||
- name: Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Configure and refresh repositories | ||
# disable unused repositories to have faster refresh | ||
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && zypper ref | ||
|
||
- name: Install Ruby development files | ||
run: zypper --non-interactive install | ||
make | ||
|
||
- name: Run the tests | ||
run: make check |
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
21 changes: 21 additions & 0 deletions
21
live/root/etc/systemd/system/agama-cmdline-process.service
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 @@ | ||
[Unit] | ||
Description=Agama kernel cmdline processing | ||
|
||
# have to be after network to be able to download info files | ||
# TODO: what to do in air gap scenario where we still need process cmdline? | ||
After=network-online.target | ||
|
||
# before starting the Agama servers so they read configuration parsed | ||
Before=agama-web-server.service | ||
Before=agama.service | ||
Before=x11-autologin.service | ||
|
||
[Service] | ||
Type=oneshot | ||
Environment=TERM=linux | ||
ExecStart=agama-kernel-cmdline.sh | ||
StandardInput=tty | ||
TimeoutSec=0 | ||
|
||
[Install] | ||
WantedBy=default.target |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,8 @@ [email protected] | |
[email protected] | ||
[email protected] | ||
|
||
# kernel command line option | ||
ConditionKernelCommandLine=live.password_dialog | ||
# and after we process agama params like info which can contain kernel parameters | ||
After=agama-cmdline-process.service | ||
|
||
[Service] | ||
Type=oneshot | ||
|
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 |
---|---|---|
|
@@ -22,8 +22,8 @@ [email protected] | |
[email protected] | ||
[email protected] | ||
|
||
# kernel command line option | ||
ConditionKernelCommandLine=live.password_systemd | ||
# and after we process agama params like info which can contain kernel parameters | ||
After=agama-cmdline-process.service | ||
|
||
[Service] | ||
Type=oneshot | ||
|
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,4 @@ | ||
#! /bin/sh | ||
|
||
kernel-cmdline-conf.sh | ||
info-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
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,23 @@ | ||
#! /bin/sh | ||
|
||
set -e | ||
|
||
TARGET="${1:-/etc/agama.d/cmdline.conf}" | ||
INFO_CONTENT="${2:-/etc/agama.d/cmdline.info.conf}" | ||
|
||
expand_info_arg() { | ||
INFO_URL=$(sed -n 's/\(.*[[:space:]]\|^\)agama\.info=\([^[:space:]]\+\).*/\2/p' "$TARGET") | ||
if [ -z "${INFO_URL}" ]; then | ||
return 0 | ||
fi | ||
|
||
curl --silent "${INFO_URL}" > "${INFO_CONTENT}" | ||
# remove info param | ||
sed -in 's/\([[:space:]]\|^\)agama\.info=[^[:space:]]\+//' "${TARGET}" | ||
# and add content of info file | ||
cat "${INFO_CONTENT}" >> "${TARGET}" | ||
|
||
return 0 | ||
} | ||
|
||
expand_info_arg |
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,32 @@ | ||
#! /bin/sh | ||
|
||
SOURCE="${1:-/proc/cmdline}" | ||
TARGET="${2:-/etc/agama.d/kernel.cmdline.conf}" | ||
|
||
write_kernel_args() { | ||
DIR=$(dirname "${TARGET}") | ||
mkdir -p "$DIR" | ||
# ensure that kernel cmdline line is created to avoid reading agama params | ||
# if there is no kernel params | ||
touch "${TARGET}" | ||
|
||
for _i in $(cat "${SOURCE}"); do | ||
case ${_i} in | ||
# remove all agama kernel params | ||
# Add here also all linuxrc supported parameters | ||
LIBSTORAGE_* | YAST_* | agama* | Y2* | ZYPP_* | autoyast* ) | ||
_found=1 | ||
;; | ||
esac | ||
|
||
if [ -z "$_found" ]; then | ||
echo "Non-Agama parameter found ($_i)" | ||
echo -n " $_i" >>"${TARGET}" | ||
fi | ||
unset _found | ||
done | ||
|
||
return 0 | ||
} | ||
|
||
write_kernel_args |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
BOOT_IMAGE=/boot/vmlinuz splash=silent mitigations=auto quiet nosimplefb=1 |
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,3 @@ | ||
BOOT_IMAGE=/boot/vmlinuz splash=silent nosimplefb=1 | ||
agama.install_url=ftp://test.com/repo | ||
live.password=secret |
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,2 @@ | ||
agama.install_url=ftp://test.com/repo | ||
live.password=secret |
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 @@ | ||
BOOT_IMAGE=/boot/vmlinuz splash=silent agama.auto=ftp://example.suse.cz/profile.json LIBSTORAGE_MULTIPATH=1 mitigations=auto Y2DEBUG=1 quiet nosimplefb=1 |
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 @@ | ||
BOOT_IMAGE=/boot/vmlinuz splash=silent agama.info=https://pastebin.com/raw/krzAVL8S nosimplefb=1 |
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,51 @@ | ||
#! /usr/bin/rspec | ||
require "tmpdir" | ||
|
||
describe "info-cmdline-conf.sh" do | ||
let(:script_path) { File.expand_path("../root/usr/bin/info-cmdline-conf.sh", __dir__, ) } | ||
|
||
context "There is no info parameter" do | ||
let(:source_path) { File.expand_path("fixtures/source/cmdline", __dir__, ) } | ||
let(:expected_path) { File.expand_path("fixtures/source/cmdline", __dir__, ) } | ||
|
||
|
||
it "does nothing" do | ||
Dir.mktmpdir do |tmpdir| | ||
target_path = File.join(tmpdir, "cmdline") | ||
FileUtils.cp(source_path, target_path) | ||
info_path = File.join(tmpdir, "cmdline.info") | ||
command = "#{script_path} #{target_path} #{info_path}" | ||
cmd_result = system(command) | ||
expect(cmd_result).to eq true | ||
expected = File.read(expected_path) | ||
result = File.read(target_path) | ||
expect(result).to eq expected | ||
expect(File.exists?(info_path)).to eq false | ||
end | ||
end | ||
end | ||
|
||
context "There is info parameter" do | ||
let(:source_path) { File.expand_path("fixtures/source/info_cmdline", __dir__, ) } | ||
let(:expected_path) { File.expand_path("fixtures/expected/info_cmdline", __dir__, ) } | ||
let(:expected_info_path) { File.expand_path("fixtures/expected/info_cmdline.info", __dir__, ) } | ||
|
||
it "removes info parameter and add its content" do | ||
Dir.mktmpdir do |tmpdir| | ||
target_path = File.join(tmpdir, "cmdline") | ||
FileUtils.cp(source_path, target_path) | ||
info_path = File.join(tmpdir, "cmdline.info") | ||
command = "#{script_path} #{target_path} #{info_path}" | ||
cmd_result = system(command) | ||
expect(cmd_result).to eq true | ||
expected = File.read(expected_path) | ||
result = File.read(target_path) | ||
expect(result).to eq expected | ||
|
||
expected_info = File.read(expected_info_path) | ||
result_info = File.read(info_path) | ||
expect(result_info).to eq expected_info | ||
end | ||
end | ||
end | ||
end |
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,20 @@ | ||
#! /usr/bin/rspec | ||
require "tmpdir" | ||
|
||
describe "kernel-cmdline-conf.sh" do | ||
it "filters out any agama params" do | ||
script_path = File.expand_path("../root/usr/bin/kernel-cmdline-conf.sh", __dir__, ) | ||
source_path = File.expand_path("fixtures/source/cmdline", __dir__, ) | ||
expected_path = File.expand_path("fixtures/expected/cmdline", __dir__, ) | ||
tmpdir = Dir.mktmpdir do |tmpdir| | ||
target_path = File.join(tmpdir, "cmdline") | ||
command = "#{script_path} #{source_path} #{target_path}" | ||
puts command | ||
cmd_result = system(command) | ||
expect(cmd_result).to eq true | ||
expected = File.read(expected_path) | ||
result = File.read(target_path) | ||
expect(result).to eq expected | ||
end | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This picks up only one info file. Linuxrc supports multiple info arguments. Then it downloads and merges all info files.
This might be pretty useful. You can have a generic info file and an optional debugging one which additionally enables some debug features. This avoids duplicating the common parts between the info files. Just use the common one and if needed easily add the debugging one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And linuxrc supports nested info files, you can use
info=
in info file as well... 😉There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know about both of those linuxrc features and it is possible to implement it, I just do not see much usage for it. What I see so far from bug reports is that there is just single info file param that contain required parameters. In the end there is not so much parameters you need to use and usually it is more like debug.info and if needed some production.info file.
I plan to document this limitation to old linuxrc behavior and if there is interest in extending it, we can always do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also allow different locations not sure if the same supported by curl... so something to document too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeap, also true