diff options
| author | Ross Burton <ross@openedhand.com> | 2008-07-04 15:07:33 +0000 |
|---|---|---|
| committer | Ross Burton <ross@openedhand.com> | 2008-07-04 15:07:33 +0000 |
| commit | 285ac1c2138ad1c192f9cf1e32e12682ca81fff4 (patch) | |
| tree | 820ddf5dffb461044531b3ece1346dde8fa99d03 | |
| parent | bd267516ed45140c21482468fdc7cf749f5bf2cc (diff) | |
| download | poky-285ac1c2138ad1c192f9cf1e32e12682ca81fff4.tar.gz | |
Add insserv
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4830 311d38ba-8fff-0310-9ca6-ca027cbcb966
| -rw-r--r-- | meta/classes/insserv.bbclass | 5 | ||||
| -rw-r--r-- | meta/packages/insserv/files/40_segfault_virtprov.dpatch | 89 | ||||
| -rw-r--r-- | meta/packages/insserv/files/42_loopnochangemsg.dpatch | 20 | ||||
| -rw-r--r-- | meta/packages/insserv/files/insserv.conf | 41 | ||||
| -rw-r--r-- | meta/packages/insserv/files/make.patch | 58 | ||||
| -rw-r--r-- | meta/packages/insserv/insserv-native_1.11.0.bb | 17 | ||||
| -rw-r--r-- | meta/packages/insserv/insserv_1.11.0.bb | 13 |
7 files changed, 243 insertions, 0 deletions
diff --git a/meta/classes/insserv.bbclass b/meta/classes/insserv.bbclass new file mode 100644 index 0000000000..d8e88c70ff --- /dev/null +++ b/meta/classes/insserv.bbclass | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | do_rootfs[depends] += "insserv-native:do_populate_staging" | ||
| 2 | run_insserv () { | ||
| 3 | insserv -p ${IMAGE_ROOTFS}/etc/init.d -c ${STAGING_ETCDIR_NATIVE}/insserv.conf | ||
| 4 | } | ||
| 5 | ROOTFS_POSTPROCESS_COMMAND += " run_insserv ; " | ||
diff --git a/meta/packages/insserv/files/40_segfault_virtprov.dpatch b/meta/packages/insserv/files/40_segfault_virtprov.dpatch new file mode 100644 index 0000000000..9b0081307a --- /dev/null +++ b/meta/packages/insserv/files/40_segfault_virtprov.dpatch | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | #! /bin/sh /usr/share/dpatch/dpatch-run | ||
| 2 | ## 40_segfault_virtprov.dpatch by Petter Reinholdtsen | ||
| 3 | |||
| 4 | Avoid segfault when an enabled service provide a virtual system | ||
| 5 | facility. | ||
| 6 | |||
| 7 | @DPATCH@ | ||
| 8 | --- insserv/insserv.c | ||
| 9 | +++ insserv/insserv.c 2008-02-01 11:43:45.634618329 +0100 | ||
| 10 | @@ -166,7 +166,7 @@ typedef struct pwd_struct { | ||
| 11 | |||
| 12 | static list_t pwd = { &(pwd), &(pwd) }, * topd = &(pwd); | ||
| 13 | |||
| 14 | -static void pushd(const char *const __restrict path); | ||
| 15 | +static void pushd(const char *const __restrict path) __attribute__((nonnull(1))); | ||
| 16 | static void pushd(const char *const path) | ||
| 17 | { | ||
| 18 | pwd_t * dir; | ||
| 19 | @@ -305,13 +305,13 @@ out: | ||
| 20 | return getserv(ptr); | ||
| 21 | } | ||
| 22 | |||
| 23 | -static serv_t * findserv(const char *const __restrict serv) __attribute__((nonnull(1))); | ||
| 24 | +static serv_t * findserv(const char *const __restrict serv); | ||
| 25 | static serv_t * findserv(const char *const serv) | ||
| 26 | { | ||
| 27 | list_t * ptr; | ||
| 28 | serv_t * ret = (serv_t*)0; | ||
| 29 | |||
| 30 | - if (!serv) | ||
| 31 | + if (serv == (const char*)0) | ||
| 32 | goto out; | ||
| 33 | |||
| 34 | list_for_each(ptr, serv_start) { | ||
| 35 | @@ -334,6 +334,9 @@ static void rememberreq(serv_t *serv, ui | ||
| 36 | list_t * ptr; | ||
| 37 | uint old = bit; | ||
| 38 | |||
| 39 | + if (!tmp) | ||
| 40 | + error("%s", strerror(errno)); | ||
| 41 | + | ||
| 42 | while ((token = strsep(&tmp, delimeter))) { | ||
| 43 | boolean found = false; | ||
| 44 | req_t * this; | ||
| 45 | @@ -399,6 +402,9 @@ static void reversereq(const serv_t * se | ||
| 46 | char * rev = strdupa(list); | ||
| 47 | uint old = bit; | ||
| 48 | |||
| 49 | + if (!rev) | ||
| 50 | + error("%s", strerror(errno)); | ||
| 51 | + | ||
| 52 | while ((dep = strsep(&rev, delimeter)) && *dep) { | ||
| 53 | serv_t * tmp; | ||
| 54 | list_t * ptr; | ||
| 55 | @@ -437,7 +443,7 @@ static void reversereq(const serv_t * se | ||
| 56 | /* | ||
| 57 | * Check required services for name | ||
| 58 | */ | ||
| 59 | -static boolean chkrequired(const char *const __restrict name) __attribute__((nonnull(1))); | ||
| 60 | +static boolean chkrequired(const char *const __restrict name); | ||
| 61 | static boolean chkrequired(const char *const name) | ||
| 62 | { | ||
| 63 | serv_t * serv = findserv(name); | ||
| 64 | --- insserv/listing.h | ||
| 65 | +++ insserv/listing.h 2008-02-01 11:40:45.347748072 +0100 | ||
| 66 | @@ -97,11 +97,11 @@ extern int makeprov(const char *__restri | ||
| 67 | extern void setorder(const char *__restrict script, const int order, boolean recursive) __attribute__((nonnull(1))); | ||
| 68 | extern int getorder(const char *__restrict script) __attribute__((nonnull(1))); | ||
| 69 | extern boolean notincluded(const char *__restrict script, const int runlevel) __attribute__((nonnull(1))); | ||
| 70 | -extern boolean foreach(const char **__restrict script, int *__restrict order, const int runlevel) __attribute__((nonnull(1,2))); | ||
| 71 | -extern void virtprov(const char *__restrict virt, const char *__restrict real) __attribute__((nonnull(1,2))); | ||
| 72 | +extern boolean foreach(const char **__restrict script, int *__restrict order, const int runlevel) __attribute__((nonnull(2))); | ||
| 73 | +extern void virtprov(const char *__restrict virt, const char *__restrict real) __attribute__((nonnull(1))); | ||
| 74 | extern const char * getscript(const char *__restrict prov) __attribute__((nonnull(1))); | ||
| 75 | extern const char * getprovides(const char *__restrict script) __attribute__((nonnull(1))); | ||
| 76 | -extern boolean listscripts(const char **__restrict script, const int lvl) __attribute__((nonnull(1))); | ||
| 77 | +extern boolean listscripts(const char **__restrict script, const int lvl); | ||
| 78 | extern int maxorder; | ||
| 79 | extern boolean is_loop_detected(void); | ||
| 80 | |||
| 81 | @@ -116,7 +116,7 @@ extern int map_has_runlevels(void); | ||
| 82 | extern int map_runlevel_to_lvl (const int runlevel); | ||
| 83 | extern int map_key_to_lvl(const char key); | ||
| 84 | |||
| 85 | -static inline char * xstrdup(const char *__restrict s) __attribute__((always_inline,nonnull(1))); | ||
| 86 | +static inline char * xstrdup(const char *__restrict s) __attribute__((always_inline)); | ||
| 87 | static inline char * xstrdup(const char * s) | ||
| 88 | { | ||
| 89 | char * r; | ||
diff --git a/meta/packages/insserv/files/42_loopnochangemsg.dpatch b/meta/packages/insserv/files/42_loopnochangemsg.dpatch new file mode 100644 index 0000000000..4a15f58312 --- /dev/null +++ b/meta/packages/insserv/files/42_loopnochangemsg.dpatch | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #! /bin/sh /usr/share/dpatch/dpatch-run | ||
| 2 | ## 40_loopnochangemsg.dpatch by Petter Reinholdtsen | ||
| 3 | |||
| 4 | Make it more obvious that introducing a loop will not change the | ||
| 5 | existing boot sequence. Thanks to Frans Pop for the rationale for | ||
| 6 | this change. | ||
| 7 | |||
| 8 | @DPATCH@ | ||
| 9 | |||
| 10 | --- insserv-1.11.0.orig/insserv.c | ||
| 11 | +++ insserv-1.11.0/insserv.c | ||
| 12 | @@ -2647,7 +2647,7 @@ | ||
| 13 | follow_all(); | ||
| 14 | |||
| 15 | if (is_loop_detected() && !ignore) | ||
| 16 | - error("exiting now!\n"); | ||
| 17 | + error("exiting without changing boot order!\n"); | ||
| 18 | |||
| 19 | /* | ||
| 20 | * Re-order some well known scripts to get | ||
diff --git a/meta/packages/insserv/files/insserv.conf b/meta/packages/insserv/files/insserv.conf new file mode 100644 index 0000000000..4858f85b69 --- /dev/null +++ b/meta/packages/insserv/files/insserv.conf | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | # | ||
| 2 | # All local filesystems are mounted (done during boot phase) | ||
| 3 | # | ||
| 4 | $local_fs mountall | ||
| 5 | |||
| 6 | # | ||
| 7 | # Low level networking (ethernet card) | ||
| 8 | # | ||
| 9 | $network networking +pcmcia +hotplug | ||
| 10 | |||
| 11 | # | ||
| 12 | # Named is operational | ||
| 13 | # | ||
| 14 | $named +named +dnsmasq +lwresd $network | ||
| 15 | |||
| 16 | # | ||
| 17 | # All remote filesystems are mounted (note in some cases /usr may | ||
| 18 | # be remote. Most applications that care will probably require | ||
| 19 | # both $local_fs and $remote_fs) | ||
| 20 | # | ||
| 21 | $remote_fs $local_fs +mountnfs | ||
| 22 | |||
| 23 | # | ||
| 24 | # System logger is operational | ||
| 25 | # | ||
| 26 | $syslog sysklogd | ||
| 27 | |||
| 28 | # | ||
| 29 | # SunRPC portmapper available | ||
| 30 | # | ||
| 31 | $portmap portmap | ||
| 32 | |||
| 33 | # | ||
| 34 | # The system time has been set correctly | ||
| 35 | # | ||
| 36 | $time hwclock | ||
| 37 | |||
| 38 | # | ||
| 39 | # Services which need to be interactive | ||
| 40 | # | ||
| 41 | <interactive> hostname udev | ||
diff --git a/meta/packages/insserv/files/make.patch b/meta/packages/insserv/files/make.patch new file mode 100644 index 0000000000..bb3b51a8ca --- /dev/null +++ b/meta/packages/insserv/files/make.patch | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | === modified file 'Makefile' | ||
| 2 | --- old/Makefile 2008-06-24 14:49:47 +0000 | ||
| 3 | +++ new/Makefile 2008-06-24 15:56:15 +0000 | ||
| 4 | @@ -7,10 +7,10 @@ | ||
| 5 | INITDIR = /etc/init.d | ||
| 6 | INSCONF = /etc/insserv.conf | ||
| 7 | #DESTDIR = /tmp/root | ||
| 8 | -#DEBUG = -DDEBUG=1 -Wpacked | ||
| 9 | +DEBUG = -DDEBUG=1 -Wpacked | ||
| 10 | #LOOPS = -DIGNORE_LOOPS=1 | ||
| 11 | DEBUG = | ||
| 12 | -ISSUSE = -DSUSE | ||
| 13 | +#ISSUSE = -DSUSE | ||
| 14 | DESTDIR = | ||
| 15 | VERSION = 1.11.0 | ||
| 16 | DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]') | ||
| 17 | @@ -28,7 +28,9 @@ | ||
| 18 | COPTS = -O2 | ||
| 19 | endif | ||
| 20 | endif | ||
| 21 | - CFLAGS = -Wall $(COPTS) $(DEBUG) $(LOOPS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \ | ||
| 22 | +COPTS += -g | ||
| 23 | + | ||
| 24 | + MY_CFLAGS = $(CFLAGS) -Wall $(COPTS) $(DEBUG) $(LOOPS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \ | ||
| 25 | $(ISSUSE) -DINITDIR=\"$(INITDIR)\" -DINSCONF=\"$(INSCONF)\" -pipe | ||
| 26 | CLOOP = -falign-loops=0 | ||
| 27 | CC = gcc | ||
| 28 | @@ -58,13 +60,13 @@ | ||
| 29 | all: $(TODO) | ||
| 30 | |||
| 31 | listing.o: listing.c listing.h .system | ||
| 32 | - $(CC) $(CFLAGS) $(CLOOP) -c $< | ||
| 33 | + $(CC) $(MY_CFLAGS) $(CLOOP) -c $< | ||
| 34 | |||
| 35 | insserv.o: insserv.c listing.h .system | ||
| 36 | - $(CC) $(CFLAGS) $(CLOOP) -c $< | ||
| 37 | + $(CC) $(MY_CFLAGS) $(CLOOP) -c $< | ||
| 38 | |||
| 39 | insserv: insserv.o listing.o | ||
| 40 | - $(CC) $(CFLAGS) -Wl,-O,3,--relax -o $@ $^ | ||
| 41 | + $(CC) $(MY_CFLAGS) -Wl,-O,3,--relax -o $@ $^ | ||
| 42 | |||
| 43 | ifeq ($(ISSUSE),-DSUSE) | ||
| 44 | insserv.8: insserv.8.in .system | ||
| 45 | @@ -86,10 +88,10 @@ | ||
| 46 | -include .depend.listing .depend.insserv | ||
| 47 | |||
| 48 | .depend.listing: | ||
| 49 | - @$(CC) $(CFLAGS) -M listing.c >$@ 2>/dev/null | ||
| 50 | + @$(CC) $(MY_CFLAGS) -M listing.c >$@ 2>/dev/null | ||
| 51 | |||
| 52 | .depend.insserv: | ||
| 53 | - @$(CC) $(CFLAGS) -M insserv.c >$@ 2>/dev/null | ||
| 54 | + @$(CC) $(MY_CFLAGS) -M insserv.c >$@ 2>/dev/null | ||
| 55 | |||
| 56 | install: $(TODO) | ||
| 57 | $(MKDIR) $(SBINDIR) | ||
| 58 | |||
diff --git a/meta/packages/insserv/insserv-native_1.11.0.bb b/meta/packages/insserv/insserv-native_1.11.0.bb new file mode 100644 index 0000000000..f46948bb3e --- /dev/null +++ b/meta/packages/insserv/insserv-native_1.11.0.bb | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | LICENSE = "GPL" | ||
| 2 | SECTION = "base" | ||
| 3 | |||
| 4 | SRC_URI = "ftp://ftp.suse.com/pub/projects/init/insserv-${PV}.tar.gz \ | ||
| 5 | file://40_segfault_virtprov.dpatch;patch=1 \ | ||
| 6 | file://42_loopnochangemsg.dpatch;patch=1 \ | ||
| 7 | file://make.patch;patch=1 \ | ||
| 8 | file://insserv.conf" | ||
| 9 | |||
| 10 | S = "${WORKDIR}/insserv-${PV}" | ||
| 11 | |||
| 12 | inherit native | ||
| 13 | |||
| 14 | do_stage () { | ||
| 15 | oe_runmake 'DESTDIR=${STAGING_DIR_NATIVE}' install | ||
| 16 | install -m0644 ${WORKDIR}/insserv.conf ${STAGING_ETCDIR_NATIVE}/insserv.conf | ||
| 17 | } | ||
diff --git a/meta/packages/insserv/insserv_1.11.0.bb b/meta/packages/insserv/insserv_1.11.0.bb new file mode 100644 index 0000000000..e567401f37 --- /dev/null +++ b/meta/packages/insserv/insserv_1.11.0.bb | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | LICENSE = "GPL" | ||
| 2 | SECTION = "base" | ||
| 3 | |||
| 4 | SRC_URI = "ftp://ftp.suse.com/pub/projects/init/${PN}-${PV}.tar.gz \ | ||
| 5 | file://40_segfault_virtprov.dpatch;patch=1 \ | ||
| 6 | file://42_loopnochangemsg.dpatch;patch=1 \ | ||
| 7 | file://make.patch;patch=1 \ | ||
| 8 | file://insserv.conf" | ||
| 9 | |||
| 10 | do_install () { | ||
| 11 | oe_runmake 'DESTDIR=${D}' install | ||
| 12 | install -m0644 ${WORKDIR}/insserv.conf ${D}${sysconfdir}/insserv.conf | ||
| 13 | } | ||
