diff --git a/CHANGES-3.3 b/CHANGES-3.3 index f2059f700..3769a6ef4 100644 --- a/CHANGES-3.3 +++ b/CHANGES-3.3 @@ -61,4 +61,5 @@ Pre-release versions: - *partition* requires KPMCore 21.12 (e.g. KPMCore 4.2 API, or later). - *partition* can now skip installing the bootloader in more scenarios. #1632 (Thanks Anubhav) + - *preservefiles* follows `${}` variable syntax instead of `@@`. diff --git a/src/modules/preservefiles/PreserveFiles.cpp b/src/modules/preservefiles/PreserveFiles.cpp index f904ded8c..8cbeee75f 100644 --- a/src/modules/preservefiles/PreserveFiles.cpp +++ b/src/modules/preservefiles/PreserveFiles.cpp @@ -15,6 +15,7 @@ #include "utils/CalamaresUtilsSystem.h" #include "utils/CommandList.h" #include "utils/Logger.h" +#include "utils/StringExpander.h" #include "utils/Units.h" #include @@ -37,7 +38,8 @@ atReplacements( QString s ) user = gs->value( "username" ).toString(); } - return s.replace( "@@ROOT@@", root ).replace( "@@USER@@", user ); + Calamares::String::DictionaryExpander d; + return d.add( QStringLiteral( "ROOT" ), root ).add( QStringLiteral( "USER" ), user ).expand( s ); } PreserveFiles::PreserveFiles( QObject* parent ) diff --git a/src/modules/preservefiles/preservefiles.conf b/src/modules/preservefiles/preservefiles.conf index 4fb393b2e..75584f566 100644 --- a/src/modules/preservefiles/preservefiles.conf +++ b/src/modules/preservefiles/preservefiles.conf @@ -40,11 +40,11 @@ # not exist in the host system (e.g. nvidia configuration files that # are created in some boot scenarios and not in others). # -# The target path (*dest*) is modified as follows: -# - `@@ROOT@@` is replaced by the path to the target root (may be /). +# The target path (*dest*) is modified by expanding variables in `${}`: +# - `ROOT` is replaced by the path to the target root (may be /). # There is never any reason to use this, since the *dest* is already # interpreted in the target system. -# - `@@USER@@` is replaced by the username entered by on the user +# - `USER` is replaced by the username entered by on the user # page (may be empty, for instance if no user page is enabled) # # @@ -53,6 +53,9 @@ files: - from: log dest: /var/log/Calamares.log perm: root:wheel:600 + - from: log + dest: /home/${USER}/installation.log + optional: true - from: config dest: /var/log/Calamares-install.json perm: root:wheel:600