Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
629da164ac | ||
|
|
cc49021baa | ||
|
|
82560694f2 | ||
|
|
934e819237 | ||
|
|
77efc19190 | ||
|
|
9b026ea12c | ||
|
|
8fdf36e71d |
13 changed files with 3261 additions and 8 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -1,7 +1 @@
|
|||
upstart-0.6.6.tar.gz
|
||||
/initjobs-20101206.tar.gz
|
||||
/upstart-0.6.7.tar.gz
|
||||
/upstart-1.0.tar.gz
|
||||
/upstart-1.1.tar.gz
|
||||
/upstart-1.2.tar.gz
|
||||
/initjobs-20110502.tar.gz
|
||||
upstart-0.3.9.tar.bz2
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
This package was retired on 2012-08-06 due to no active maintainers for the package.
|
||||
286
events.5
Normal file
286
events.5
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
.TH events 5 "April 2008" "Upstart"
|
||||
.\"
|
||||
.SH NAME
|
||||
events \- format of event files used by the upstart init system
|
||||
.\"
|
||||
.SH DESCRIPTION
|
||||
upstart works on the basis of \fBevent\fP files that describe jobs
|
||||
that should be managed. This includes the particulars about what binary
|
||||
or shell script code should executed while the job is running, and
|
||||
which events can cause the job to be started or stopped.
|
||||
|
||||
Event files are stored in the \fI/etc/event.d\fP directory.
|
||||
.\"
|
||||
.SH SYNTAX
|
||||
|
||||
Event files can contain the following stanzaz.
|
||||
|
||||
.TP
|
||||
.BI "exec <command> <arguments>"
|
||||
When the event is started by \fBinit\fR, execute the following arguments.
|
||||
|
||||
Example: exec /bin/dbus-daemon --system
|
||||
|
||||
.TP
|
||||
.BI "script ..."
|
||||
Like \fBexec\fR but instead of executing a single program, execute
|
||||
the following shell code. \fBscript\fR sections are closed with a
|
||||
\fBend script\fR marker.
|
||||
|
||||
Example:
|
||||
.nf
|
||||
script
|
||||
rm -f /var/run/sshd.pid
|
||||
sshd
|
||||
end script
|
||||
.ni
|
||||
|
||||
Only one of \fBexec\fR and \fBscript\fR can be used at a time. If both
|
||||
are bspecifed, \fBexec\fR takes priority.
|
||||
|
||||
.TP
|
||||
.BI pre-start
|
||||
Execute the command/script before actually starting the process.
|
||||
\fBpre-start\fR can be invoked as \fBpre-start exec\fR or \fBpre-start script\fR
|
||||
in the same way that a start action can be handled by either
|
||||
\fBexec\fR or \fBscript\fR.
|
||||
|
||||
.TP
|
||||
.BI post-start
|
||||
Execute the command/script after starting the process.
|
||||
The format is similar to \fBpre-start\fR.
|
||||
|
||||
.TP
|
||||
.BI pre-stop
|
||||
Execute the command/script before stopping the process.
|
||||
The format is similar to \fBpre-start\fR.
|
||||
|
||||
.TP
|
||||
.BI post-stop
|
||||
Execute the command/script after stopping the process.
|
||||
The format is similar to \fBpre-start\fR.
|
||||
|
||||
.TP
|
||||
.BI "start on <event>"
|
||||
Describes on what condition to start this job. Without this
|
||||
section, the job can only be manually started with the
|
||||
\fBinitctl(8)\fR command.
|
||||
|
||||
Examples:
|
||||
.nf
|
||||
start on startup
|
||||
This starts immediately after boot.
|
||||
|
||||
start on stopped rc3
|
||||
This starts when the 'rc3' event has stopped.
|
||||
.ni
|
||||
|
||||
Events are matched via globbing. So a stanza of the form
|
||||
.nf
|
||||
start on runlevel [2345]
|
||||
.ni
|
||||
would match any of runlevels 2, 3, 4, or 5.
|
||||
|
||||
.TP
|
||||
.BI "stop on <event>"
|
||||
Describes on what condition to stop this job. Without this
|
||||
section, the job can only be manually stopped with the
|
||||
\fBinitctl\fR command.
|
||||
|
||||
Examples:
|
||||
.nf
|
||||
stop on runlevel 0
|
||||
This stops the job when runlevel 0 is entered.
|
||||
|
||||
stop on stopping dbus ok
|
||||
This stops the job when the 'dbus' job is stopped.
|
||||
.ni
|
||||
|
||||
Events are matched via globbing. So a stanza of the form
|
||||
.nf
|
||||
stop on runlevel [!5]
|
||||
.ni
|
||||
would match any runlevel other than 5.
|
||||
|
||||
.TP
|
||||
.BI daemon
|
||||
Sets the daemon flag for the job. This means that the job will
|
||||
fork in the background and that its PID needs to be obtained.
|
||||
|
||||
.TP
|
||||
.BI respawn
|
||||
This sets the daemon, service, and respawn flags for the job.
|
||||
The respawn flag means that the process will be restarted when
|
||||
it ends.
|
||||
|
||||
.TP
|
||||
.BI "respawn limit [count [timeout]]"
|
||||
This configures respawn limits. Respawn limits only apply
|
||||
if the \fBrespawn\fR flag is set for the job; setting a limit
|
||||
does not automatically set respawning capability. If the
|
||||
process is respawned more than \fIcount\fR times within an
|
||||
interval of \fItimeout\fR seconds, the job will be stopped
|
||||
automatically, andn ot restarted. The limit defaults to 10
|
||||
times within 5 seconds.
|
||||
|
||||
Example: respawn limit 10 120
|
||||
|
||||
This sets the limit for respawn to ten times within two
|
||||
minutes, the historical behavior for System V init.
|
||||
|
||||
.TP
|
||||
.BI service
|
||||
\fBservice\fR means that the job has reached its goal when running.
|
||||
\fBservice\fR is implied by the \fBrespawn\fR flag.
|
||||
|
||||
.TP
|
||||
.BI instance
|
||||
\fBinstance\fR means that the job starts new instances every time
|
||||
it is started, even if there is another instance running. It
|
||||
is the converse of \fBdaemon\fR.
|
||||
|
||||
.TP
|
||||
.BI "kill timeout <time>"
|
||||
Sets the time to wait between sending TERM and KILL signals to
|
||||
\fItime\fR seconds.
|
||||
|
||||
.TP
|
||||
.BI "normal exit <status>"
|
||||
When used with \fBrespawn\fR any exit codes denoted in \fIstatus\fR will
|
||||
prevent a respawn of the process.
|
||||
|
||||
.TP
|
||||
.BI "console {logged|output|owner|none}"
|
||||
Describes what to do with the job's output. Valid values are:
|
||||
|
||||
.I logged
|
||||
Redirect to logger. (the default setting)
|
||||
|
||||
.I output
|
||||
Direct to the current stdout
|
||||
|
||||
.I owner
|
||||
The process becomes the owner of the console, allowing it to
|
||||
receive signals from the keyboard
|
||||
|
||||
.I none
|
||||
Output is redirected to /dev/null
|
||||
|
||||
.TP
|
||||
.BI "env <name>=<value>"
|
||||
Sets an environment variable for the job.
|
||||
|
||||
Example: env LD_LIBRARY_PATH=/opt/app/lib
|
||||
|
||||
.TP
|
||||
.BI "umask <umask>"
|
||||
Sets the umask of the job to \fIumask\fR.
|
||||
|
||||
Example: umask 0755
|
||||
|
||||
.TP
|
||||
.BI "nice <value>"
|
||||
Sets the nice level of the job to \fIvalue\fR.
|
||||
|
||||
Example: nice 5
|
||||
|
||||
.TP
|
||||
.BI "chroot <path>"
|
||||
Changes the job's root directory to \fIpath\fR.
|
||||
|
||||
Example: chroot /var/empty
|
||||
|
||||
.TP
|
||||
.BI "chdir <path>"
|
||||
Changes the working directory of the job to \fIpath\fR.
|
||||
|
||||
Example: chdir /var/tmp
|
||||
|
||||
.TP
|
||||
.BI "limit {as|core|cpu|data|fsize|memlock|msgqueue|nice|nofile|nproc|rss|rtprio|sigpending|stack} {unlimited|<value>}"
|
||||
Changes the limit of the process to whatever is specfied.
|
||||
|
||||
Examples:
|
||||
.nf
|
||||
limit nproc 10
|
||||
limit core unlimited
|
||||
.ni
|
||||
|
||||
.TP
|
||||
.BI "description <text>"
|
||||
Describes the job. Not currently used by any \fBinit(8)\fR tools.
|
||||
|
||||
Example: descripton "This is a test job."
|
||||
|
||||
.TP
|
||||
.BI "author <text>"
|
||||
Author of the job. Not currently used by any \fBinit(8)\fR tools.
|
||||
Example: author "Obi-wan Kennedy <bidy@whitehouse.gov>"
|
||||
|
||||
.TP
|
||||
.BI "version <version>"
|
||||
Version of the job. Not currently used by any \fBinit(8)\fR tools.
|
||||
Example: version "0.0.0.0.1 test"
|
||||
|
||||
.TP
|
||||
.BI "emits <signals>"
|
||||
Describes signals emitted by the job. Not currently used by
|
||||
any \fBinit(8)\fR tools. For more information on signals, see the
|
||||
\fBinitctl(8)\fR man page and the \fBemit\fR option.
|
||||
|
||||
Example: emits spam egg ham
|
||||
.\"
|
||||
.SH EVENTS
|
||||
A wide array of events can be emitted by the system (see
|
||||
\fBinitctl(8)\fR) but the following events are generated by
|
||||
upstart itself, or are usually seen on a typical install.
|
||||
|
||||
.TP
|
||||
.BI "stalled"
|
||||
No jobs are running and no events are pending.
|
||||
|
||||
.TP
|
||||
.BI "control-alt-delete"
|
||||
Control-Alt-Delete has been pressed.
|
||||
|
||||
.TP
|
||||
.BI "kbdrequest"
|
||||
A kbdrequest event has occurred.
|
||||
|
||||
.TP
|
||||
.BI "power-status-changed"
|
||||
Init received SIGPWR.
|
||||
|
||||
.TP
|
||||
.BI "starting <job>"
|
||||
The given job is being started.
|
||||
|
||||
.TP
|
||||
.BI "started <job>"
|
||||
The given job has successfully been started.
|
||||
|
||||
.TP
|
||||
.BI "stopping <job>"
|
||||
The given job is being stopped.
|
||||
|
||||
.TP
|
||||
.BI "stopped <job>"
|
||||
The given job has been stopped successfully.
|
||||
|
||||
.TP
|
||||
.BI "startup"
|
||||
Emitted when the system boots.
|
||||
|
||||
.TP
|
||||
.BI "runlevel <runlevel>"
|
||||
Init has been asked to move to the given runlevel.
|
||||
.\"
|
||||
.SH FILES
|
||||
.I /etc/event.d
|
||||
The directory where event files are stored.
|
||||
.\"
|
||||
.SH SEE ALSO
|
||||
.BR initctl (8)
|
||||
.BR telinit (8)
|
||||
.BR init (8)
|
||||
.BR http://upstart.ubuntu.com/getting-started.html
|
||||
1
sources
Normal file
1
sources
Normal file
|
|
@ -0,0 +1 @@
|
|||
794208083d405ece123ad59a02f3e233 upstart-0.3.9.tar.bz2
|
||||
33
upstart-fedora-buglist.patch
Normal file
33
upstart-fedora-buglist.patch
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
diff -urN upstart-0.3.9/configure upstart-0.3.9-adj/configure
|
||||
--- upstart-0.3.9/configure 2007-10-11 17:12:41.000000000 -0400
|
||||
+++ upstart-0.3.9-adj/configure 2008-04-03 11:22:20.000000000 -0400
|
||||
@@ -732,7 +732,7 @@
|
||||
PACKAGE_TARNAME='upstart'
|
||||
PACKAGE_VERSION='0.3.9'
|
||||
PACKAGE_STRING='upstart 0.3.9'
|
||||
-PACKAGE_BUGREPORT='upstart-devel@lists.ubuntu.com'
|
||||
+PACKAGE_BUGREPORT='fedora-devel-list@redhat.com'
|
||||
|
||||
ac_unique_file="init/main.c"
|
||||
gt_needs=
|
||||
@@ -1574,7 +1574,7 @@
|
||||
Use these variables to override the choices made by `configure' or to help
|
||||
it to find libraries and programs with nonstandard names/locations.
|
||||
|
||||
-Report bugs to <upstart-devel@lists.ubuntu.com>.
|
||||
+Report bugs to <fedora-devel-list@redhat.com>.
|
||||
_ACEOF
|
||||
ac_status=$?
|
||||
fi
|
||||
diff -urN upstart-0.3.9/configure.ac upstart-0.3.9-adj/configure.ac
|
||||
--- upstart-0.3.9/configure.ac 2007-10-11 17:11:27.000000000 -0400
|
||||
+++ upstart-0.3.9-adj/configure.ac 2008-04-03 11:22:20.000000000 -0400
|
||||
@@ -1,7 +1,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
-AC_INIT([upstart], [0.3.9], [upstart-devel@lists.ubuntu.com])
|
||||
+AC_INIT([upstart], [0.3.9], [fedora-devel-list@redhat.com])
|
||||
AC_COPYRIGHT([[Copyright © 2007 Canonical Ltd.]])
|
||||
AC_CONFIG_SRCDIR([init/main.c])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
56
upstart-force-on-shutdown-reboot.patch
Normal file
56
upstart-force-on-shutdown-reboot.patch
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
diff -up upstart-0.3.9/compat/sysv/reboot.c.foo upstart-0.3.9/compat/sysv/reboot.c
|
||||
--- upstart-0.3.9/compat/sysv/reboot.c.foo 2008-02-15 16:52:30.000000000 -0500
|
||||
+++ upstart-0.3.9/compat/sysv/reboot.c 2008-02-15 17:47:37.000000000 -0500
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
+#include <utmp.h>
|
||||
|
||||
#include <linux/if.h>
|
||||
#include <linux/hdreg.h>
|
||||
@@ -158,12 +159,31 @@ static NihOption options[] = {
|
||||
NIH_OPTION_LAST
|
||||
};
|
||||
|
||||
+static char get_runlevel(void)
|
||||
+{
|
||||
+ struct utmp utmp, *lvl;
|
||||
+ char *rl, runlevel = 0;
|
||||
+
|
||||
+ if ((rl = getenv("RUNLEVEL")) != NULL)
|
||||
+ return *rl;
|
||||
+
|
||||
+ memset(&utmp, 0, sizeof(utmp));
|
||||
+ utmp.ut_type = RUN_LVL;
|
||||
+ setutent();
|
||||
+ lvl = getutid(&utmp);
|
||||
+ if (lvl)
|
||||
+ runlevel = lvl->ut_pid % 256;
|
||||
+ endutent();
|
||||
+ return runlevel;
|
||||
+}
|
||||
+
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
char **args;
|
||||
+ char level;
|
||||
int mode;
|
||||
|
||||
nih_main_init (argv[0]);
|
||||
@@ -211,6 +231,12 @@ main (int argc,
|
||||
|
||||
if (exit_only)
|
||||
exit (0);
|
||||
+
|
||||
+ level = get_runlevel();
|
||||
+ if (level) {
|
||||
+ if (level == '0' || level == '6')
|
||||
+ force = TRUE;
|
||||
+ }
|
||||
|
||||
/* Normally we just exec shutdown, which notifies everyone and
|
||||
* signals init.
|
||||
11
upstart-gcc43.patch
Normal file
11
upstart-gcc43.patch
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
diff -up upstart-0.3.9/upstart/wire.c.foo upstart-0.3.9/upstart/wire.c
|
||||
--- upstart-0.3.9/upstart/wire.c.foo 2008-02-01 13:35:33.000000000 -0500
|
||||
+++ upstart-0.3.9/upstart/wire.c 2008-02-01 13:35:33.000000000 -0500
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
+#include <limits.h>
|
||||
|
||||
#include <nih/macros.h>
|
||||
#include <nih/alloc.h>
|
||||
20
upstart-initctl-man.patch
Normal file
20
upstart-initctl-man.patch
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
--- upstart-0.3.9/util/man/initctl.8-orig 2008-04-09 16:52:23.000000000 -0400
|
||||
+++ upstart-0.3.9/util/man/initctl.8 2008-04-24 01:42:57.000000000 -0400
|
||||
@@ -4,7 +4,7 @@
|
||||
initctl \- init daemon control utility
|
||||
.\"
|
||||
.SH SYNOPSIS
|
||||
-\fBinitctl\fR [\fIOPTION\fR]... \fICOMMAND\fR [\fIOPTION\fR]... \fIARG...\fR
|
||||
+\fBinitctl\fR [\fIOPTION\fR]... \fICOMMAND\fR [\fIOPTION\fR]... \fIARG\fR...
|
||||
.\"
|
||||
.SH DESCRIPTION
|
||||
.B initctl
|
||||
@@ -14,7 +14,7 @@
|
||||
.IR COMMAND .
|
||||
|
||||
Normally it is invoked directly with the command specified as the first
|
||||
-non-option argument, however symbolic or hard links may be used so that
|
||||
+non-option argument; however, symbolic or hard links may be used so that
|
||||
it is invoked as the name of a command, in which case it behaves
|
||||
accordingly.
|
||||
.\"
|
||||
168
upstart-olpc-init.patch
Normal file
168
upstart-olpc-init.patch
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
diff -ru upstart-0.3.9/init/control.c upstart-0.3.9/init/control.c
|
||||
--- upstart-0.3.9/init/control.c 2008-05-06 23:45:35.000000000 -0400
|
||||
+++ upstart-0.3.9/init/control.c 2008-05-06 23:43:31.000000000 -0400
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <sys/un.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
@@ -134,7 +136,69 @@
|
||||
|
||||
UPSTART_MESSAGE_LAST
|
||||
};
|
||||
+/**
|
||||
+ * upstart_addr:
|
||||
+ * @addr: address structure to fill,
|
||||
+ * @pid: process id.
|
||||
+ *
|
||||
+ * Fills the given address structure with the address that a process of
|
||||
+ * @pid should be listening for responses on.
|
||||
+ *
|
||||
+ * The AF_UNIX abstract namespace is used with the init daemon (process #1)
|
||||
+ * bound to /com/ubuntu/upstart and clients bound to /com/ubuntu/upstart/$PID
|
||||
+ *
|
||||
+ * Returns: size of address.
|
||||
+ **/
|
||||
+static size_t
|
||||
+upstart_init_addr (struct sockaddr_un *addr,
|
||||
+ pid_t pid)
|
||||
+{
|
||||
+ size_t addrlen;
|
||||
+
|
||||
+ nih_assert (addr != NULL);
|
||||
+ nih_assert (pid > 0);
|
||||
+
|
||||
+ addr->sun_family = AF_UNIX;
|
||||
+ addr->sun_path[0] = '\0';
|
||||
|
||||
+ addrlen = offsetof (struct sockaddr_un, sun_path) + 1;
|
||||
+ addrlen += snprintf (addr->sun_path + 1,
|
||||
+ sizeof (addr->sun_path) - 1,
|
||||
+ "/com/ubuntu/upstart");
|
||||
+
|
||||
+ return addrlen;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+upstart_init_open (void)
|
||||
+{
|
||||
+ struct sockaddr_un addr;
|
||||
+ size_t addrlen;
|
||||
+ int sock, optval;
|
||||
+
|
||||
+ /* Communication is performed using a unix datagram socket */
|
||||
+ sock = socket (PF_UNIX, SOCK_DGRAM, 0);
|
||||
+ if (sock < 0)
|
||||
+ nih_return_system_error (-1);
|
||||
+
|
||||
+ /* Bind the socket so we can receive responses */
|
||||
+ addrlen = upstart_init_addr (&addr, getpid ());
|
||||
+ if (bind (sock, (struct sockaddr *)&addr, addrlen) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ /* Always requests credentials */
|
||||
+ optval = 1;
|
||||
+ if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &optval,
|
||||
+ sizeof (optval)) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ return sock;
|
||||
+
|
||||
+error:
|
||||
+ nih_error_raise_system ();
|
||||
+ close (sock);
|
||||
+ return -1;
|
||||
+}
|
||||
|
||||
/**
|
||||
* control_open:
|
||||
@@ -150,7 +214,7 @@
|
||||
{
|
||||
int sock;
|
||||
|
||||
- sock = upstart_open ();
|
||||
+ sock = upstart_init_open ();
|
||||
if (sock < 0)
|
||||
return NULL;
|
||||
|
||||
diff -ru upstart-0.3.9/init/main.c ./main.c
|
||||
--- upstart-0.3.9/init/main.c 2008-05-06 23:45:35.000000000 -0400
|
||||
+++ ./main.c 2008-05-06 23:37:53.000000000 -0400
|
||||
@@ -95,6 +95,8 @@
|
||||
**/
|
||||
static int rescue = FALSE;
|
||||
|
||||
+static int snarf = FALSE;
|
||||
+
|
||||
|
||||
/**
|
||||
* options:
|
||||
@@ -102,8 +104,9 @@
|
||||
* Command-line options we accept.
|
||||
**/
|
||||
static NihOption options[] = {
|
||||
- { 0, "restart", NULL, NULL, NULL, &restart, NULL },
|
||||
- { 0, "rescue", NULL, NULL, NULL, &rescue, NULL },
|
||||
+ { 'd', "restart", "Restart init (bad idea?)", NULL, NULL, &restart, NULL },
|
||||
+ { 's', "rescue", "Perform rescue operations?", NULL, NULL, &rescue, NULL },
|
||||
+ { 'i', "init", "Snarf PID happily.", NULL, NULL, &snarf, NULL },
|
||||
|
||||
/* Ignore invalid options */
|
||||
{ '-', "--", NULL, NULL, NULL, NULL, NULL },
|
||||
@@ -139,7 +142,9 @@
|
||||
}
|
||||
|
||||
/* Check we're process #1 */
|
||||
- if (getpid () > 1) {
|
||||
+ if (snarf) {
|
||||
+ int pid = getpid();
|
||||
+ } else if (getpid () > 1) {
|
||||
execv (TELINIT, argv);
|
||||
/* Ignore failure, probably just that telinit doesn't exist */
|
||||
|
||||
@@ -147,7 +152,6 @@
|
||||
exit (1);
|
||||
}
|
||||
|
||||
-
|
||||
/* Clear our arguments from the command-line, so that we show up in
|
||||
* ps or top output as /sbin/init, with no extra flags.
|
||||
*
|
||||
diff -ru upstart-0.3.9/upstart/message.c ./main.c
|
||||
--- upstart-0.3.9/upstart/message.c 2008-05-07 10:45:31.000000000 -0400
|
||||
+++ upstart-0.3.9/upstart/message.c 2008-05-07 10:46:00.000000000 -0400
|
||||
@@ -515,30 +515,6 @@
|
||||
*/
|
||||
}
|
||||
|
||||
- /* Check the origin of the message, this is a safety trap so we
|
||||
- * don't even bother parsing memory if the process shouldn't be able
|
||||
- * to talk to us.
|
||||
- *
|
||||
- * Only the init daemon accepts messages from any process, others
|
||||
- * will only accept messages from the init daemon or themselves.
|
||||
- *
|
||||
- * In addition, we only permit messages to come from a process
|
||||
- * running as root or our own user id (though this may be relaxed
|
||||
- * for the init daemon later).
|
||||
- */
|
||||
- if (! upstart_disable_safeties) {
|
||||
- if (cred.pid == 0)
|
||||
- goto illegal;
|
||||
-
|
||||
- if ((cred.pid != UPSTART_INIT_DAEMON)
|
||||
- && (cred.pid != getpid ())
|
||||
- && (getpid () != UPSTART_INIT_DAEMON))
|
||||
- goto illegal;
|
||||
-
|
||||
- if ((cred.uid != 0) && (cred.uid != getuid ()))
|
||||
- goto illegal;
|
||||
- }
|
||||
-
|
||||
|
||||
/* Read the header from the message, which tells us what type of
|
||||
* message follows.
|
||||
23
upstart-rpm.patch
Normal file
23
upstart-rpm.patch
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
=== modified file 'nih/file.c'
|
||||
--- nih/file.c 2007-06-03 12:32:56 +0000
|
||||
+++ nih/file.c 2008-03-17 02:47:17 +0000
|
||||
@@ -375,6 +375,18 @@
|
||||
if (ptr && (! strncmp (ptr, ".dpkg-", 6)))
|
||||
return TRUE;
|
||||
|
||||
+ /* Matches rpm temp files */
|
||||
+ if (ptr && (! strncmp (ptr, ".rpmsave",9)))
|
||||
+ return TRUE;
|
||||
+ if (ptr && (! strncmp (ptr, ".rpmorig",9)))
|
||||
+ return TRUE;
|
||||
+ if (ptr && (! strncmp (ptr, ".rpmnew",8)))
|
||||
+ return TRUE;
|
||||
+
|
||||
+ /* More rpm temp file matching */
|
||||
+ ptr = strrchr (path, ';');
|
||||
+ if (ptr && strspn (ptr + 1, "abcdefABCDEF0123456789") == 8 && !ptr[9])
|
||||
+ return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
110
upstart-telinit-u.patch
Normal file
110
upstart-telinit-u.patch
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
diff -urN upstart-0.3.9-old/compat/sysv/telinit.c upstart-0.3.9/compat/sysv/telinit.c
|
||||
--- upstart-0.3.9-old/compat/sysv/telinit.c 2008-04-09 00:52:06.000000000 -0400
|
||||
+++ upstart-0.3.9/compat/sysv/telinit.c 2008-04-09 01:02:39.000000000 -0400
|
||||
@@ -113,6 +113,11 @@
|
||||
NULL, UPSTART_INIT_DAEMON,
|
||||
UPSTART_EVENT_EMIT, "runlevel", args, NULL));
|
||||
break;
|
||||
+ case 'u':
|
||||
+ NIH_MUST (message = upstart_message_new (
|
||||
+ NULL, UPSTART_INIT_DAEMON,
|
||||
+ UPSTART_RESTART, NULL));
|
||||
+ break;
|
||||
default:
|
||||
/* Ignore other arguments */
|
||||
exit (0);
|
||||
diff -urN upstart-0.3.9-old/init/control.c upstart-0.3.9/init/control.c
|
||||
--- upstart-0.3.9-old/init/control.c 2008-04-09 00:52:06.000000000 -0400
|
||||
+++ upstart-0.3.9/init/control.c 2008-04-09 01:01:41.000000000 -0400
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
+#include <signal.h>
|
||||
#include <fnmatch.h>
|
||||
|
||||
#include <nih/macros.h>
|
||||
@@ -52,6 +53,8 @@
|
||||
static void control_error_handler (void *data, NihIo *io);
|
||||
static int control_version_query (void *data, pid_t pid,
|
||||
UpstartMessageType type);
|
||||
+static int control_restart (void *data, pid_t pid,
|
||||
+ UpstartMessageType type);
|
||||
static int control_log_priority (void *data, pid_t pid,
|
||||
UpstartMessageType type,
|
||||
NihLogLevel priority);
|
||||
@@ -102,6 +105,8 @@
|
||||
static UpstartMessage message_handlers[] = {
|
||||
{ -1, UPSTART_VERSION_QUERY,
|
||||
(UpstartMessageHandler)control_version_query },
|
||||
+ { -1, UPSTART_RESTART,
|
||||
+ (UpstartMessageHandler)control_restart },
|
||||
{ -1, UPSTART_PUSH_TTY,
|
||||
(UpstartMessageHandler)control_push_tty },
|
||||
{ -1, UPSTART_POP_TTY,
|
||||
@@ -319,6 +324,32 @@
|
||||
}
|
||||
|
||||
/**
|
||||
+ * control_restart:
|
||||
+ * @data: data pointer,
|
||||
+ * @pid: origin process id,
|
||||
+ * @type: message type received.
|
||||
+ *
|
||||
+ * This function is called when another process on the system asks us to
|
||||
+ * re-execute
|
||||
+ *
|
||||
+ * Returns: zero on success, negative value on raised error.
|
||||
+ **/
|
||||
+static int
|
||||
+control_restart (void *data,
|
||||
+ pid_t pid,
|
||||
+ UpstartMessageType type)
|
||||
+{
|
||||
+ nih_assert (pid > 0);
|
||||
+ nih_assert (type == UPSTART_RESTART);
|
||||
+
|
||||
+ nih_info (_("Control request to restart daemon"));
|
||||
+
|
||||
+ kill(getpid(), SIGTERM);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* control_push_tty:
|
||||
* @data: data pointer,
|
||||
* @pid: origin process id,
|
||||
diff -urN upstart-0.3.9-old/upstart/message.c upstart-0.3.9/upstart/message.c
|
||||
--- upstart-0.3.9-old/upstart/message.c 2008-04-09 00:52:06.000000000 -0400
|
||||
+++ upstart-0.3.9/upstart/message.c 2008-04-09 00:55:03.000000000 -0400
|
||||
@@ -259,6 +259,8 @@
|
||||
switch (type) {
|
||||
case UPSTART_NO_OP:
|
||||
break;
|
||||
+ case UPSTART_RESTART:
|
||||
+ break;
|
||||
case UPSTART_VERSION_QUERY:
|
||||
break;
|
||||
case UPSTART_POP_TTY:
|
||||
@@ -564,6 +566,9 @@
|
||||
case UPSTART_VERSION_QUERY:
|
||||
ret = handler (data, cred.pid, type);
|
||||
break;
|
||||
+ case UPSTART_RESTART:
|
||||
+ ret = handler (data, cred.pid, type);
|
||||
+ break;
|
||||
case UPSTART_POP_TTY:
|
||||
ret = handler (data, cred.pid, type);
|
||||
break;
|
||||
diff -urN upstart-0.3.9-old/upstart/message.h upstart-0.3.9/upstart/message.h
|
||||
--- upstart-0.3.9-old/upstart/message.h 2008-04-09 00:52:06.000000000 -0400
|
||||
+++ upstart-0.3.9/upstart/message.h 2008-04-09 00:55:58.000000000 -0400
|
||||
@@ -67,6 +67,7 @@
|
||||
UPSTART_NO_OP = 0x0000,
|
||||
UPSTART_VERSION_QUERY = 0x0001,
|
||||
UPSTART_LOG_PRIORITY = 0x0002,
|
||||
+ UPSTART_RESTART = 0x0005,
|
||||
UPSTART_VERSION = 0x0010,
|
||||
UPSTART_PUSH_TTY = 0x0011,
|
||||
UPSTART_POP_TTY = 0x0012,
|
||||
2388
upstart-tty-stack.patch
Normal file
2388
upstart-tty-stack.patch
Normal file
File diff suppressed because it is too large
Load diff
164
upstart.spec
Normal file
164
upstart.spec
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
Name: upstart
|
||||
Version: 0.3.9
|
||||
Release: 19%{?dist}.1
|
||||
Summary: An event-driven init system
|
||||
|
||||
Group: System Environment/Base
|
||||
License: GPLv2+
|
||||
URL: http://upstart.ubuntu.com
|
||||
Source0: http://upstart.ubuntu.com/download/0.3/upstart-%{version}.tar.bz2
|
||||
Source1: events.5
|
||||
Patch0: upstart-gcc43.patch
|
||||
Patch1: upstart-force-on-shutdown-reboot.patch
|
||||
Patch2: upstart-tty-stack.patch
|
||||
Patch3: upstart-rpm.patch
|
||||
Patch4: upstart-fedora-buglist.patch
|
||||
Patch5: upstart-telinit-u.patch
|
||||
Patch6: upstart-initctl-man.patch
|
||||
Patch7: upstart-olpc-init.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Obsoletes: SysVinit < 2.86-24, sysvinit < 2.86-24
|
||||
Provides: SysVinit = 2.86-24, sysvinit = 2.86-24
|
||||
BuildRequires: gettext
|
||||
|
||||
%description
|
||||
Upstart is an event-based replacement for the /sbin/init daemon which
|
||||
handles starting of tasks and services during boot, stopping them
|
||||
during shutdown and supervising them while the system is running.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2
|
||||
%patch3
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
%build
|
||||
%configure --enable-compat=sysv --sbindir=/sbin --libdir=/%{_lib}
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
make install DESTDIR=%{buildroot}
|
||||
|
||||
mkdir -p %{buildroot}/%{_mandir}/man5
|
||||
install -m 644 %{SOURCE1} %{buildroot}/%{_mandir}/man5/events.5
|
||||
|
||||
# libupstart and libnih aren't shipped
|
||||
rm -f %{buildroot}/%{_lib}/libupstart.*
|
||||
rm -f %{buildroot}/%{_lib}/libnih.*
|
||||
rm -f %{buildroot}/%{_includedir}/libnih.h
|
||||
rm -f %{buildroot}/%{_includedir}/libupstart.h
|
||||
rm -rf %{buildroot}/%{_includedir}/nih
|
||||
rm -rf %{buildroot}/%{_includedir}/upstart
|
||||
rm -rf %{buildroot}/%{_datadir}/aclocal/compiler.m4
|
||||
rm -rf %{buildroot}/%{_datadir}/aclocal/linker.m4
|
||||
rm -rf %{buildroot}/%{_datadir}/aclocal/misc.m4
|
||||
|
||||
%find_lang %{name}
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files -f %{name}.lang
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS
|
||||
%doc COPYING
|
||||
%doc NEWS
|
||||
%doc README
|
||||
%doc TODO
|
||||
%doc HACKING
|
||||
%{_sysconfdir}/event.d/
|
||||
%config(noreplace) %{_sysconfdir}/event.d/logd
|
||||
/sbin/halt
|
||||
/sbin/init
|
||||
/sbin/initctl
|
||||
/sbin/logd
|
||||
/sbin/poweroff
|
||||
/sbin/reboot
|
||||
/sbin/runlevel
|
||||
/sbin/shutdown
|
||||
/sbin/start
|
||||
/sbin/status
|
||||
/sbin/stop
|
||||
/sbin/telinit
|
||||
%{_mandir}/man5/events.5.gz
|
||||
%{_mandir}/man8/halt.8.gz
|
||||
%{_mandir}/man8/init.8.gz
|
||||
%{_mandir}/man8/initctl.8.gz
|
||||
%{_mandir}/man8/logd.8.gz
|
||||
%{_mandir}/man8/poweroff.8.gz
|
||||
%{_mandir}/man8/reboot.8.gz
|
||||
%{_mandir}/man8/runlevel.8.gz
|
||||
%{_mandir}/man8/shutdown.8.gz
|
||||
%{_mandir}/man8/start.8.gz
|
||||
%{_mandir}/man8/status.8.gz
|
||||
%{_mandir}/man8/stop.8.gz
|
||||
%{_mandir}/man8/telinit.8.gz
|
||||
|
||||
%changelog
|
||||
* Wed May 07 2008 Dennis Gilmore <dennis@laptop.org> - 0.3.9-19.1
|
||||
- apply patch from Blake Setlow allowing upstart to run as a PID other than 1
|
||||
|
||||
* Fri Apr 25 2008 Bill Nottingham <notting@redhat.com> - 0.3.9-19
|
||||
- with the merge of event-compat-sysv, move the sysvinit obsoletes/provides here
|
||||
|
||||
* Thu Apr 24 2008 Bill Nottingham <notting@redhat.com> - 0.3.9-18
|
||||
- fix some man page typos (#444008, <archimerged@gmail.com>)
|
||||
|
||||
* Wed Apr 09 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-17
|
||||
- Added list of stock events to events(5)
|
||||
|
||||
* Tue Apr 08 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-16
|
||||
- Add telinit u support
|
||||
|
||||
* Fri Apr 04 2008 Bill Nottingham <notting@redhat.com> - 0.3.9-15
|
||||
- Add a events(5) manpage that describes event syntax
|
||||
|
||||
* Thu Apr 03 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-14
|
||||
- Change bug report email address to fedora-devel-list@redhat.com
|
||||
|
||||
* Thu Mar 14 2008 Bill Nottingham <notting@redhat.com> - 0.3.9-13
|
||||
- Ignore rpm temporary files of the foo;<somehex> format
|
||||
- Make ignores of .rpm{new,orig,save} match only at the end of the name
|
||||
|
||||
* Wed Mar 13 2008 Bill Nottingham <notting@redhat.com> - 0.3.9-12
|
||||
- forgot about rpmorig too (ugh)
|
||||
|
||||
* Wed Mar 13 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-11
|
||||
- Make logd a noreplace
|
||||
|
||||
* Wed Mar 13 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-10
|
||||
- Add patch to ignore .rpm{new,save} files
|
||||
|
||||
* Sun Mar 03 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-9
|
||||
- Remove automake dependency, build Makefile.in changes into patch
|
||||
|
||||
* Sun Mar 03 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-8
|
||||
- Run automake after patching
|
||||
|
||||
* Sun Mar 03 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-7
|
||||
- Added BuildRequires: automake
|
||||
|
||||
* Sun Mar 03 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-6
|
||||
- Added patch to allow runtime tty changes
|
||||
|
||||
* Fri Feb 15 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-5
|
||||
- Added patch to imply --force on runlevels 0 and 6
|
||||
|
||||
* Wed Feb 06 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-4
|
||||
- Patched for GCC 4.3
|
||||
|
||||
* Thu Jan 31 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-3
|
||||
- Added AUTHORS, COPYING, etc.
|
||||
- Made config --libdir option relative
|
||||
|
||||
* Mon Jan 21 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-2
|
||||
- Remove libnih and libupstart
|
||||
|
||||
* Sun Jan 13 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-1
|
||||
- Initial packaging
|
||||
Loading…
Add table
Add a link
Reference in a new issue