diff --git a/configure.ac b/configure.ac index 132ddceb..432cb3df 100644 --- a/configure.ac +++ b/configure.ac @@ -34,7 +34,7 @@ AC_TYPE_UINT32_T # Check for required libraries PKG_CHECK_MODULES([uev], [libuev >= 1.5.2]) -PKG_CHECK_MODULES([lite], [libite >= 1.8.2]) +PKG_CHECK_MODULES([lite], [libite >= 1.9.1]) # Check for configured Finit features AC_ARG_ENABLE(emergency_shell, diff --git a/plugins/alsa-utils.c b/plugins/alsa-utils.c index 52593aa8..6a18b90f 100644 --- a/plugins/alsa-utils.c +++ b/plugins/alsa-utils.c @@ -26,11 +26,11 @@ #include "helpers.h" #include "plugin.h" -#define ALSACTL "/usr/sbin/alsactl" +#define ALSACTL "alsactl" static void save(void *arg) { - if (fexist(ALSACTL)) { + if (whichp(ALSACTL)) { _d("Saving sound settings ..."); run_interactive(ALSACTL " -g store", "Saving sound settings"); } @@ -38,7 +38,7 @@ static void save(void *arg) static void restore(void *arg) { - if (fexist(ALSACTL)) { + if (whichp(ALSACTL)) { _d("Restoring sound settings ..."); run_interactive(ALSACTL " -g restore", "Restoring sound settings"); } diff --git a/plugins/x11-common.c b/plugins/x11-common.c index 63d1a78e..86d02873 100644 --- a/plugins/x11-common.c +++ b/plugins/x11-common.c @@ -54,8 +54,8 @@ static void setup(void *arg) makedir("/tmp/.X11-unix", 01777); makedir("/tmp/.ICE-unix", 01777); - if (fexist("/sbin/restorecon")) - run("/sbin/restorecon /tmp/.ICE-unix /tmp/.X11-unix"); + if (whichp("restorecon")) + run("restorecon /tmp/.ICE-unix /tmp/.X11-unix"); umask(022); } diff --git a/src/finit.c b/src/finit.c index 60da68c7..2e6e1d5e 100644 --- a/src/finit.c +++ b/src/finit.c @@ -152,7 +152,7 @@ static void networking(void) } /* Debian/Ubuntu/Busybox/RH/Suse */ - if (!fexist("/sbin/ifup")) + if (!whichp("ifup")) goto done; fp = fopen("/etc/network/interfaces", "r"); @@ -176,7 +176,7 @@ static void networking(void) if (!ifname) continue; - snprintf(cmd, 80, "/sbin/ifup %s", ifname); + snprintf(cmd, 80, "ifup %s", ifname); run_interactive(cmd, "Bringing up interface %s", ifname); i++; } @@ -278,8 +278,8 @@ int main(int argc, char* argv[]) */ if (!fismnt("/dev")) mount("udev", "/dev", "devtmpfs", MS_RELATIME, "size=10%,nr_inodes=61156,mode=755"); - else if (fexist("/sbin/udevadm")) - run_interactive("/sbin/udevadm info --cleanup-db", "Cleaning up udev db"); + else if (whichp("udevadm")) + run_interactive("udevadm info --cleanup-db", "Cleaning up udev db"); /* Some systems use /dev/pts */ makedir("/dev/pts", 0755); @@ -305,23 +305,23 @@ int main(int argc, char* argv[]) /* * Populate /dev and prepare for runtime events from kernel. */ - if (fexist("/sbin/mdev")) { + if (whichp("mdev")) { /* Embedded Linux systems usually have BusyBox mdev */ if (log_is_debug()) touch("/dev/mdev.log"); - devfsd = "/sbin/mdev -s"; + devfsd = "mdev -s"; } else { - if (fexist("/sbin/udevd")) - devfsd = "/sbin/udevd --daemon"; + if (whichp("udevd")) + devfsd = "udevd --daemon"; else devfsd = "/lib/systemd/systemd-udevd --daemon"; } run_interactive(devfsd, "Populating device tree"); - if (fexist("/sbin/udevadm")) { - run("/sbin/udevadm trigger --action=add --type=subsystems"); - run("/sbin/udevadm trigger --action=add --type=devices"); - run("/sbin/udevadm settle --timeout=120"); + if (whichp("udevadm")) { + run("udevadm trigger --action=add --type=subsystems"); + run("udevadm trigger --action=add --type=devices"); + run("udevadm settle --timeout=120"); } /* diff --git a/src/service.c b/src/service.c index d3d73e40..fa546e01 100644 --- a/src/service.c +++ b/src/service.c @@ -148,17 +148,17 @@ static int service_start(svc_t *svc) if (!svc) return 1; + /* Ignore if finit is SIGSTOP'ed */ + if (is_norespawn()) + return 1; + /* Don't try and start service if it doesn't exist. */ - if (!fexist(svc->cmd) && !svc->inetd.cmd) { + if (!whichp(svc->cmd) && !svc->inetd.cmd) { print(1, "Service %s does not exist!", svc->cmd); svc_missing(svc); return 1; } - /* Ignore if finit is SIGSTOP'ed */ - if (is_norespawn()) - return 1; - if (svc_is_daemon(svc) || svc_is_inetd(svc)) print_desc("Starting ", svc->desc); else @@ -284,7 +284,6 @@ static int service_start(svc_t *svc) #endif if (svc->log) waitpid(pid, NULL, 0); - exit(status); } else if (log_is_debug()) { char buf[CMD_SIZE] = "";