[oemid] Use consistent ${} substitution

SEE #1438
This commit is contained in:
Adriaan de Groot 2022-07-02 16:00:42 +02:00
parent f8a845d996
commit a7b3ccf198
3 changed files with 9 additions and 10 deletions

View File

@ -56,6 +56,8 @@ Pre-release versions:
Please update configurations. Please update configurations.
- *mount* now does most of the mounting; options that were in *fstab* - *mount* now does most of the mounting; options that were in *fstab*
have moved here. See #1993 have moved here. See #1993
- *oemid* now uses consistent variable replacement (e.g. KMacroExpander)
and does not support `@@DATE@@` anymore (use `${DATE}`).
- *partition* requires KPMCore 21.12 (e.g. KPMCore 4.2 API, or later). - *partition* requires KPMCore 21.12 (e.g. KPMCore 4.2 API, or later).
- *partition* can now skip installing the bootloader in more scenarios. - *partition* can now skip installing the bootloader in more scenarios.
#1632 (Thanks Anubhav) #1632 (Thanks Anubhav)

View File

@ -14,6 +14,7 @@
#include "IDJob.h" #include "IDJob.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
#include "utils/StringExpander.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include <QDate> #include <QDate>
@ -82,14 +83,10 @@ OEMViewStep::isAtEnd() const
static QString static QString
substitute( QString s ) substitute( QString s )
{ {
QString t_date = QStringLiteral( "@@DATE@@" ); Calamares::String::DictionaryExpander d;
if ( s.contains( t_date ) ) d.insert( QStringLiteral( "DATE" ), QDate::currentDate().toString( Qt::ISODate ) );
{
auto date = QDate::currentDate();
s = s.replace( t_date, date.toString( Qt::ISODate ) );
}
return s; return d.expand( s );
} }
void void

View File

@ -5,12 +5,12 @@
--- ---
# The batch-identifier is written to /var/log/installer/oem-id. # The batch-identifier is written to /var/log/installer/oem-id.
# This value is put into the text box as the **suggested** # This value is put into the text box as the **suggested**
# OEM ID. If @@DATE@@ is included in the identifier, then # OEM ID. If ${DATE} is included in the identifier, then
# that is replaced by the current date in yyyy-MM-dd (ISO) format. # that is replaced by the current date in yyyy-MM-dd (ISO) format.
# #
# it is ok for the identifier to be empty. # It is ok for the identifier to be empty.
# #
# The identifier is written to the file as UTF-8 (this will be no # The identifier is written to the file as UTF-8 (this will be no
# different from ASCII, for most inputs) and followed by a newline. # different from ASCII, for most inputs) and followed by a newline.
# If the identifier is empty, only a newline is written. # If the identifier is empty, only a newline is written.
batch-identifier: neon-@@DATE@@ batch-identifier: neon-${DATE}