mirror of
https://github.com/troglobit/finit.git
synced 2026-11-09 16:21:24 +00:00
resolvconf: Initial cleanup of plugin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
4eb5f8a0dc
commit
83af7e8e9d
1 file changed
+10
-28
+10
-28
@@ -27,43 +27,25 @@
|
|||||||
#include "../helpers.h"
|
#include "../helpers.h"
|
||||||
#include "../plugin.h"
|
#include "../plugin.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* No need to clean up files in /etc/resolvconf/run/interface/*
|
||||||
|
* this is already taken care of by bootclean
|
||||||
|
*/
|
||||||
static void setup(void *UNUSED(arg))
|
static void setup(void *UNUSED(arg))
|
||||||
{
|
{
|
||||||
#ifdef USE_ETC_RESOLVCONF_RUN
|
|
||||||
DIR *dir;
|
|
||||||
struct dirent *d;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_d("Setting up the resolver ...");
|
_d("Setting up the resolver ...");
|
||||||
#ifdef USE_ETC_RESOLVCONF_RUN
|
mkpath("/etc/resolvconf", 0755);
|
||||||
makepath("/dev/shm/network");
|
mkpath("/etc/resolvconf/run", 0755);
|
||||||
makepath("/dev/shm/resolvconf/interface");
|
mkpath("/dev/shm/network", 0755);
|
||||||
|
mkpath("/dev/shm/resolvconf/interface", 0755);
|
||||||
if ((dir = opendir("/etc/resolvconf/run/interface")) != NULL) {
|
mkpath("/var/run/resolvconf", 0755);
|
||||||
while ((d = readdir(dir)) != NULL) {
|
mkpath("/var/run/resolvconf/interface", 0755);
|
||||||
if (isalnum(d->d_name[0]))
|
|
||||||
continue;
|
|
||||||
snprintf(line, sizeof(line),
|
|
||||||
"/etc/resolvconf/run/interface/%s", d->d_name);
|
|
||||||
unlink(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir(dir);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_VAR_RUN_RESOLVCONF
|
|
||||||
makepath("/var/run/resolvconf/interface");
|
|
||||||
symlink("../../../etc/resolv.conf", "/var/run/resolvconf/resolv.conf");
|
symlink("../../../etc/resolv.conf", "/var/run/resolvconf/resolv.conf");
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_ETC_RESOLVCONF_RUN
|
|
||||||
touch("/etc/resolvconf/run/enable-updates");
|
touch("/etc/resolvconf/run/enable-updates");
|
||||||
|
|
||||||
chdir("/etc/resolvconf/run/interface");
|
chdir("/etc/resolvconf/run/interface");
|
||||||
run_parts("/etc/resolvconf/update.d", "-i");
|
run_parts("/etc/resolvconf/update.d", "-i");
|
||||||
chdir("/");
|
chdir("/");
|
||||||
#endif /* USE_ETC_RESOLVCONF_RUN */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
|
|||||||
Reference in new issue
Block a user