Add insserv

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4830 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Ross Burton 2008-07-04 15:07:33 +00:00
parent bd267516ed
commit 285ac1c213
7 changed files with 243 additions and 0 deletions

View File

@ -0,0 +1,5 @@
do_rootfs[depends] += "insserv-native:do_populate_staging"
run_insserv () {
insserv -p ${IMAGE_ROOTFS}/etc/init.d -c ${STAGING_ETCDIR_NATIVE}/insserv.conf
}
ROOTFS_POSTPROCESS_COMMAND += " run_insserv ; "

View File

@ -0,0 +1,89 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 40_segfault_virtprov.dpatch by Petter Reinholdtsen
Avoid segfault when an enabled service provide a virtual system
facility.
@DPATCH@
--- insserv/insserv.c
+++ insserv/insserv.c 2008-02-01 11:43:45.634618329 +0100
@@ -166,7 +166,7 @@ typedef struct pwd_struct {
static list_t pwd = { &(pwd), &(pwd) }, * topd = &(pwd);
-static void pushd(const char *const __restrict path);
+static void pushd(const char *const __restrict path) __attribute__((nonnull(1)));
static void pushd(const char *const path)
{
pwd_t * dir;
@@ -305,13 +305,13 @@ out:
return getserv(ptr);
}
-static serv_t * findserv(const char *const __restrict serv) __attribute__((nonnull(1)));
+static serv_t * findserv(const char *const __restrict serv);
static serv_t * findserv(const char *const serv)
{
list_t * ptr;
serv_t * ret = (serv_t*)0;
- if (!serv)
+ if (serv == (const char*)0)
goto out;
list_for_each(ptr, serv_start) {
@@ -334,6 +334,9 @@ static void rememberreq(serv_t *serv, ui
list_t * ptr;
uint old = bit;
+ if (!tmp)
+ error("%s", strerror(errno));
+
while ((token = strsep(&tmp, delimeter))) {
boolean found = false;
req_t * this;
@@ -399,6 +402,9 @@ static void reversereq(const serv_t * se
char * rev = strdupa(list);
uint old = bit;
+ if (!rev)
+ error("%s", strerror(errno));
+
while ((dep = strsep(&rev, delimeter)) && *dep) {
serv_t * tmp;
list_t * ptr;
@@ -437,7 +443,7 @@ static void reversereq(const serv_t * se
/*
* Check required services for name
*/
-static boolean chkrequired(const char *const __restrict name) __attribute__((nonnull(1)));
+static boolean chkrequired(const char *const __restrict name);
static boolean chkrequired(const char *const name)
{
serv_t * serv = findserv(name);
--- insserv/listing.h
+++ insserv/listing.h 2008-02-01 11:40:45.347748072 +0100
@@ -97,11 +97,11 @@ extern int makeprov(const char *__restri
extern void setorder(const char *__restrict script, const int order, boolean recursive) __attribute__((nonnull(1)));
extern int getorder(const char *__restrict script) __attribute__((nonnull(1)));
extern boolean notincluded(const char *__restrict script, const int runlevel) __attribute__((nonnull(1)));
-extern boolean foreach(const char **__restrict script, int *__restrict order, const int runlevel) __attribute__((nonnull(1,2)));
-extern void virtprov(const char *__restrict virt, const char *__restrict real) __attribute__((nonnull(1,2)));
+extern boolean foreach(const char **__restrict script, int *__restrict order, const int runlevel) __attribute__((nonnull(2)));
+extern void virtprov(const char *__restrict virt, const char *__restrict real) __attribute__((nonnull(1)));
extern const char * getscript(const char *__restrict prov) __attribute__((nonnull(1)));
extern const char * getprovides(const char *__restrict script) __attribute__((nonnull(1)));
-extern boolean listscripts(const char **__restrict script, const int lvl) __attribute__((nonnull(1)));
+extern boolean listscripts(const char **__restrict script, const int lvl);
extern int maxorder;
extern boolean is_loop_detected(void);
@@ -116,7 +116,7 @@ extern int map_has_runlevels(void);
extern int map_runlevel_to_lvl (const int runlevel);
extern int map_key_to_lvl(const char key);
-static inline char * xstrdup(const char *__restrict s) __attribute__((always_inline,nonnull(1)));
+static inline char * xstrdup(const char *__restrict s) __attribute__((always_inline));
static inline char * xstrdup(const char * s)
{
char * r;

View File

@ -0,0 +1,20 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 40_loopnochangemsg.dpatch by Petter Reinholdtsen
Make it more obvious that introducing a loop will not change the
existing boot sequence. Thanks to Frans Pop for the rationale for
this change.
@DPATCH@
--- insserv-1.11.0.orig/insserv.c
+++ insserv-1.11.0/insserv.c
@@ -2647,7 +2647,7 @@
follow_all();
if (is_loop_detected() && !ignore)
- error("exiting now!\n");
+ error("exiting without changing boot order!\n");
/*
* Re-order some well known scripts to get

View File

@ -0,0 +1,41 @@
#
# All local filesystems are mounted (done during boot phase)
#
$local_fs mountall
#
# Low level networking (ethernet card)
#
$network networking +pcmcia +hotplug
#
# Named is operational
#
$named +named +dnsmasq +lwresd $network
#
# All remote filesystems are mounted (note in some cases /usr may
# be remote. Most applications that care will probably require
# both $local_fs and $remote_fs)
#
$remote_fs $local_fs +mountnfs
#
# System logger is operational
#
$syslog sysklogd
#
# SunRPC portmapper available
#
$portmap portmap
#
# The system time has been set correctly
#
$time hwclock
#
# Services which need to be interactive
#
<interactive> hostname udev

View File

@ -0,0 +1,58 @@
=== modified file 'Makefile'
--- old/Makefile 2008-06-24 14:49:47 +0000
+++ new/Makefile 2008-06-24 15:56:15 +0000
@@ -7,10 +7,10 @@
INITDIR = /etc/init.d
INSCONF = /etc/insserv.conf
#DESTDIR = /tmp/root
-#DEBUG = -DDEBUG=1 -Wpacked
+DEBUG = -DDEBUG=1 -Wpacked
#LOOPS = -DIGNORE_LOOPS=1
DEBUG =
-ISSUSE = -DSUSE
+#ISSUSE = -DSUSE
DESTDIR =
VERSION = 1.11.0
DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
@@ -28,7 +28,9 @@
COPTS = -O2
endif
endif
- CFLAGS = -Wall $(COPTS) $(DEBUG) $(LOOPS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \
+COPTS += -g
+
+ MY_CFLAGS = $(CFLAGS) -Wall $(COPTS) $(DEBUG) $(LOOPS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \
$(ISSUSE) -DINITDIR=\"$(INITDIR)\" -DINSCONF=\"$(INSCONF)\" -pipe
CLOOP = -falign-loops=0
CC = gcc
@@ -58,13 +60,13 @@
all: $(TODO)
listing.o: listing.c listing.h .system
- $(CC) $(CFLAGS) $(CLOOP) -c $<
+ $(CC) $(MY_CFLAGS) $(CLOOP) -c $<
insserv.o: insserv.c listing.h .system
- $(CC) $(CFLAGS) $(CLOOP) -c $<
+ $(CC) $(MY_CFLAGS) $(CLOOP) -c $<
insserv: insserv.o listing.o
- $(CC) $(CFLAGS) -Wl,-O,3,--relax -o $@ $^
+ $(CC) $(MY_CFLAGS) -Wl,-O,3,--relax -o $@ $^
ifeq ($(ISSUSE),-DSUSE)
insserv.8: insserv.8.in .system
@@ -86,10 +88,10 @@
-include .depend.listing .depend.insserv
.depend.listing:
- @$(CC) $(CFLAGS) -M listing.c >$@ 2>/dev/null
+ @$(CC) $(MY_CFLAGS) -M listing.c >$@ 2>/dev/null
.depend.insserv:
- @$(CC) $(CFLAGS) -M insserv.c >$@ 2>/dev/null
+ @$(CC) $(MY_CFLAGS) -M insserv.c >$@ 2>/dev/null
install: $(TODO)
$(MKDIR) $(SBINDIR)

View File

@ -0,0 +1,17 @@
LICENSE = "GPL"
SECTION = "base"
SRC_URI = "ftp://ftp.suse.com/pub/projects/init/insserv-${PV}.tar.gz \
file://40_segfault_virtprov.dpatch;patch=1 \
file://42_loopnochangemsg.dpatch;patch=1 \
file://make.patch;patch=1 \
file://insserv.conf"
S = "${WORKDIR}/insserv-${PV}"
inherit native
do_stage () {
oe_runmake 'DESTDIR=${STAGING_DIR_NATIVE}' install
install -m0644 ${WORKDIR}/insserv.conf ${STAGING_ETCDIR_NATIVE}/insserv.conf
}

View File

@ -0,0 +1,13 @@
LICENSE = "GPL"
SECTION = "base"
SRC_URI = "ftp://ftp.suse.com/pub/projects/init/${PN}-${PV}.tar.gz \
file://40_segfault_virtprov.dpatch;patch=1 \
file://42_loopnochangemsg.dpatch;patch=1 \
file://make.patch;patch=1 \
file://insserv.conf"
do_install () {
oe_runmake 'DESTDIR=${D}' install
install -m0644 ${WORKDIR}/insserv.conf ${D}${sysconfdir}/insserv.conf
}