diff --git a/plugins/bootmisc.c b/plugins/bootmisc.c index e0879fb2..ba4f07af 100644 --- a/plugins/bootmisc.c +++ b/plugins/bootmisc.c @@ -38,7 +38,6 @@ #include "finit.h" #include "helpers.h" #include "plugin.h" -#include "tmpfiles.h" #include "util.h" #include "utmp-api.h" @@ -163,7 +162,7 @@ static void setup(void *arg) kernel_links(); /* Create all system tmpfiles.d(5) */ - tmpfilesd(); + run_interactive(_PATH_TMPFILES, "Creating required directories and files"); /* Set BOOT_TIME UTMP entry */ utmp_set_boot(); diff --git a/src/Makefile.am b/src/Makefile.am index ff3aca05..7f911c9a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,7 +8,7 @@ AM_LDFLAGS = -export-dynamic endif sbin_PROGRAMS = finit initctl -pkglibexec_PROGRAMS = getty logit runparts +pkglibexec_PROGRAMS = getty logit runparts tmpfiles if SULOGIN pkglibexec_PROGRAMS += sulogin endif @@ -43,6 +43,13 @@ sulogin_SOURCES = sulogin.c sulogin_CFLAGS = -W -Wall -Wextra -std=gnu99 sulogin_LDADD = -lcrypt +tmpfiles_SOURCES = tmpfiles.c helpers.c util.c exec.c log.c \ + svc.c sig.c sm.c api.c mount.c service.c schedule.c cond.c cond-w.c pid.c plugin.c \ + utmp-api.c client.c cgroup.c mdadm.c tty.c iwatch.c conf.c devmon.c logrotate.c +tmpfiles_CFLAGS = -W -Wall -Wextra -std=gnu99 -D__FINIT__ +tmpfiles_CFLAGS += $(lite_CFLAGS) $(uev_CFLAGS) +tmpfiles_LDADD = $(lite_LIBS) $(uev_LIBS) + logit_SOURCES = logit.c logrotate.c logit_CFLAGS = -W -Wall -Wextra -Wno-unused-parameter -std=gnu99 logit_CFLAGS += $(lite_CFLAGS) @@ -66,7 +73,6 @@ finit_SOURCES = api.c cgroup.c cgroup.h \ sig.c sig.h \ sm.c sm.h \ svc.c svc.h \ - tmpfiles.c tmpfiles.h \ tty.c tty.h \ util.c util.h \ utmp-api.c utmp-api.h diff --git a/src/finit.h b/src/finit.h index b536f887..04ca5597 100644 --- a/src/finit.h +++ b/src/finit.h @@ -59,6 +59,7 @@ #define _PATH_RUNPARTS FINIT_EXECPATH_ "/runparts" #define _PATH_SULOGIN FINIT_EXECPATH_ "/sulogin" #define _PATH_GETTY FINIT_EXECPATH_ "/getty" +#define _PATH_TMPFILES FINIT_EXECPATH_ "/tmpfiles" #define CMD_SIZE 1024 #define LINE_SIZE 1024 diff --git a/src/tmpfiles.c b/src/tmpfiles.c index 671d6838..62e7d97d 100644 --- a/src/tmpfiles.c +++ b/src/tmpfiles.c @@ -23,12 +23,48 @@ #include "config.h" /* Generated by configure script */ +#include +#include +#include +#include +#include +#include #include -#include "finit.h" + +#include +#include +#ifdef _LIBITE_LITE +# include +#else +# include +#endif + +#include "svc.h" #include "helpers.h" -#include "tmpfiles.h" +#include "log.h" #include "util.h" +int debug; +int runlevel; +char *osheading; +svc_t *wdog; +uev_ctx_t *ctx; +int syncsec; +int rescue; +char *network; +int cfglevel; +char *finit_rcsd; +char *sdown; +char *hostname; +int bootstrap; +int single; +int readiness; +char *finit_conf; +char *fstab; +int prevlevel; +int cmdlevel; +int kerndebug; + static int glob_do(const char *path, int (*cb)(const char *)) { int rc = 0; @@ -470,7 +506,7 @@ static void tmpfiles(char *line) * before that to have Finit specific ones sorted first, and * a configure prefix specific one after that for user needs. */ -void tmpfilesd(void) +int main(int argc, char *argv[]) { /* in priority order */ char *dir[] = { diff --git a/src/tmpfiles.h b/src/tmpfiles.h deleted file mode 100644 index 440274bd..00000000 --- a/src/tmpfiles.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Limited tmpfiles.d implementation - * - * Copyright (c) 2024 Joachim Wiberg - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef TMPFILES_H_ -#define TMPFILES_H_ - -#include -#include -#include -#include - -#include -#include -#ifdef _LIBITE_LITE -# include -#else -# include -#endif - -void tmpfilesd(void); - -#endif /* TMPFILES_H_ */