Skip to content

Commit

Permalink
allow parameters in xml profile for autoyast scripts (fate#312687)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Fehr committed Oct 14, 2013
1 parent c15139a commit f0de3a6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/autoyast-rnc/scripts.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ autoinstall-chroot-script = element script {
debug? &
feedback? &
feedback_type? &
param-list? &
element notification { text }?
}

param-list = element param-list {
LIST,
element param { text }*
}

chrooted = element chrooted { BOOLEAN }
debug = element debug { BOOLEAN }
feedback = element feedback { BOOLEAN }
Expand Down
3 changes: 2 additions & 1 deletion src/include/autoinstall/xml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def profileSetup
"proposals" => "proposal",
"net-udev" => "rule",
"ask-list" => "ask",
"device_order" => "device"
"device_order" => "device",
"param-list" => "param"
}
)

Expand Down
22 changes: 17 additions & 5 deletions src/modules/AutoinstScripts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def Export
"location" => Ops.get_string(p, "location", ""),
"feedback" => Ops.get_boolean(p, "feedback", false),
"feedback_type" => Ops.get_string(p, "feedback_type", ""),
"param-list" => p.fetch("param-list",[]),
"debug" => Ops.get_boolean(p, "debug", true)
}
end
Expand All @@ -163,6 +164,7 @@ def Export
"feedback" => Ops.get_boolean(p, "feedback", false),
"feedback_type" => Ops.get_string(p, "feedback_type", ""),
"debug" => Ops.get_boolean(p, "debug", true),
"param-list" => p.fetch("param-list",[]),
"network_needed" => Ops.get_boolean(p, "network_needed", false)
}
end
Expand All @@ -176,6 +178,7 @@ def Export
"location" => Ops.get_string(p, "location", ""),
"feedback" => Ops.get_boolean(p, "feedback", false),
"feedback_type" => Ops.get_string(p, "feedback_type", ""),
"param-list" => p.fetch("param-list",[]),
"debug" => Ops.get_boolean(p, "debug", true)
}
end
Expand All @@ -196,6 +199,7 @@ def Export
"notification" => Ops.get_string(p, "notification", ""),
"feedback" => Ops.get_boolean(p, "feedback", false),
"feedback_type" => Ops.get_string(p, "feedback_type", ""),
"param-list" => p.fetch("param-list",[]),
"debug" => Ops.get_boolean(p, "debug", true)
}
end
Expand Down Expand Up @@ -496,18 +500,19 @@ def splitParams(s)
deep_copy(ret)
end

def interactiveScript(shell, debug, scriptPath, current_logdir, scriptName)
def interactiveScript(shell, debug, scriptPath, params, current_logdir, scriptName)
data = {}
widget = ""
SCR.Execute(path(".target.remove"), "/tmp/ay_opipe")
SCR.Execute(path(".target.remove"), "/tmp/ay_ipipe")
SCR.Execute(path(".target.bash"), "mkfifo -m 660 /tmp/ay_opipe", {})
SCR.Execute(path(".target.bash"), "mkfifo -m 660 /tmp/ay_ipipe", {})
execute = Builtins.sformat(
"%1 %2 %3 2&> %4/%5.log ",
"%1 %2 %3 %4 2> %5/%6.log ",
shell,
debug,
scriptPath,
params,
current_logdir,
scriptName
)
Expand Down Expand Up @@ -749,6 +754,7 @@ def Write(type, special)

Builtins.foreach(scripts) do |s|
scriptInterpreter = Ops.get_string(s, "interpreter", "shell")
params = s.fetch("param-list",[]).join(" ")
scriptName = Ops.get_string(s, "filename", "")
if scriptName == ""
t = URL.Parse(Ops.get_string(s, "location", ""))
Expand Down Expand Up @@ -894,14 +900,16 @@ def Write(type, special)
"/bin/sh",
debug,
scriptPath,
params,
current_logdir,
scriptName
)
else
executionString = Builtins.sformat(
"/bin/sh %1 %2 2&> %3/%4.log ",
"/bin/sh %1 %2 %3 &> %4/%5.log ",
debug,
scriptPath,
params,
current_logdir,
scriptName
)
Expand All @@ -926,14 +934,16 @@ def Write(type, special)
"/usr/bin/perl",
debug,
scriptPath,
params,
current_logdir,
scriptName
)
else
executionString = Builtins.sformat(
"/usr/bin/perl %1 %2 2&> %3/%4.log ",
"/usr/bin/perl %1 %2 %3 &> %4/%5.log ",
debug,
scriptPath,
params,
current_logdir,
scriptName
)
Expand All @@ -957,13 +967,15 @@ def Write(type, special)
"/usr/bin/python",
"",
scriptPath,
params,
current_logdir,
scriptName
)
else
executionString = Builtins.sformat(
"/usr/bin/python %1 2&> %2/%3.log ",
"/usr/bin/python %1 %2 &> %3/%4.log ",
scriptPath,
params,
current_logdir,
scriptName
)
Expand Down

0 comments on commit f0de3a6

Please sign in to comment.