summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-05-26 17:10:56 +0200
committerLennart Poettering <lennart@poettering.net>2021-05-26 17:20:36 +0200
commitb3e22322b6ba7728e0698c6945b2bb191e18bb4a (patch)
tree42649383ef46fcaec8a2e13ab7236587ffafb3ed
parentsysusers: add a generic specifier table for common cases (diff)
downloadsystemd-b3e22322b6ba7728e0698c6945b2bb191e18bb4a.tar.xz
systemd-b3e22322b6ba7728e0698c6945b2bb191e18bb4a.zip
repart: resolve $TMP specifiers too
This might be useful for CopyFiles=, to reference some subdir of $TMP in a generic way. This allows us to use the new common system_and_tmp_specifier_table[].
Diffstat (limited to '')
-rw-r--r--man/repart.d.xml6
-rw-r--r--src/partition/repart.c15
2 files changed, 10 insertions, 11 deletions
diff --git a/man/repart.d.xml b/man/repart.d.xml
index 6e3322e064..8f86c41547 100644
--- a/man/repart.d.xml
+++ b/man/repart.d.xml
@@ -622,7 +622,9 @@
<refsect1>
<title>Specifiers</title>
- <para>Specifiers may be used in the <varname>Label=</varname> setting. The following expansions are understood:</para>
+ <para>Specifiers may be used in the <varname>Label=</varname>, <varname>CopyBlocks=</varname>,
+ <varname>CopyFiles=</varname>, <varname>MakeDirectories=</varname> settings. The following expansions are
+ understood:</para>
<table class='specifiers'>
<title>Specifiers available</title>
<tgroup cols='3' align='left' colsep='1' rowsep='1'>
@@ -649,6 +651,8 @@
<xi:include href="standard-specifiers.xml" xpointer="v"/>
<xi:include href="standard-specifiers.xml" xpointer="w"/>
<xi:include href="standard-specifiers.xml" xpointer="W"/>
+ <xi:include href="standard-specifiers.xml" xpointer="T"/>
+ <xi:include href="standard-specifiers.xml" xpointer="V"/>
<xi:include href="standard-specifiers.xml" xpointer="percent"/>
</tbody>
</tgroup>
diff --git a/src/partition/repart.c b/src/partition/repart.c
index 877d2a091d..cd2d02a3b8 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -949,11 +949,6 @@ static int config_parse_type(
return 0;
}
-static const Specifier specifier_table[] = {
- COMMON_SYSTEM_SPECIFIERS,
- {}
-};
-
static int config_parse_label(
const char *unit,
const char *filename,
@@ -976,7 +971,7 @@ static int config_parse_label(
/* Nota bene: the empty label is a totally valid one. Let's hence not follow our usual rule of
* assigning the empty string to reset to default here, but really accept it as label to set. */
- r = specifier_printf(rvalue, GPT_LABEL_MAX, specifier_table, NULL, &resolved);
+ r = specifier_printf(rvalue, GPT_LABEL_MAX, system_and_tmp_specifier_table, NULL, &resolved);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to expand specifiers in Label=, ignoring: %s", rvalue);
@@ -1141,7 +1136,7 @@ static int config_parse_copy_files(
if (!isempty(p))
return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL), "Too many arguments: %s", rvalue);
- r = specifier_printf(source, PATH_MAX-1, specifier_table, NULL, &resolved_source);
+ r = specifier_printf(source, PATH_MAX-1, system_and_tmp_specifier_table, NULL, &resolved_source);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to expand specifiers in CopyFiles= source, ignoring: %s", rvalue);
@@ -1152,7 +1147,7 @@ static int config_parse_copy_files(
if (r < 0)
return 0;
- r = specifier_printf(target, PATH_MAX-1, specifier_table, NULL, &resolved_target);
+ r = specifier_printf(target, PATH_MAX-1, system_and_tmp_specifier_table, NULL, &resolved_target);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to expand specifiers in CopyFiles= target, ignoring: %s", resolved_target);
@@ -1201,7 +1196,7 @@ static int config_parse_copy_blocks(
return 0;
}
- r = specifier_printf(rvalue, PATH_MAX-1, specifier_table, NULL, &d);
+ r = specifier_printf(rvalue, PATH_MAX-1, system_and_tmp_specifier_table, NULL, &d);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to expand specifiers in CopyBlocks= source path, ignoring: %s", rvalue);
@@ -1249,7 +1244,7 @@ static int config_parse_make_dirs(
if (r == 0)
return 0;
- r = specifier_printf(word, PATH_MAX-1, specifier_table, NULL, &d);
+ r = specifier_printf(word, PATH_MAX-1, system_and_tmp_specifier_table, NULL, &d);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to expand specifiers in MakeDirectories= parameter, ignoring: %s", word);