zengxyz / rpms / anaconda

Forked from rpms/anaconda 4 months ago
Clone
Blob Blame History Raw
From a9d2581448ddb4c9cb1904dca06512aa79145f80 Mon Sep 17 00:00:00 2001
From: Jiri Konecny <jkonecny@redhat.com>
Date: Mon, 8 Feb 2021 11:26:06 +0100
Subject: [PATCH 1/3] Revert "Remove support for boot arguments without 'inst.'
 prefix from Dracut (#1912502)" (#1907566)

Allow to use Anaconda kernel args in Dracut without inst. prefix to not break
beaker. Beaker needs more time for adaptation so avoid to break it for RHEL-9.

This reverts commit a45405de99a42e5af047f04b78d168b6d41fa513.
Related: rhbz#1907566
---
 dracut/anaconda-diskroot           |  2 +-
 dracut/anaconda-ks-sendheaders.sh  |  4 +--
 dracut/fetch-kickstart-disk        |  2 +-
 dracut/kickstart-genrules.sh       |  2 +-
 dracut/parse-anaconda-dd.sh        |  2 +-
 dracut/parse-anaconda-kickstart.sh |  6 ++---
 dracut/parse-anaconda-net.sh       |  3 ---
 dracut/parse-anaconda-options.sh   | 39 ++++++++++++++----------------
 dracut/parse-anaconda-repo.sh      |  6 ++---
 9 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/dracut/anaconda-diskroot b/dracut/anaconda-diskroot
index 274849fdb3..2797e67625 100755
--- a/dracut/anaconda-diskroot
+++ b/dracut/anaconda-diskroot
@@ -39,7 +39,7 @@ run_checkisomd5() {
 
 dev="$1"
 path="$2" # optional, could be empty
-kickstart="$(getarg inst.ks=)"
+kickstart="$(getarg ks= inst.ks=)"
 
 # Log the device that triggered this job.
 debug_msg "Trying to find a root image on the device $dev."
diff --git a/dracut/anaconda-ks-sendheaders.sh b/dracut/anaconda-ks-sendheaders.sh
index a479a50667..7bc97393b8 100755
--- a/dracut/anaconda-ks-sendheaders.sh
+++ b/dracut/anaconda-ks-sendheaders.sh
@@ -5,7 +5,7 @@
 command -v set_http_header >/dev/null || . /lib/url-lib.sh
 
 # inst.ks.sendmac: send MAC addresses in HTTP headers
-if getargbool 0 inst.ks.sendmac; then
+if getargbool 0 kssendmac inst.ks.sendmac; then
     ifnum=0
     for ifname in /sys/class/net/*; do
         [ -e "$ifname/address" ] || continue
@@ -21,7 +21,7 @@ if getargbool 0 inst.ks.sendmac; then
 fi
 
 # inst.ks.sendsn: send system serial number in HTTP headers
-if getargbool 0 inst.ks.sendsn; then
+if getargbool 0 kssendsn inst.ks.sendsn; then
     system_serial=$(cat /sys/class/dmi/id/product_serial 2>/dev/null)
     if [ -z "$system_serial" ]; then
         warn "inst.ks.sendsn: can't find system serial number"
diff --git a/dracut/fetch-kickstart-disk b/dracut/fetch-kickstart-disk
index b1ee9f826c..7eb769ea5c 100755
--- a/dracut/fetch-kickstart-disk
+++ b/dracut/fetch-kickstart-disk
@@ -6,7 +6,7 @@ command -v getarg >/dev/null || . /lib/dracut-lib.sh
 
 dev="$1"
 path="${2:-/ks.cfg}"
-kickstart="$(getarg inst.ks=)"
+kickstart="$(getarg ks= inst.ks=)"
 
 [ -e /tmp/ks.cfg.done ] && exit 1
 [ -b "$dev" ] || exit 1
diff --git a/dracut/kickstart-genrules.sh b/dracut/kickstart-genrules.sh
index 84277890dd..8e1ba22643 100755
--- a/dracut/kickstart-genrules.sh
+++ b/dracut/kickstart-genrules.sh
@@ -28,7 +28,7 @@ case "${kickstart%%:*}" in
         wait_for_kickstart
     ;;
     "")
-        if [ -z "$kickstart" -a -z "$(getarg inst.ks=)" ]; then
+        if [ -z "$kickstart" -a -z "$(getarg ks= inst.ks=)" ]; then
             when_diskdev_appears $(disk_to_dev_path LABEL=OEMDRV) \
                 fetch-kickstart-disk \$env{DEVNAME} "/ks.cfg"
         fi
diff --git a/dracut/parse-anaconda-dd.sh b/dracut/parse-anaconda-dd.sh
index 8eeceb9a49..3633d29282 100755
--- a/dracut/parse-anaconda-dd.sh
+++ b/dracut/parse-anaconda-dd.sh
@@ -11,7 +11,7 @@
 rm -f /tmp/dd_interactive /tmp/dd_net /tmp/dd_disk /tmp/dd_todo
 
 # parse any dd/inst.dd args found
-for dd in $(getargs inst.dd=); do
+for dd in $(getargs dd= inst.dd=); do
     case "$dd" in
         # plain 'dd'/'inst.dd': Engage interactive mode!
         dd|inst.dd) echo menu > /tmp/dd_interactive ;;
diff --git a/dracut/parse-anaconda-kickstart.sh b/dracut/parse-anaconda-kickstart.sh
index 83b319dc7d..1f4f190db9 100755
--- a/dracut/parse-anaconda-kickstart.sh
+++ b/dracut/parse-anaconda-kickstart.sh
@@ -5,9 +5,9 @@
 [ -f /tmp/ks.cfg.done ] && return
 
 # inst.ks: provide a "URI" for the kickstart file
-kickstart="$(getarg inst.ks=)"
+kickstart="$(getarg ks= inst.ks=)"
 if [ -z "$kickstart" ]; then
-    getargbool 0 inst.ks && kickstart='nfs:auto'
+    getargbool 0 ks inst.ks && kickstart='nfs:auto'
 fi
 # no root? the kickstart will probably tell us what our root device is.
 [ "$kickstart" ] && [ -z "$root" ] && root="anaconda-kickstart"
@@ -23,7 +23,7 @@ case "${kickstart%%:*}" in
         set_neednet
     ;;
     urls) # multiple network kickstarts?
-        locations="$(getargs inst.ks=)"
+        locations="$(getargs ks= inst.ks=)"
         get_urls "$locations" >/tmp/ks_urls
         set_neednet
     ;;
diff --git a/dracut/parse-anaconda-net.sh b/dracut/parse-anaconda-net.sh
index f09ec8d098..5518546e5b 100755
--- a/dracut/parse-anaconda-net.sh
+++ b/dracut/parse-anaconda-net.sh
@@ -16,9 +16,6 @@ mac_to_bootif() {
 
 # handle ksdevice (tell us which device to use for ip= stuff later)
 export ksdevice=""
-# TODO: Remove support for ksdevice. It's deprecated a long time already
-# this should be inst.ksdevice however, this is deprecated a long time so we don't have
-# any inst.ksdevice. Let's just ignore this for now.
 ksdev_val=$(getarg ksdevice=)
 if [ -n "$ksdev_val" ]; then
     case "$ksdev_val" in
diff --git a/dracut/parse-anaconda-options.sh b/dracut/parse-anaconda-options.sh
index debe8ac0cb..c2735b0e19 100755
--- a/dracut/parse-anaconda-options.sh
+++ b/dracut/parse-anaconda-options.sh
@@ -58,12 +58,6 @@ check_removed_arg() {
     fi
 }
 
-check_removed_no_inst_arg() {
-    local removed_arg="$1" new_arg="$2"
-    check_removed_arg "$removed_arg" "All usage of Anaconda boot arguments without 'inst.' prefix \
-was removed. Please use $new_arg instead."
-}
-
 check_depr_args "blacklist=" "inst.blacklist=%s"
 check_depr_arg "nofirewire" "inst.blacklist=firewire_ohci"
 
@@ -83,32 +77,35 @@ check_removed_arg askmethod "Use an appropriate 'inst.repo=' argument instead."
 check_removed_arg asknetwork "Use an appropriate 'ip=' argument instead."
 
 # lang & keymap
-check_removed_no_inst_arg "lang" "inst.lang"
-check_removed_no_inst_arg "keymap" "inst.keymap"
+warn_renamed_arg "lang" "inst.lang"
+warn_renamed_arg "keymap" "inst.keymap"
+
+# debug
+warn_renamed_arg "debug" "inst.debug"
 
 # repo
 check_depr_arg "method=" "repo=%s"
-check_removed_no_inst_arg "repo" "inst.repo"
+warn_renamed_arg "repo" "inst.repo"
 
 # stage2
-check_removed_no_inst_arg "stage2" "inst.stage2"
+warn_renamed_arg "stage2" "inst.stage2"
 
 # kickstart
-check_removed_no_inst_arg "ks" "inst.ks"
-check_removed_no_inst_arg "ksdevice" "inst.ks.device"
-check_removed_no_inst_arg "kssendmac" "inst.ks.sendmac"
-check_removed_no_inst_arg "kssendsn" "inst.ks.sendsn"
+warn_renamed_arg "ks" "inst.ks"
+warn_renamed_arg "ksdevice" "inst.ks.device"
+warn_renamed_arg "kssendmac" "inst.ks.sendmac"
+warn_renamed_arg "kssendsn" "inst.ks.sendsn"
 
 # Ignore self-signed SSL certs
-check_removed_no_inst_arg "noverifyssl" "inst.noverifyssl"
-if getargbool 0 inst.noverifyssl; then
+warn_renamed_arg "noverifyssl" "inst.noverifyssl"
+if getargbool 0 noverifyssl inst.noverifyssl; then
     # Tell dracut to use curl --insecure
     echo "rd.noverifyssl" >> /etc/cmdline.d/75-anaconda-options.conf
 fi
 
 # updates
-check_removed_no_inst_arg "updates" "inst.updates"
-if updates=$(getarg inst.updates); then
+warn_renamed_arg "updates=" "inst.updates"
+if updates=$(getarg updates inst.updates); then
     if [ -n "$updates" ]; then
         export anac_updates=$updates
         case $updates in
@@ -122,11 +119,11 @@ if updates=$(getarg inst.updates); then
 fi
 
 # for vnc bring network up in initramfs so that cmdline configuration is used
-check_removed_no_inst_arg "vnc" "inst.vnc"
-getargbool 0 inst.vnc && warn "anaconda requiring network for vnc" && set_neednet
+warn_renamed_arg "vnc" "inst.vnc"
+getargbool 0 vnc inst.vnc && warn "anaconda requiring network for vnc" && set_neednet
 
 # Driver Update Disk
-check_removed_no_inst_arg "dd" "inst.dd"
+warn_renamed_arg "dd" "inst.dd"
 
 # re-read the commandline args
 unset CMDLINE
diff --git a/dracut/parse-anaconda-repo.sh b/dracut/parse-anaconda-repo.sh
index fdc937a95a..a1f96b3d98 100755
--- a/dracut/parse-anaconda-repo.sh
+++ b/dracut/parse-anaconda-repo.sh
@@ -4,8 +4,8 @@
 # If there's a root= arg, we'll just use that
 getarg root= >/dev/null && return
 
-repo="$(getarg inst.repo=)"
-stage2="$(getarg inst.stage2=)"
+repo="$(getarg repo= inst.repo=)"
+stage2="$(getarg stage2= inst.stage2=)"
 
 arg="repo"
 # default to using repo, but if we have stage2=, use that
@@ -26,7 +26,7 @@ if [ -n "$repo" ]; then
         ;;
         urls)
             root="anaconda-net:urls"
-            locations="$(getargs inst.stage2=)"
+            locations="$(getargs stage2= inst.stage2=)"
             get_urls "$locations" >/tmp/stage2_urls
             set_neednet
         ;;
-- 
2.29.2