Skip to content

Commit

Permalink
[ssuks] Allow URL postprocessing after KS generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernd Wachter committed Jan 1, 2015
1 parent 52e8c46 commit ed8a08f
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion ssuks/ssukickstarter.cpp
Expand Up @@ -368,7 +368,27 @@ bool SsuKickstarter::write(QString kickstart){
foreach (const QString &section, commandSections){
kout << commandSection(section).join("\n") << endl << endl;
}
kout << repos().join("\n") << endl << endl;

// this allows simple search and replace postprocessing of the repos section
// to overcome shortcomings of the "keep image creation simple token based"
// approach
// TODO: QHash looks messy in the config, provide tool to edit it
QString repoSection = repos().join("\n");
if (deviceInfo.variable("kickstart-defaults", "urlPostprocess")
.canConvert(QMetaType::QVariantHash)){
QHash<QString, QVariant> postproc =
deviceInfo.variable("kickstart-defaults", "urlPostprocess").toHash();

QHash<QString, QVariant>::const_iterator it = postproc.constBegin();
while (it != postproc.constEnd()){
QRegExp regex(it.key(), Qt::CaseSensitive, QRegExp::RegExp2);

repoSection.replace(regex, it.value().toString());
it++;
}
}

kout << repoSection << endl << endl;
kout << packagesSection("packages").join("\n") << endl << endl;
kout << packagesSection("attachment").join("\n") << endl << endl;
// TODO: now that extending scriptlet section is might make sense to make it configurable
Expand Down

0 comments on commit ed8a08f

Please sign in to comment.