Merge ~danielruthardt/cloud-initramfs-tools:fix/root-ro-detection into cloud-initramfs-tools:master

Proposed by Daniel Ruthardt
Status: Needs review
Proposed branch: ~danielruthardt/cloud-initramfs-tools:fix/root-ro-detection
Merge into: cloud-initramfs-tools:master
Diff against target: 21 lines (+7/-1)
1 file modified
overlayroot/scripts/init-bottom/overlayroot (+7/-1)
Reviewer Review Type Date Requested Status
cloud-initramfs-tools Pending
Review via email: mp+460784@code.launchpad.net

Commit message

🚸 Improve ro detection for when both are present

Description of the change

🚸 Improve ro detection for when both are present

Improve root file system "ro" detection for when both "ro" and "rw" are present in the kernel command line.
The above is helpful for situations when one only controls an append to the kernel command line and is not in complete control of the entire command line to be able to remove the "ro".

The fix/improvement allows for multiple "ro" and "rw" arguments to be present and will correctly use the last one present, just like the kernel would.

To post a comment you must log in.

Unmerged commits

116f011... by Daniel Ruthardt

🐛 Reimplement weak and faulty ro/rw detection

Signed-off-by: Daniel Ruthardt <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/overlayroot/scripts/init-bottom/overlayroot b/overlayroot/scripts/init-bottom/overlayroot
2index 5c13811..7e23a55 100755
3--- a/overlayroot/scripts/init-bottom/overlayroot
4+++ b/overlayroot/scripts/init-bottom/overlayroot
5@@ -698,9 +698,15 @@ OVERLAYROOT_DEBUG=${_RET_common_debug:-${OVERLAYROOT_DEBUG}}
6 dir_prefix=${_RET_common_dir:-"/overlay"}
7 overlayroot_driver=${_RET_common_driver}
8
9+cmdline_ro=false
10 read cmdline </proc/cmdline
11 cmdline=" $cmdline "
12-[ "${cmdline#* ro }" != "$cmdline" ] && cmdline_ro=true || cmdline_ro=false
13+for param in $cmdline; do
14+ case "$param" in
15+ ro) cmdline_ro=true ;;
16+ rw) cmdline_ro=false ;;
17+ esac
18+done
19
20 if [ "${overlayroot_driver:-auto}" = "auto" ]; then
21 search_fs_driver overlay overlayfs ||

Subscribers

People subscribed via source and target branches