Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions plugins/bootmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "finit.h"
#include "helpers.h"
#include "plugin.h"
#include "tmpfiles.h"
#include "util.h"
#include "utmp-api.h"

Expand Down Expand Up @@ -163,7 +162,7 @@ static void setup(void *arg)
kernel_links();

/* Create all system tmpfiles.d(5) */
tmpfilesd();
run_interactive(_PATH_TMPFILES " --create", "Creating required directories and files");

/* Set BOOT_TIME UTMP entry */
utmp_set_boot();
Expand Down
10 changes: 8 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/finit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions src/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define FINIT_HELPERS_H_

#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdlib.h>
Expand Down Expand Up @@ -206,6 +207,22 @@ static inline char *fgetval(const char *line, const char *key, char *sep)
return realloc(copy, len);
}

static inline int is_dir_empty(const char *path)
{
struct dirent **namelist;
int num;

num = scandir(path, &namelist, NULL, NULL);
if (num < 0)
return 0;

for (int i = 0; i < num; i++)
free(namelist[i]);
free(namelist);

return num >= 3;
}

#endif /* FINIT_HELPERS_H_ */

/**
Expand Down
Loading