Compare commits

..
5 Commits
Author SHA1 Message Date
Joachim Nilsson 2b2fcb740c Fix installation paths and update README on building, bump version
The installation path for plugins was encoded wrong in the finit binary
if *not* unset, i.e., "prefix=".

Updated the README with information on all build related environment
variables.  Much of it is perhaps only needed for packagers and
distributions.

New version bump, v1.2 already.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-27 09:33:55 +02:00
Joachim Nilsson 7542f4e199 Update ChangeLog and bump version for release. 2012-09-26 23:17:18 +02:00
Joachim Nilsson 1fece1f9b5 Work around compiler error for breaking strict-aliasing rules
This commit fixes the following warning on an ARM eabi/uClibc system.
helpers.c:86: error: dereferencing pointer 'a' does break strict-aliasing rules

The fix is trivial. Simply set IPv4 addressing scheme in the
struct ifreq instead of the struct sockaddr_in, whic is just
a pointer into the same ifreq anyway.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-26 23:10:53 +02:00
Joachim Nilsson 814ff1f77e Fix build problem on ARM eabi/uClibc by removing unused Linux header file.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-26 23:00:46 +02:00
Joachim Nilsson fbfffbc9a4 Eliminate name clash with system signal.h header file.
Tried to solve the signal.h name clash by using #include_next, but
seeing as this is not recommended[1] and breaks builds on some cross
compilers, the files were simply renamed: signal.[ch] --> sig.[ch]

[1] - http://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-26 22:57:25 +02:00
10 changed files with 110 additions and 24 deletions
+11 -3
View File
@@ -1,7 +1,15 @@
1.0 (UNRELEASED) 1.2 (20120927)
- Fix installation paths encoded in finit binary
- Update README with section on building and enviroment variables
1.1 (20120927)
- Build fixes for ARM eabi/uClibc
- Rename signal.[ch]-->sig.[ch] to avoid name clash w/ system headers
1.0 (20120926)
- New plugin based system for all odd extensions
- New service monitor that restarts services if they die
- New maintainer at GitHub http://github.com/troglobit/finit - New maintainer at GitHub http://github.com/troglobit/finit
- Make the unused finit.c finit-org.c for archival purposes
- Make finit-alt.c the new default finit.c
- Add standard LICENSE and AUTHORS files - Add standard LICENSE and AUTHORS files
- New focus: embedded systems and small headless servers - New focus: embedded systems and small headless servers
+10 -8
View File
@@ -25,15 +25,22 @@
# Top directory for building complete system, fall back to this directory # Top directory for building complete system, fall back to this directory
ROOTDIR ?= $(shell pwd) ROOTDIR ?= $(shell pwd)
# Installation paths, always prepended with DESTDIR if set
prefix ?= /usr/local
sysconfdir ?= /etc
datadir = $(prefix)/share/doc/finit
mandir = $(prefix)/share/man/man8
# Plugin directory, fall back to this directory if unset in environment # Plugin directory, fall back to this directory if unset in environment
PLUGIN_DIR ?= /lib/finit/plugins PLUGIN_DIR ?= $(prefix)/lib/finit/plugins
#VERSION ?= $(shell git tag -l | tail -1) #VERSION ?= $(shell git tag -l | tail -1)
VERSION ?= 1.0 VERSION ?= 1.2
EXEC = finit EXEC = finit
PKG = $(EXEC)-$(VERSION) PKG = $(EXEC)-$(VERSION)
ARCHIVE = $(PKG).tar.xz ARCHIVE = $(PKG).tar.xz
OBJS = finit.o conf.o helpers.o signal.o svc.o plugin.o OBJS = finit.o conf.o helpers.o sig.o svc.o plugin.o
OBJS += strlcpy.o OBJS += strlcpy.o
SRCS = $(OBJS:.o=.c) SRCS = $(OBJS:.o=.c)
DEPS = $(addprefix .,$(SRCS:.c=.d)) DEPS = $(addprefix .,$(SRCS:.c=.d))
@@ -46,11 +53,6 @@ CPPFLAGS += -DPLUGIN_PATH=\"$(PLUGIN_DIR)\"
LDFLAGS += -rdynamic LDFLAGS += -rdynamic
LDLIBS += -ldl LDLIBS += -ldl
prefix ?= /usr/local
sysconfdir ?= /etc
datadir = $(prefix)/share/doc/finit
mandir = $(prefix)/share/man/man8
include common.mk include common.mk
export PLUGIN_DIR ROOTDIR CPPFLAGS export PLUGIN_DIR ROOTDIR CPPFLAGS
+78
View File
@@ -66,6 +66,84 @@ Finit handles SIGUSR1 and SIGUSR2 for reboot and halt, and listens to
/dev/initctl so standard Linux reboot and halt commands should also /dev/initctl so standard Linux reboot and halt commands should also
work. work.
Building
--------
The finit build system does not employ the GNU Configure and Build System,
instead standard makefiles are used. The user is encouraged to make source
code changes, using defines and conditionally building plugins instead to
alter the behavior of finit.
The following environment variables are checked by the makefiles and control
what is built and where resulting binaries are installed.
**ROOTDIR=**
Top directory for building complete system, used in pretty printing
**PLUGINS=**
List of stock finit plugins to build and install.
**PLUGIN_DIR=**
Absolute path to where finit should look for dynamically loadable plugins
at runtime. At installation prepended by ''DESTDIR'' and ''prefix''-
**VERSION=**
Defaults to the currently released version of finit, e.g., 1.2 but can
be overridden by packages to add a suffix or completely alter the version.
**CFLAGS=**
Standard CFLAGS are inherited from the build enviornmant.
**CPPFLAGS=**
Standard CPPFLAGS are inherited from the build enviornmant.
**LDFLAGS=**
Standard LDFLAGS are inherited from the build enviornmant.
**LDLIBS=**
Standard LIBLIBS are inherited from the build enviornmant.
**prefix=**
Path to where resulting binaries should install to. Used in concert
with the ''DESTDIR'' variable. Defaults to /usr/local
**sysconfdir=**
Used after ''prefix'' to create the path to finit.conf configuration
file. Defaults to /etc
**DESTDIR=**
Used by packagers and distributions when building a relocatable
bundle of files. Alwawys prepended to the ''prefix'' destination
directory.
**Example**::
$ tar xfJ finit-1.2.tar.xz
$ PLUGINS="initctl.so hwclock.so" prefix= DESTDIR=/tmp/finit/dst \
make -C finit-1.2/ clean install
make: Entering directory `/home/troglobit/finit-1.2'
CC finit.o
CC conf.o
CC helpers.o
CC sig.o
CC svc.o
CC plugin.o
CC strlcpy.o
LINK finit
CC plugins/initctl.o
PLUGIN plugins/initctl.so
CC plugins/hwclock.o
PLUGIN plugins/hwclock.so
INSTALL /tmp/finit/dst/sbin/finit
INSTALL /tmp/finit/dst/lib/finit/plugins/initctl.so
INSTALL /tmp/finit/dst/lib/finit/plugins/hwclock.so
make: Leaving directory `/home/troglobit/finit-1.2'
In this example the finit-1.2.tar.xz archive is unpacked to the user's
home directory, built and installed to a temporary staging directory.
The enviroment variables ''prefix'', ''DESTDIR'' and ''PLUGINS'' are all
changed to suit this particular build.
Debugging Debugging
--------- ---------
+1 -2
View File
@@ -25,7 +25,6 @@
#include <sys/mount.h> #include <sys/mount.h>
#include <ctype.h> #include <ctype.h>
#include <dirent.h> #include <dirent.h>
#include <linux/fs.h>
#include <sys/stat.h> /* umask(), mkdir() */ #include <sys/stat.h> /* umask(), mkdir() */
#include "finit.h" #include "finit.h"
@@ -33,7 +32,7 @@
#include "private.h" #include "private.h"
#include "plugin.h" #include "plugin.h"
#include "svc.h" #include "svc.h"
#include "signal.h" #include "sig.h"
int debug = 0; int debug = 0;
int verbose = 1; int verbose = 1;
+2 -2
View File
@@ -47,7 +47,7 @@
#include "finit.h" #include "finit.h"
#include "helpers.h" #include "helpers.h"
#include "private.h" #include "private.h"
#include "signal.h" #include "sig.h"
#define NUM_ARGS 16 #define NUM_ARGS 16
#define NUM_SCRIPTS 128 /* ought to be enough for anyone */ #define NUM_SCRIPTS 128 /* ought to be enough for anyone */
@@ -83,7 +83,7 @@ void ifconfig(char *name, char *inet, char *mask, int up)
memset(&ifr, 0, sizeof (ifr)); memset(&ifr, 0, sizeof (ifr));
strlcpy(ifr.ifr_name, name, IFNAMSIZ); strlcpy(ifr.ifr_name, name, IFNAMSIZ);
a->sin_family = AF_INET; ifr.ifr_addr.sa_family = AF_INET;
if (up) { if (up) {
inet_aton(inet, &a->sin_addr); inet_aton(inet, &a->sin_addr);
+1 -1
View File
@@ -2,7 +2,7 @@
CFLAGS = -fPIC -g -Os CFLAGS = -fPIC -g -Os
CPPFLAGS += -I.. CPPFLAGS += -I..
LDFLAGS = -shared LDFLAGS = -shared
PLUGINS = initctl.so alsa-utils.so bootmisc.so dbus.so hwclock.so \ PLUGINS ?= initctl.so alsa-utils.so bootmisc.so dbus.so hwclock.so \
resolvconf.so urandom.so x11-common.so resolvconf.so urandom.so x11-common.so
DEPS = $(addprefix .,$(PLUGINS:.so=.d)) DEPS = $(addprefix .,$(PLUGINS:.so=.d))
+1 -1
View File
@@ -23,11 +23,11 @@
*/ */
#include <errno.h> #include <errno.h>
#include <signal.h>
#include <string.h> #include <string.h>
#include "finit.h" #include "finit.h"
#include "plugin.h" #include "plugin.h"
#include "signal.h"
#define INIT_MAGIC 0x03091969 #define INIT_MAGIC 0x03091969
#define INIT_CMD_RUNLVL 1 #define INIT_CMD_RUNLVL 1
+1 -2
View File
@@ -38,7 +38,6 @@
* It activates the kbrequest action. * It activates the kbrequest action.
*/ */
#include <signal.h>
#include <sys/reboot.h> #include <sys/reboot.h>
#include <sys/wait.h> #include <sys/wait.h>
@@ -46,7 +45,7 @@
#include "helpers.h" #include "helpers.h"
#include "plugin.h" #include "plugin.h"
#include "private.h" #include "private.h"
#include "signal.h" #include "sig.h"
static int stopped = 0; static int stopped = 0;
+4 -4
View File
@@ -22,10 +22,10 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#ifndef FINIT_SIGNAL_H_ #ifndef FINIT_SIG_H_
#define FINIT_SIGNAL_H_ #define FINIT_SIG_H_
#include_next <signal.h> #include <signal.h>
#define SYNC_SHUTDOWN "/var/lock/finit.shutdown" #define SYNC_SHUTDOWN "/var/lock/finit.shutdown"
#define SYNC_STOPPED "/var/lock/finit.stopped" #define SYNC_STOPPED "/var/lock/finit.stopped"
@@ -59,7 +59,7 @@ int sig_stopped (void);
void sig_init (void); void sig_init (void);
void sig_setup (void); void sig_setup (void);
#endif /* FINIT_SIGNAL_H_ */ #endif /* FINIT_SIG_H_ */
/** /**
* Local Variables: * Local Variables:
+1 -1
View File
@@ -28,7 +28,7 @@
#include "finit.h" #include "finit.h"
#include "helpers.h" #include "helpers.h"
#include "private.h" #include "private.h"
#include "signal.h" #include "sig.h"
#include "svc.h" #include "svc.h"
/* The registered services are kept in shared memory for easy read-only access /* The registered services are kept in shared memory for easy read-only access