[preservefiles] Use ${} expansion instead of @@

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

View File

@ -61,4 +61,5 @@ Pre-release versions:
- *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)
- *preservefiles* follows `${}` variable syntax instead of `@@`.

View File

@ -15,6 +15,7 @@
#include "utils/CalamaresUtilsSystem.h" #include "utils/CalamaresUtilsSystem.h"
#include "utils/CommandList.h" #include "utils/CommandList.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/StringExpander.h"
#include "utils/Units.h" #include "utils/Units.h"
#include <QFile> #include <QFile>
@ -37,7 +38,8 @@ atReplacements( QString s )
user = gs->value( "username" ).toString(); 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 ) PreserveFiles::PreserveFiles( QObject* parent )

View File

@ -40,11 +40,11 @@
# not exist in the host system (e.g. nvidia configuration files that # not exist in the host system (e.g. nvidia configuration files that
# are created in some boot scenarios and not in others). # are created in some boot scenarios and not in others).
# #
# The target path (*dest*) is modified as follows: # The target path (*dest*) is modified by expanding variables in `${}`:
# - `@@ROOT@@` is replaced by the path to the target root (may be /). # - `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 # There is never any reason to use this, since the *dest* is already
# interpreted in the target system. # 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) # page (may be empty, for instance if no user page is enabled)
# #
# #
@ -53,6 +53,9 @@ files:
- from: log - from: log
dest: /var/log/Calamares.log dest: /var/log/Calamares.log
perm: root:wheel:600 perm: root:wheel:600
- from: log
dest: /home/${USER}/installation.log
optional: true
- from: config - from: config
dest: /var/log/Calamares-install.json dest: /var/log/Calamares-install.json
perm: root:wheel:600 perm: root:wheel:600