Skip to content

Commit

Permalink
support also "alias" key in autoyast profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladislav Slezak committed Jan 17, 2013
1 parent 48f5e35 commit 124dfb5
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/add-on_auto.ycp
Expand Up @@ -181,18 +181,29 @@ else if (func == "Write") {
do {
string url = media;

// set repository alias to product name
if (!isempty(prod["name"]:"")) {
// set repository alias to product name or alias if scpecified
if (!isempty(prod["name"]:"") || !isempty(prod["alias"]:"")) {
map url_p = URL::Parse(url);

// check if alias is already set
if (url_p["query"]:"" != "") {
map <string, string> params = URL::MakeMapFromParams(url_p["query"]:"");

// no alias present, add product name
// no alias present in URL, add it
if (!haskey(params, "alias")) {
y2milestone("Using product name '%s' as repository alias", prod["name"]:"");
params["alias"] = prod["name"]:"";

string alias = "";

if (!isempty(prod["alias"]:"")) {
y2milestone("Using repository alias: '%s'", prod["alias"]:"");
alias = prod["alias"]:"";
}
else {
y2milestone("Using product name '%s' as repository alias", prod["name"]:"");
alias = prod["name"]:"";
}

params["alias"] = alias;
url_p["query"] = URL::MakeParamsFromMap(params);
url = URL::Build(url_p);
}
Expand Down

0 comments on commit 124dfb5

Please sign in to comment.