aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-05-29 14:15:12 +0100
committerRoy Marples <roy@marples.name>2009-05-29 14:15:12 +0100
commit83e82c452e89bf27de2a7b01bc2356c9050b2a18 (patch)
treea4f8843c7c02a6b51abb06a16f0a9a6665facc71 /src
parent9c5faf231ccf50695270034ab63f747fa2bef1d7 (diff)
parenta518d34549fd80268e9c70d2300808b63c54825c (diff)
Merge branch 'master' of ssh://roy.marples.name/var/git/openrc
Diffstat (limited to 'src')
-rw-r--r--src/librc/Makefile1
-rw-r--r--src/librc/librc-depend.c9
-rw-r--r--src/librc/rc.h.in5
-rw-r--r--src/rc/Makefile12
-rw-r--r--src/rc/rc-misc.c8
-rw-r--r--src/rc/rc.c4
-rw-r--r--src/rc/runscript.c19
-rw-r--r--src/rc/start-stop-daemon.c4
8 files changed, 28 insertions, 34 deletions
diff --git a/src/librc/Makefile b/src/librc/Makefile
index 902b14e9..d3f9cc41 100644
--- a/src/librc/Makefile
+++ b/src/librc/Makefile
@@ -18,6 +18,7 @@ include ${MK}/debug.mk
SED_CMD= -e 's:@PREFIX@:${PREFIX}:g'
SED_CMD+= -e 's:@LIB@:${LIBNAME}:g'
SED_CMD+= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
+SED_CMD+= -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
_PKG_PREFIX_SH= if test -n "${PKG_PREFIX}" && test "${PKG_PREFIX}" != "/" && test "${PKG_PREFIX}" != "${PREFIX}"; then \
echo "-e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'"; \
else \
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index 36d8782e..97421fab 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -31,7 +31,7 @@
#include "librc.h"
-#define GENDEP RC_LIBDIR "/sh/gendepends.sh"
+#define GENDEP RC_LIBEXECDIR "/sh/gendepends.sh"
#define RC_DEPCONFIG RC_SVCDIR "/depconfig"
@@ -647,6 +647,7 @@ static const DEPPAIR deppairs[] = {
static const char *const depdirs[] =
{
+ RC_SVCDIR,
RC_SVCDIR "/starting",
RC_SVCDIR "/started",
RC_SVCDIR "/stopping",
@@ -742,10 +743,10 @@ rc_deptree_update(void)
bool retval = true;
const char *sys = rc_sys();
- /* Some init scripts need RC_LIBDIR to source stuff
+ /* Some init scripts need RC_LIBEXECDIR to source stuff
Ideally we should be setting our full env instead */
- if (!getenv("RC_LIBDIR"))
- setenv("RC_LIBDIR", RC_LIBDIR, 0);
+ if (!getenv("RC_LIBEXECDIR"))
+ setenv("RC_LIBEXECDIR", RC_LIBEXECDIR, 0);
/* Phase 1 - source all init scripts and print dependencies */
if (!(fp = popen(GENDEP, "r")))
diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in
index cb5258c5..89ebfedd 100644
--- a/src/librc/rc.h.in
+++ b/src/librc/rc.h.in
@@ -36,11 +36,12 @@ __BEGIN_DECLS
#define RC_SYSCONFDIR "@SYSCONFDIR@"
#define RC_LIBDIR "@PREFIX@/@LIB@/rc"
-#define RC_SVCDIR RC_LIBDIR "/init.d"
-#define RC_PLUGINDIR RC_LIBDIR "/plugins"
+#define RC_LIBEXECDIR "@LIBEXECDIR@"
+#define RC_SVCDIR RC_LIBEXECDIR "/init.d"
#define RC_RUNLEVELDIR RC_SYSCONFDIR "/runlevels"
#define RC_INITDIR RC_SYSCONFDIR "/init.d"
#define RC_CONFDIR RC_SYSCONFDIR "/conf.d"
+#define RC_PLUGINDIR RC_LIBDIR "/plugins"
/* PKG_PREFIX is where packages are installed if different from the base OS
* On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD
diff --git a/src/rc/Makefile b/src/rc/Makefile
index 378f8e98..b5fc189f 100644
--- a/src/rc/Makefile
+++ b/src/rc/Makefile
@@ -8,7 +8,7 @@ CLEANFILES= version.h
BINDIR= ${PREFIX}/bin
SBINDIR= ${PREFIX}/sbin
-LINKDIR= ${PREFIX}/${LIBNAME}/${PROG}
+LINKDIR= ${LIBEXECDIR}
BINLINKS= rc-status
SBINLINKS= rc-service rc-update runscript start-stop-daemon
@@ -37,21 +37,13 @@ LDADD+= -lutil -lrc -leinfo
MK= ../../mk
include ${MK}/debug.mk
include ${MK}/prog.mk
+include ${MK}/git.mk
include ${MK}/cc.mk
include ${MK}/${MKTERMCAP}.mk
LDADD+= ${LIBDL} ${LIBKVM}
include ${MK}/${MKPAM}.mk
-_GITVER_SH= if git rev-parse --short HEAD >/dev/null 2>&1; then \
- printf "."; \
- git rev-parse --short HEAD; \
- else \
- echo ""; \
- fi
-_GITVER!= ${_GITVER_SH}
-GITVER= ${_GITVER}$(shell ${_GITVER_SH})
-
${SRCS}: version.h
version.h:
sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c
index 1cc3dd41..0239f9d4 100644
--- a/src/rc/rc-misc.c
+++ b/src/rc/rc-misc.c
@@ -50,14 +50,15 @@
#include "einfo.h"
#include "rc.h"
#include "rc-misc.h"
+#include "version.h"
#define PROFILE_ENV RC_SYSCONFDIR "/profile.env"
-#define SYS_WHITELIST RC_LIBDIR "/conf.d/env_whitelist"
+#define SYS_WHITELIST RC_LIBEXECDIR "/conf.d/env_whitelist"
#define USR_WHITELIST RC_SYSCONFDIR "/conf.d/env_whitelist"
#define RC_CONF RC_SYSCONFDIR "/rc.conf"
#define RC_CONF_OLD RC_SYSCONFDIR "/conf.d/rc"
-#define PATH_PREFIX RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin"
+#define PATH_PREFIX RC_LIBEXECDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin"
static RC_STRINGLIST *rc_conf = NULL;
@@ -221,7 +222,8 @@ env_config(void)
free(e);
}
- setenv("RC_LIBDIR", RC_LIBDIR, 1);
+ setenv("RC_VERSION", VERSION, 1);
+ setenv("RC_LIBEXECDIR", RC_LIBEXECDIR, 1);
setenv("RC_SVCDIR", RC_SVCDIR, 1);
setenv("RC_TMPDIR", RC_SVCDIR "/tmp", 1);
setenv("RC_BOOTLEVEL", RC_LEVEL_BOOT, 1);
diff --git a/src/rc/rc.c b/src/rc/rc.c
index 8e40e1d9..915dc181 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -72,8 +72,8 @@ const char rc_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
#include "version.h"
-#define INITSH RC_LIBDIR "/sh/init.sh"
-#define INITEARLYSH RC_LIBDIR "/sh/init-early.sh"
+#define INITSH RC_LIBEXECDIR "/sh/init.sh"
+#define INITEARLYSH RC_LIBEXECDIR "/sh/init-early.sh"
#define SHUTDOWN "/sbin/shutdown"
#define SULOGIN "/sbin/sulogin"
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index cec7e01f..44da58c5 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -398,10 +398,10 @@ svc_exec(const char *arg1, const char *arg2)
service, strerror(errno));
_exit(EXIT_FAILURE);
} else {
- execl(RC_LIBDIR "/sh/runscript.sh",
- RC_LIBDIR "/sh/runscript.sh",
+ execl(RC_LIBEXECDIR "/sh/runscript.sh",
+ RC_LIBEXECDIR "/sh/runscript.sh",
service, arg1, arg2, (char *) NULL);
- eerror("%s: exec `" RC_LIBDIR "/sh/runscript.sh': %s",
+ eerror("%s: exec `" RC_LIBEXECDIR "/sh/runscript.sh': %s",
service, strerror(errno));
_exit(EXIT_FAILURE);
}
@@ -586,10 +586,9 @@ svc_start_check(void)
fcntl(exclusive_fd, F_SETFD,
fcntl(exclusive_fd, F_GETFD, 0) | FD_CLOEXEC);
- if (state & RC_SERVICE_STARTED) {
- ewarn("WARNING: %s has already been started", applet);
- return;
- } else if (state & RC_SERVICE_INACTIVE && !in_background)
+ if (state & RC_SERVICE_STARTED)
+ ewarnx("WARNING: %s has already been started", applet);
+ else if (state & RC_SERVICE_INACTIVE && !in_background)
ewarnx("WARNING: %s has already started, but is inactive",
applet);
@@ -837,10 +836,8 @@ svc_stop_check(RC_SERVICE *state)
fcntl(exclusive_fd, F_SETFD,
fcntl(exclusive_fd, F_GETFD, 0) | FD_CLOEXEC);
- if (*state & RC_SERVICE_STOPPED) {
- ewarn("WARNING: %s is already stopped", applet);
- return;
- }
+ if (*state & RC_SERVICE_STOPPED)
+ ewarnx("WARNING: %s is already stopped", applet);
rc_service_mark(service, RC_SERVICE_STOPPING);
hook_out = RC_HOOK_SERVICE_STOP_OUT;
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
index bede39bb..58bc23e3 100644
--- a/src/rc/start-stop-daemon.c
+++ b/src/rc/start-stop-daemon.c
@@ -1188,8 +1188,8 @@ start_stop_daemon(int argc, char **argv)
while (*p == ':')
p++;
}
- if (strcmp(token, RC_LIBDIR "/bin") != 0 &&
- strcmp(token, RC_LIBDIR "/sbin") != 0)
+ if (strcmp(token, RC_LIBEXECDIR "/bin") != 0 &&
+ strcmp(token, RC_LIBEXECDIR "/sbin") != 0)
{
len = strlen(token);
if (np != newpath)