Handle updating /etc/kernel/cmdline
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
This commit is contained in:
		
							parent
							
								
									c8241463d7
								
							
						
					
					
						commit
						1faea2de0a
					
				
							
								
								
									
										24
									
								
								grubby-bls
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								grubby-bls
									
									
									
									
									
								
							@ -502,6 +502,16 @@ update_bls_fragment() {
 | 
				
			|||||||
                opts="$(echo "$opts" | sed -e 's/\//\\\//g')"
 | 
					                opts="$(echo "$opts" | sed -e 's/\//\\\//g')"
 | 
				
			||||||
                sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}"
 | 
					                sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}"
 | 
				
			||||||
            fi
 | 
					            fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						    if [[ -f /etc/kernel/cmdline ]]; then
 | 
				
			||||||
 | 
							sed -i "s/\(root=[^ ]*\) .*/\1 ${opts}/" /etc/kernel/cmdline
 | 
				
			||||||
 | 
						    else
 | 
				
			||||||
 | 
							# grub2-mkconfig creates this.  Do that now.
 | 
				
			||||||
 | 
							grub2-mkconfig -o /etc/grub2.cfg
 | 
				
			||||||
 | 
						    fi
 | 
				
			||||||
 | 
						    if [[ ! -f /etc/kernel/cmdline ]]; then
 | 
				
			||||||
 | 
							echo "No /etc/kernel/cmdline; please report a bug";
 | 
				
			||||||
 | 
						    fi
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        old_args="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")"
 | 
					        old_args="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")"
 | 
				
			||||||
@ -528,6 +538,20 @@ update_bls_fragment() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
    done
 | 
					    done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $param = "ALL" && $bootloader = zipl ]] && [[ -n $remove_args || -n $add_args ]]; then
 | 
				
			||||||
 | 
						if [[ ! -f /etc/kernel/cmdline ]]; then
 | 
				
			||||||
 | 
						    # anaconda could pre-populate this file, but until then, most of
 | 
				
			||||||
 | 
						    # the time we'll just want the most recent one.  This is pretty
 | 
				
			||||||
 | 
						    # close to the current almost-correct behavior of falling back to
 | 
				
			||||||
 | 
						    # /proc/cmdline anyhow.
 | 
				
			||||||
 | 
						    echo "$(get_bls_args -1)" > /etc/kernel/cmdline
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						read old_args < /etc/kernel/cmdline
 | 
				
			||||||
 | 
						local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
 | 
				
			||||||
 | 
						echo "$new_args" > /etc/kernel/cmdline
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    update_grubcfg
 | 
					    update_grubcfg
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Name: grubby
 | 
					Name: grubby
 | 
				
			||||||
Version: 8.40
 | 
					Version: 8.40
 | 
				
			||||||
Release: 63%{?dist}
 | 
					Release: 64%{?dist}
 | 
				
			||||||
Summary: Command line tool for updating bootloader configs
 | 
					Summary: Command line tool for updating bootloader configs
 | 
				
			||||||
License: GPLv2+
 | 
					License: GPLv2+
 | 
				
			||||||
Source1: grubby-bls
 | 
					Source1: grubby-bls
 | 
				
			||||||
@ -83,6 +83,9 @@ fi
 | 
				
			|||||||
%{_mandir}/man8/grubby.8*
 | 
					%{_mandir}/man8/grubby.8*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%changelog
 | 
					%changelog
 | 
				
			||||||
 | 
					* Tue Aug 02 2022 Robbie Harwood <rharwood@redhat.com> - 8.40-64
 | 
				
			||||||
 | 
					- Handle updating /etc/kernel/cmdline
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-63
 | 
					* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-63
 | 
				
			||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
 | 
					- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user