From: Kay Sievers Date: Fri, 20 Jun 2014 13:57:43 +0000 (+0200) Subject: tmpfiles: copy/link /usr/share/factory/ files when the source argument is omitted X-Git-Tag: v215~251 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=2f3b873a49734f8ecc8d929612d33153acbda891;ds=sidebyside tmpfiles: copy/link /usr/share/factory/ files when the source argument is omitted --- diff --git a/man/tmpfiles.d.xml b/man/tmpfiles.d.xml index f3cc2ea50..5e0b53834 100644 --- a/man/tmpfiles.d.xml +++ b/man/tmpfiles.d.xml @@ -191,7 +191,11 @@ L /tmp/foobar - - - - /dev/null symlink is to be created it will be removed and be replaced by the - symlink. + symlink. If the argument is omitted, + symlinks to files with the same name + residing in the directory + /usr/share/factory/ + are created. @@ -235,7 +239,10 @@ L /tmp/foobar - - - - /dev/null destination directory already exists, instead the entire copy operation is - skipped. + skipped. If the argument is omitted, + files from the source directory + /usr/share/factory/ + with the same name are copied. diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index cbad78aea..68cfa55ce 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -1249,10 +1249,10 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { case CREATE_SYMLINK: if (!i->argument) { - log_error("[%s:%u] Symlink file requires argument.", fname, line); - return -EBADMSG; + i->argument = strappend("/usr/share/factory", i->path); + if (!i->argument) + return log_oom(); } - break; case WRITE_FILE: @@ -1264,8 +1264,9 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { case COPY_FILES: if (!i->argument) { - log_error("[%s:%u] Copy files requires argument.", fname, line); - return -EBADMSG; + i->argument = strappend("/usr/share/factory", i->path); + if (!i->argument) + return log_oom(); } if (!path_is_absolute(i->argument)) {