diff --git a/.gitignore b/.gitignore index 5056c71..6c1b28b 100644 --- a/.gitignore +++ b/.gitignore @@ -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.6.5.tar.gz diff --git a/dead.package b/dead.package deleted file mode 100644 index 7ceac32..0000000 --- a/dead.package +++ /dev/null @@ -1 +0,0 @@ -This package was retired on 2012-08-06 due to no active maintainers for the package. diff --git a/init-system-dbus.conf b/init-system-dbus.conf new file mode 100644 index 0000000..0fc6a8a --- /dev/null +++ b/init-system-dbus.conf @@ -0,0 +1,6 @@ +# init-system-dbus - tell init process to connect to system dbus server + +start on started messagebus + +task +exec /bin/kill -USR1 1 diff --git a/sources b/sources new file mode 100644 index 0000000..46ac626 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +f9466bba72b655c2408353b64105853f upstart-0.6.5.tar.gz diff --git a/upstart-audit-events.patch b/upstart-audit-events.patch new file mode 100644 index 0000000..07df654 --- /dev/null +++ b/upstart-audit-events.patch @@ -0,0 +1,872 @@ +diff --git a/Makefile.in b/Makefile.in +index a9550df..bdd0def 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -49,17 +49,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ +- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \ +- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ +- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \ +- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ +- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ +- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ +- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ +- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \ +- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \ +- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \ +- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac ++ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \ ++ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \ ++ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \ ++ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ ++ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ ++ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \ ++ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \ ++ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \ ++ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \ ++ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \ ++ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \ ++ $(top_srcdir)/configure.ac + am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) + am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ +@@ -132,6 +133,7 @@ ALLOCA = @ALLOCA@ + AMTAR = @AMTAR@ + AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ + AR = @AR@ ++AUDIT_LDADD = @AUDIT_LDADD@ + AUTOCONF = @AUTOCONF@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ +diff --git a/aclocal.m4 b/aclocal.m4 +index 3d3673e..6e09291 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -1066,6 +1066,7 @@ m4_include([m4/lcmessage.m4]) + m4_include([m4/lib-ld.m4]) + m4_include([m4/lib-link.m4]) + m4_include([m4/lib-prefix.m4]) ++m4_include([m4/libaudit.m4]) + m4_include([m4/libnih.m4]) + m4_include([m4/libtool.m4]) + m4_include([m4/lock.m4]) +diff --git a/conf/Makefile.in b/conf/Makefile.in +index 29fd9b7..82c3f99 100644 +--- a/conf/Makefile.in ++++ b/conf/Makefile.in +@@ -46,17 +46,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ +- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \ +- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ +- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \ +- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ +- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ +- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ +- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ +- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \ +- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \ +- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \ +- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac ++ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \ ++ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \ ++ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \ ++ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ ++ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ ++ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \ ++ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \ ++ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \ ++ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \ ++ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \ ++ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \ ++ $(top_srcdir)/configure.ac + am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) + mkinstalldirs = $(install_sh) -d +@@ -100,6 +101,7 @@ ALLOCA = @ALLOCA@ + AMTAR = @AMTAR@ + AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ + AR = @AR@ ++AUDIT_LDADD = @AUDIT_LDADD@ + AUTOCONF = @AUTOCONF@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ +diff --git a/config.h.in b/config.h.in +index 8a7d63f..8d000aa 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -118,6 +118,9 @@ + /* Define if your file defines LC_MESSAGES. */ + #undef HAVE_LC_MESSAGES + ++/* linux audit support */ ++#undef HAVE_LIBAUDIT ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_LIMITS_H + +diff --git a/configure b/configure +index 9bad2db..2f93ef5 100755 +--- a/configure ++++ b/configure +@@ -751,6 +751,7 @@ ac_subst_vars='am__EXEEXT_FALSE + am__EXEEXT_TRUE + LTLIBOBJS + LIBOBJS ++AUDIT_LDADD + DBUS_LIBS + DBUS_CFLAGS + NIH_DBUS_LIBS +@@ -938,6 +939,7 @@ with_included_gettext + with_libintl_prefix + with_local_libnih + enable_threading ++with_libaudit + enable_compiler_warnings + enable_compiler_optimisations + enable_compiler_coverage +@@ -1620,6 +1622,7 @@ Optional Packages: + --without-libintl-prefix don't search for libintl in includedir and libdir + --with-local-libnih[=DIR] + Use libnih from source tree DIR ++ --with-libaudit=auto/yes/no Add Linux audit support default=auto + + Some influential environment variables: + CC C compiler command +@@ -5220,13 +5223,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : + else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext +- (eval echo "\"\$as_me:5223: $ac_compile\"" >&5) ++ (eval echo "\"\$as_me:5226: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 +- (eval echo "\"\$as_me:5226: $NM \\\"conftest.$ac_objext\\\"\"" >&5) ++ (eval echo "\"\$as_me:5229: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 +- (eval echo "\"\$as_me:5229: output\"" >&5) ++ (eval echo "\"\$as_me:5232: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" +@@ -6431,7 +6434,7 @@ ia64-*-hpux*) + ;; + *-*-irix6*) + # Find out which ABI we are using. +- echo '#line 6434 "configure"' > conftest.$ac_ext ++ echo '#line 6437 "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? +@@ -7693,11 +7696,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:7696: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:7699: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 +- echo "$as_me:7700: \$? = $ac_status" >&5 ++ echo "$as_me:7703: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. +@@ -8032,11 +8035,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:8035: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:8038: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 +- echo "$as_me:8039: \$? = $ac_status" >&5 ++ echo "$as_me:8042: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. +@@ -8137,11 +8140,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:8140: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:8143: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 +- echo "$as_me:8144: \$? = $ac_status" >&5 ++ echo "$as_me:8147: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized +@@ -8192,11 +8195,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:8195: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:8198: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 +- echo "$as_me:8199: \$? = $ac_status" >&5 ++ echo "$as_me:8202: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized +@@ -10576,7 +10579,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 10579 "configure" ++#line 10582 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -10672,7 +10675,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 10675 "configure" ++#line 10678 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -17209,6 +17212,72 @@ fi + + # Checks for library functions. + ++ ++# Check whether --with-libaudit was given. ++if test "${with_libaudit+set}" = set; then : ++ withval=$with_libaudit; ++else ++ with_libaudit=auto ++fi ++ ++ ++ # Check for Linux auditing API ++ # ++ # libaudit detection ++ ++ if test x$with_libaudit = xno ; then ++ have_libaudit=no; ++ else ++ # See if we have audit daemon library ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for audit_log_user_message in -laudit" >&5 ++$as_echo_n "checking for audit_log_user_message in -laudit... " >&6; } ++if test "${ac_cv_lib_audit_audit_log_user_message+set}" = set; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-laudit $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char audit_log_user_message (); ++int ++main () ++{ ++return audit_log_user_message (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_audit_audit_log_user_message=yes ++else ++ ac_cv_lib_audit_audit_log_user_message=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_audit_audit_log_user_message" >&5 ++$as_echo "$ac_cv_lib_audit_audit_log_user_message" >&6; } ++if test "x$ac_cv_lib_audit_audit_log_user_message" = x""yes; then : ++ AUDIT_LDADD=-laudit ++fi ++ ++ fi ++ ++ if test x$AUDIT_LDADD != x ; then ++ ++$as_echo "#define HAVE_LIBAUDIT 1" >>confdefs.h ++ ++ fi ++ ++ + # Other checks + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include sbindir in PATH" >&5 + $as_echo_n "checking whether to include sbindir in PATH... " >&6; } +diff --git a/configure.ac b/configure.ac +index fb79a13..3dc1550 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -54,6 +54,7 @@ AM_PROG_CC_C_O + NIH_C_THREAD + + # Checks for library functions. ++LINUX_AUDIT + + # Other checks + AC_MSG_CHECKING([whether to include sbindir in PATH]) +diff --git a/contrib/Makefile.in b/contrib/Makefile.in +index dfe910b..32c7ebd 100644 +--- a/contrib/Makefile.in ++++ b/contrib/Makefile.in +@@ -44,17 +44,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ +- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \ +- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ +- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \ +- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ +- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ +- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ +- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ +- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \ +- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \ +- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \ +- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac ++ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \ ++ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \ ++ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \ ++ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ ++ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ ++ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \ ++ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \ ++ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \ ++ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \ ++ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \ ++ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \ ++ $(top_srcdir)/configure.ac + am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) + mkinstalldirs = $(install_sh) -d +@@ -75,6 +76,7 @@ ALLOCA = @ALLOCA@ + AMTAR = @AMTAR@ + AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ + AR = @AR@ ++AUDIT_LDADD = @AUDIT_LDADD@ + AUTOCONF = @AUTOCONF@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ +diff --git a/dbus/Makefile.in b/dbus/Makefile.in +index 8294845..38a55ad 100644 +--- a/dbus/Makefile.in ++++ b/dbus/Makefile.in +@@ -46,17 +46,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ +- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \ +- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ +- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \ +- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ +- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ +- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ +- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ +- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \ +- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \ +- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \ +- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac ++ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \ ++ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \ ++ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \ ++ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ ++ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ ++ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \ ++ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \ ++ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \ ++ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \ ++ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \ ++ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \ ++ $(top_srcdir)/configure.ac + am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) + mkinstalldirs = $(install_sh) -d +@@ -100,6 +101,7 @@ ALLOCA = @ALLOCA@ + AMTAR = @AMTAR@ + AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ + AR = @AR@ ++AUDIT_LDADD = @AUDIT_LDADD@ + AUTOCONF = @AUTOCONF@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ +diff --git a/doc/Makefile.in b/doc/Makefile.in +index b17181c..add3022 100644 +--- a/doc/Makefile.in ++++ b/doc/Makefile.in +@@ -44,17 +44,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ +- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \ +- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ +- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \ +- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ +- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ +- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ +- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ +- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \ +- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \ +- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \ +- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac ++ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \ ++ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \ ++ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \ ++ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ ++ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ ++ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \ ++ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \ ++ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \ ++ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \ ++ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \ ++ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \ ++ $(top_srcdir)/configure.ac + am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) + mkinstalldirs = $(install_sh) -d +@@ -75,6 +76,7 @@ ALLOCA = @ALLOCA@ + AMTAR = @AMTAR@ + AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ + AR = @AR@ ++AUDIT_LDADD = @AUDIT_LDADD@ + AUTOCONF = @AUTOCONF@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ +diff --git a/init/Makefile.in b/init/Makefile.in +index c677761..9ca3de6 100644 +--- a/init/Makefile.in ++++ b/init/Makefile.in +@@ -55,17 +55,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ +- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \ +- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ +- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \ +- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ +- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ +- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ +- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ +- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \ +- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \ +- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \ +- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac ++ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \ ++ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \ ++ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \ ++ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ ++ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ ++ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \ ++ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \ ++ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \ ++ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \ ++ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \ ++ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \ ++ $(top_srcdir)/configure.ac + am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) + mkinstalldirs = $(install_sh) -d +@@ -283,6 +284,7 @@ ALLOCA = @ALLOCA@ + AMTAR = @AMTAR@ + AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ + AR = @AR@ ++AUDIT_LDADD = @AUDIT_LDADD@ + AUTOCONF = @AUTOCONF@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ +diff --git a/m4/libaudit.m4 b/m4/libaudit.m4 +new file mode 100644 +index 0000000..6865fb8 +--- /dev/null ++++ b/m4/libaudit.m4 +@@ -0,0 +1,25 @@ ++# libaudit.m4 - Checks for the Linux Audit System support ++# Copyright (c) 2009 Steve Grubb sgrubb@redhat.com ++# ++AC_DEFUN([LINUX_AUDIT], ++[ ++ AC_ARG_WITH(libaudit, ++ [ --with-libaudit=[auto/yes/no] Add Linux audit support [default=auto]],, ++ with_libaudit=auto) ++ ++ # Check for Linux auditing API ++ # ++ # libaudit detection ++ ++ if test x$with_libaudit = xno ; then ++ have_libaudit=no; ++ else ++ # See if we have audit daemon library ++ AC_CHECK_LIB(audit, audit_log_user_message, ++ AUDIT_LDADD=-laudit,) ++ fi ++ AC_SUBST(AUDIT_LDADD) ++ if test x$AUDIT_LDADD != x ; then ++ AC_DEFINE(HAVE_LIBAUDIT,1,[linux audit support]) ++ fi ++]) +diff --git a/util/Makefile.am b/util/Makefile.am +index 0b49c10..9a772d5 100644 +--- a/util/Makefile.am ++++ b/util/Makefile.am +@@ -45,14 +45,17 @@ reboot_SOURCES = \ + utmp.c utmp.h + reboot_LDADD = \ + $(LTLIBINTL) \ +- $(NIH_LIBS) ++ $(NIH_LIBS) \ ++ $(AUDIT_LDADD) ++ + + runlevel_SOURCES = \ + runlevel.c \ + utmp.c utmp.h + runlevel_LDADD = \ + $(LTLIBINTL) \ +- $(NIH_LIBS) ++ $(NIH_LIBS) \ ++ $(AUDIT_LDADD) + + shutdown_SOURCES = \ + shutdown.c \ +@@ -64,7 +67,8 @@ shutdown_LDADD = \ + $(LTLIBINTL) \ + $(NIH_LIBS) \ + $(NIH_DBUS_LIBS) \ +- $(DBUS_LIBS) ++ $(DBUS_LIBS) \ ++ $(AUDIT_LDADD) + + telinit_SOURCES = \ + telinit.c \ +@@ -76,7 +80,8 @@ telinit_LDADD = \ + $(LTLIBINTL) \ + $(NIH_LIBS) \ + $(NIH_DBUS_LIBS) \ +- $(DBUS_LIBS) ++ $(DBUS_LIBS) \ ++ $(AUDIT_LDADD) + + + com_ubuntu_Upstart_OUTPUTS = \ +@@ -201,7 +206,8 @@ test_sysv_LDADD = \ + $(LTLIBINTL) \ + $(NIH_LIBS) \ + $(NIH_DBUS_LIBS) \ +- $(DBUS_LIBS) ++ $(DBUS_LIBS) \ ++ $(AUDIT_LDADD) + + test_telinit_SOURCES = tests/test_telinit.c telinit.c + test_telinit_CFLAGS = $(AM_CFLAGS) -DTEST +@@ -211,7 +217,8 @@ test_telinit_LDADD = \ + com.ubuntu.Upstart.Job.o com.ubuntu.Upstart.Instance.o \ + $(NIH_LIBS) \ + $(NIH_DBUS_LIBS) \ +- $(DBUS_LIBS) ++ $(DBUS_LIBS) \ ++ $(AUDIT_LDADD) + + + .PHONY: tests +diff --git a/util/Makefile.in b/util/Makefile.in +index 55e17e5..40776d5 100644 +--- a/util/Makefile.in ++++ b/util/Makefile.in +@@ -51,17 +51,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ +- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnih.m4 \ +- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ +- $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \ +- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ +- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ +- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ +- $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ +- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \ +- $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \ +- $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \ +- $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac ++ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libaudit.m4 \ ++ $(top_srcdir)/m4/libnih.m4 $(top_srcdir)/m4/libtool.m4 \ ++ $(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \ ++ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ ++ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ ++ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/pkg.m4 \ ++ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \ ++ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \ ++ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \ ++ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \ ++ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \ ++ $(top_srcdir)/configure.ac + am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) + mkinstalldirs = $(install_sh) -d +@@ -88,20 +89,24 @@ am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) + am__v_lt_0 = --silent + am_reboot_OBJECTS = reboot.$(OBJEXT) utmp.$(OBJEXT) + reboot_OBJECTS = $(am_reboot_OBJECTS) +-reboot_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) ++reboot_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ ++ $(am__DEPENDENCIES_1) + am_runlevel_OBJECTS = runlevel.$(OBJEXT) utmp.$(OBJEXT) + runlevel_OBJECTS = $(am_runlevel_OBJECTS) +-runlevel_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) ++runlevel_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ ++ $(am__DEPENDENCIES_1) + am_shutdown_OBJECTS = shutdown.$(OBJEXT) utmp.$(OBJEXT) sysv.$(OBJEXT) + nodist_shutdown_OBJECTS = $(am__objects_1) + shutdown_OBJECTS = $(am_shutdown_OBJECTS) $(nodist_shutdown_OBJECTS) + shutdown_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) ++ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ ++ $(am__DEPENDENCIES_1) + am_telinit_OBJECTS = telinit.$(OBJEXT) utmp.$(OBJEXT) sysv.$(OBJEXT) + nodist_telinit_OBJECTS = $(am__objects_1) + telinit_OBJECTS = $(am_telinit_OBJECTS) $(nodist_telinit_OBJECTS) + telinit_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) ++ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ ++ $(am__DEPENDENCIES_1) + am_test_initctl_OBJECTS = test_initctl-test_initctl.$(OBJEXT) \ + test_initctl-initctl.$(OBJEXT) + test_initctl_OBJECTS = $(am_test_initctl_OBJECTS) +@@ -118,14 +123,14 @@ test_sysv_OBJECTS = $(am_test_sysv_OBJECTS) \ + $(nodist_test_sysv_OBJECTS) + test_sysv_DEPENDENCIES = sysv.o utmp.o $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +- $(am__DEPENDENCIES_1) ++ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + am_test_telinit_OBJECTS = test_telinit-test_telinit.$(OBJEXT) \ + test_telinit-telinit.$(OBJEXT) + test_telinit_OBJECTS = $(am_test_telinit_OBJECTS) + test_telinit_DEPENDENCIES = sysv.o utmp.o com.ubuntu.Upstart.o \ + com.ubuntu.Upstart.Job.o com.ubuntu.Upstart.Instance.o \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +- $(am__DEPENDENCIES_1) ++ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + test_telinit_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_telinit_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +@@ -216,6 +221,7 @@ ALLOCA = @ALLOCA@ + AMTAR = @AMTAR@ + AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ + AR = @AR@ ++AUDIT_LDADD = @AUDIT_LDADD@ + AUTOCONF = @AUTOCONF@ + AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ +@@ -419,7 +425,8 @@ reboot_SOURCES = \ + + reboot_LDADD = \ + $(LTLIBINTL) \ +- $(NIH_LIBS) ++ $(NIH_LIBS) \ ++ $(AUDIT_LDADD) + + runlevel_SOURCES = \ + runlevel.c \ +@@ -427,7 +434,8 @@ runlevel_SOURCES = \ + + runlevel_LDADD = \ + $(LTLIBINTL) \ +- $(NIH_LIBS) ++ $(NIH_LIBS) \ ++ $(AUDIT_LDADD) + + shutdown_SOURCES = \ + shutdown.c \ +@@ -441,7 +449,8 @@ shutdown_LDADD = \ + $(LTLIBINTL) \ + $(NIH_LIBS) \ + $(NIH_DBUS_LIBS) \ +- $(DBUS_LIBS) ++ $(DBUS_LIBS) \ ++ $(AUDIT_LDADD) + + telinit_SOURCES = \ + telinit.c \ +@@ -455,7 +464,8 @@ telinit_LDADD = \ + $(LTLIBINTL) \ + $(NIH_LIBS) \ + $(NIH_DBUS_LIBS) \ +- $(DBUS_LIBS) ++ $(DBUS_LIBS) \ ++ $(AUDIT_LDADD) + + com_ubuntu_Upstart_OUTPUTS = \ + com.ubuntu.Upstart.c \ +@@ -515,7 +525,8 @@ test_sysv_LDADD = \ + $(LTLIBINTL) \ + $(NIH_LIBS) \ + $(NIH_DBUS_LIBS) \ +- $(DBUS_LIBS) ++ $(DBUS_LIBS) \ ++ $(AUDIT_LDADD) + + test_telinit_SOURCES = tests/test_telinit.c telinit.c + test_telinit_CFLAGS = $(AM_CFLAGS) -DTEST +@@ -525,7 +536,8 @@ test_telinit_LDADD = \ + com.ubuntu.Upstart.Job.o com.ubuntu.Upstart.Instance.o \ + $(NIH_LIBS) \ + $(NIH_DBUS_LIBS) \ +- $(DBUS_LIBS) ++ $(DBUS_LIBS) \ ++ $(AUDIT_LDADD) + + all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am +diff --git a/util/reboot.c b/util/reboot.c +index 7a9c071..15028eb 100644 +--- a/util/reboot.c ++++ b/util/reboot.c +@@ -36,6 +36,10 @@ + #include + #include + ++#ifdef HAVE_LIBAUDIT ++#include ++#endif ++ + #include "utmp.h" + + +@@ -103,7 +107,6 @@ static int poweroff = FALSE; + **/ + static int exit_only = FALSE; + +- + /** + * options: + * +@@ -127,6 +130,7 @@ static NihOption options[] = { + NIH_OPTION_LAST + }; + ++static void send_audit_event(void); + + int + main (int argc, +@@ -227,6 +231,8 @@ main (int argc, + /* Re-enable Control-Alt-Delete in case it breaks */ + reboot (RB_ENABLE_CAD); + ++ send_audit_event (); ++ + /* Do the syscall */ + switch (mode) { + case REBOOT: +@@ -248,3 +254,21 @@ main (int argc, + + return 0; + } ++ ++/** ++ * send_audit_event ++ * ++ * Send system shutdown audit event ++ **/ ++static void ++send_audit_event (void) ++{ ++#ifdef HAVE_LIBAUDIT ++ int fd = audit_open (); ++ if (fd < 0) ++ return; ++ audit_log_user_message (fd, AUDIT_SYSTEM_SHUTDOWN, "init", ++ NULL, NULL, NULL, 1); ++ close (fd); ++#endif ++} +diff --git a/util/sysv.c b/util/sysv.c +index fbca39f..5476f79 100644 +--- a/util/sysv.c ++++ b/util/sysv.c +@@ -36,6 +36,12 @@ + #include + #include + ++#include ++#ifdef HAVE_LIBAUDIT ++#include ++#include ++#endif ++ + #include "dbus/upstart.h" + + #include "utmp.h" +@@ -54,6 +60,7 @@ + + /* Prototypes for static functions */ + static void error_handler (NihError **err, NihDBusMessage *message); ++static void send_audit_event (int old, int level); + + + /** +@@ -161,6 +168,8 @@ sysv_change_runlevel (int runlevel, + runlevel, prevlevel) < 0) + nih_free (nih_error_get ()); + ++ send_audit_event(prevlevel, runlevel); ++ + /* Make the EmitEvent call, we don't wait for the event to finish + * because sysvinit never did. + */ +@@ -199,3 +208,41 @@ error_handler (NihError ** err, + { + *err = nih_error_steal (); + } ++ ++/** ++ * send_audit_event ++ * @old: current run level ++ * @level: new run level ++ * ++ * Send system runlevel change audit event. If level is 0, then ++ * we consider this to be a reboot event. ++ **/ ++static void ++send_audit_event (int old, int level) ++{ ++#ifdef HAVE_LIBAUDIT ++ int fd = audit_open (); ++ ++ if (fd < 0) ++ return; ++ ++ /* first runlevel change after boot */ ++ if (old == 'N') ++ audit_log_user_message (fd, AUDIT_SYSTEM_BOOT, "init", ++ NULL, NULL, NULL, 1); ++ ++ char buf[64]; ++ ++ snprintf (buf, sizeof (buf), ++ "old-level=%c new-level=%c", old, level); ++ audit_log_user_message (fd, AUDIT_SYSTEM_RUNLEVEL, buf, ++ NULL, NULL, NULL, 1); ++ ++ /* shutdown or reboot */ ++ if (level == '0' || level == '6') ++ audit_log_user_message (fd, AUDIT_SYSTEM_SHUTDOWN, "init", ++ NULL, NULL, NULL, 1); ++ ++ close (fd); ++#endif ++} diff --git a/upstart-close-fd.patch b/upstart-close-fd.patch new file mode 100644 index 0000000..04391d1 --- /dev/null +++ b/upstart-close-fd.patch @@ -0,0 +1,23 @@ +diff --git a/init/job_process.c b/init/job_process.c +index 8ce2f72..c2c96cb 100644 +--- a/init/job_process.c ++++ b/init/job_process.c +@@ -298,6 +298,7 @@ job_process_run (Job *job, + + /* Feed the script to the child process */ + if (shell) { ++ nih_local char *cmd = NULL; + NihIo *io; + + /* Clean up and close the reading end (we don't need it) */ +@@ -317,6 +318,10 @@ job_process_run (Job *job, + nih_free (err); + } + ++ /* Close leaking fd first */ ++ cmd = NIH_MUST (nih_sprintf (NULL, "<&%d- ;", fds[0])); ++ NIH_ZERO (nih_io_write (io, cmd, strlen (cmd))); ++ + NIH_ZERO (nih_io_write (io, script, strlen (script))); + nih_io_shutdown (io); + } diff --git a/upstart-reexec.patch b/upstart-reexec.patch new file mode 100644 index 0000000..324c3a2 --- /dev/null +++ b/upstart-reexec.patch @@ -0,0 +1,65 @@ +diff -up upstart-0.6.5/init/main.c.foo upstart-0.6.5/init/main.c +--- upstart-0.6.5/init/main.c.foo 2010-04-30 19:38:07.846260462 -0400 ++++ upstart-0.6.5/init/main.c 2010-04-30 21:35:38.690487114 -0400 +@@ -67,6 +67,7 @@ static void kbd_handler (void *data, + static void pwr_handler (void *data, NihSignal *signal); + static void hup_handler (void *data, NihSignal *signal); + static void usr1_handler (void *data, NihSignal *signal); ++static void term_handler (void *data, NihSignal *signal); + #endif /* DEBUG */ + + +@@ -241,6 +242,10 @@ main (int argc, + /* SIGUSR1 instructs us to reconnect to D-Bus */ + nih_signal_set_handler (SIGUSR1, nih_signal_handler); + NIH_MUST (nih_signal_add_handler (NULL, SIGUSR1, usr1_handler, NULL)); ++ ++ /* SIGTERM instructs us to re-exec ourselves */ ++ nih_signal_set_handler (SIGTERM, nih_signal_handler); ++ NIH_MUST (nih_signal_add_handler (NULL, SIGTERM, term_handler, NULL)); + #endif /* DEBUG */ + + +@@ -485,4 +490,42 @@ usr1_handler (void *data, + } + } + } ++ ++/** ++ * term_handler: ++ * @data: unused, ++ * @signal: signal that called this handler ++ * ++ * This is called when we recieve the TERM signal, which instructs us ++ * to reexec ourselves. ++ **/ ++static void ++term_handler (void *data, ++ NihSignal *signal) ++{ ++ NihError *err; ++ sigset_t mask, oldmask; ++ ++ nih_assert (argv0 != NULL); ++ nih_assert (signal != NULL); ++ ++ nih_warn (_("Re-executing %s"), argv0); ++ ++ /* Block signals while we work. We're the last signal handler ++ * installed so this should mean that they're all handled now. ++ * ++ * The child must make sure that it unblocks these again when ++ * it's ready. ++ */ ++ sigfillset (&mask); ++ sigprocmask (SIG_BLOCK, &mask, &oldmask); ++ execl (argv0, argv0, "--restart", NULL); ++ nih_error_raise_system (); ++ ++ err = nih_error_get (); ++ nih_error (_("Failed to re-execute %s: %s"), argv0, err->message); ++ nih_free (err); ++ ++ sigprocmask (SIG_SETMASK, &oldmask, NULL); ++} + #endif /* DEBUG */ diff --git a/upstart-remove-tests.patch b/upstart-remove-tests.patch new file mode 100644 index 0000000..720294a --- /dev/null +++ b/upstart-remove-tests.patch @@ -0,0 +1,213 @@ +diff -up upstart-0.6.3/nih-dbus/tests/test_dbus_connection.c.tests upstart-0.6.3/nih-dbus/tests/test_dbus_connection.c +--- upstart-0.6.3/nih-dbus/tests/test_dbus_connection.c.tests 2009-12-14 15:51:25.323430105 +0100 ++++ upstart-0.6.3/nih-dbus/tests/test_dbus_connection.c 2009-12-14 15:51:25.323430105 +0100 +@@ -1521,7 +1521,6 @@ main (int argc, + nih_error_init (); + + test_connect (); +- test_bus (); + test_setup (); + test_server (); + +diff -up upstart-0.6.3/nih/tests/test_child.c.tests upstart-0.6.3/nih/tests/test_child.c +--- upstart-0.6.3/nih/tests/test_child.c.tests 2009-12-14 15:51:25.910710749 +0100 ++++ upstart-0.6.3/nih/tests/test_child.c 2009-12-14 15:51:25.888145178 +0100 +@@ -328,186 +328,6 @@ test_poll (void) + nih_free (watch); + + +- /* Check that a signal raised from a traced child causes the reaper +- * to be called with a traced event and the event in the status +- * field. It should not be removed from the list since the child +- * hasn't gone away. +- */ +- TEST_FEATURE ("with signal from traced child"); +- +- TEST_CHILD (pid) { +- assert0 (ptrace (PTRACE_TRACEME, 0, NULL, NULL)); +- +- raise (SIGSTOP); +- raise (SIGCHLD); +- pause (); +- exit (0); +- } +- +- waitid (P_PID, pid, &siginfo, WSTOPPED); +- +- assert0 (ptrace (PTRACE_SETOPTIONS, pid, NULL, PTRACE_O_TRACESYSGOOD)); +- assert0 (ptrace (PTRACE_CONT, pid, NULL, SIGCONT)); +- +- waitid (P_PID, pid, &siginfo, WSTOPPED | WNOWAIT); +- +- watch = nih_child_add_watch (NULL, pid, NIH_CHILD_TRAPPED, +- my_handler, &watch); +- +- TEST_FREE_TAG (watch); +- +- handler_called = 0; +- last_data = NULL; +- last_pid = 0; +- last_event = -1; +- last_status = 0; +- +- nih_child_poll (); +- +- TEST_TRUE (handler_called); +- TEST_EQ (last_pid, pid); +- TEST_EQ (last_event, NIH_CHILD_TRAPPED); +- TEST_EQ (last_status, SIGCHLD); +- TEST_NOT_FREE (watch); +- +- assert0 (ptrace (PTRACE_DETACH, pid, NULL, 0)); +- +- kill (pid, SIGTERM); +- waitid (P_PID, pid, &siginfo, WEXITED); +- nih_free (watch); +- +- +-#if HAVE_VALGRIND_VALGRIND_H +- /* These tests fail when running under valgrind. +- */ +- if (! RUNNING_ON_VALGRIND) { +-#endif +- /* Check that when a traced child forks it causes the reaper +- * to be called with a ptrace event and the fork event in the +- * status field. It should not be removed from the list since the +- * child hasn't gone away. +- */ +- TEST_FEATURE ("with fork by traced child"); +- +- TEST_CHILD (pid) { +- assert0 (ptrace (PTRACE_TRACEME, 0, NULL, NULL)); +- +- raise (SIGSTOP); +- +- child = fork (); +- assert (child >= 0); +- +- pause (); +- +- exit (0); +- } +- +- waitid (P_PID, pid, &siginfo, WSTOPPED); +- +- assert0 (ptrace (PTRACE_SETOPTIONS, pid, NULL, +- PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEFORK)); +- assert0 (ptrace (PTRACE_CONT, pid, NULL, SIGCONT)); +- +- /* Wait for ptrace to stop the parent (signalling the fork) */ +- waitid (P_PID, pid, &siginfo, WSTOPPED | WNOWAIT); +- +- /* Will be able to get the child pid now, we have to do it here +- * because we want to wait on it to ensure the test is synchronous; +- * otherwise nih_child_poll() could actually eat the child event +- * before it returns -- normally we'd do this inside the handler, +- * so things would probably work (we iter the handlers for each +- * event, so you can add one). +- */ +- data = 0; +- assert0 (ptrace (PTRACE_GETEVENTMSG, pid, NULL, &data)); +- assert (data != 0); +- child = (pid_t)data; +- +- /* Wait for ptrace to stop the child, otherwise it might not be +- * ready for us to actually detach from. +- */ +- waitid (P_PID, child, &siginfo, WSTOPPED | WNOWAIT); +- +- watch = nih_child_add_watch (NULL, pid, NIH_CHILD_PTRACE, +- my_handler, &watch); +- +- TEST_FREE_TAG (watch); +- +- handler_called = 0; +- last_data = NULL; +- last_pid = 0; +- last_event = -1; +- last_status = 0; +- +- nih_child_poll (); +- +- TEST_TRUE (handler_called); +- TEST_EQ (last_pid, pid); +- TEST_EQ (last_event, NIH_CHILD_PTRACE); +- TEST_EQ (last_status, PTRACE_EVENT_FORK); +- TEST_NOT_FREE (watch); +- +- assert0 (ptrace (PTRACE_DETACH, child, NULL, SIGCONT)); +- kill (child, SIGTERM); +- +- assert0 (ptrace (PTRACE_DETACH, pid, NULL, SIGCONT)); +- kill (pid, SIGTERM); +- waitid (P_PID, pid, &siginfo, WEXITED); +- nih_free (watch); +- +- +- /* Check that when a traced child execs it causes the reaper +- * to be called with a ptrace event and the exec event in the +- * status field. It should not be removed from the list since the +- * child hasn't gone away. +- */ +- TEST_FEATURE ("with exec by traced child"); +- +- TEST_CHILD (pid) { +- assert0 (ptrace (PTRACE_TRACEME, 0, NULL, NULL)); +- +- raise (SIGSTOP); +- +- execl ("/bin/true", "true", NULL); +- exit (255); +- } +- +- waitid (P_PID, pid, &siginfo, WSTOPPED); +- +- assert0 (ptrace (PTRACE_SETOPTIONS, pid, NULL, +- PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEEXEC)); +- assert0 (ptrace (PTRACE_CONT, pid, NULL, SIGCONT)); +- +- waitid (P_PID, pid, &siginfo, WSTOPPED | WNOWAIT); +- +- watch = nih_child_add_watch (NULL, pid, NIH_CHILD_PTRACE, +- my_handler, &watch); +- +- TEST_FREE_TAG (watch); +- +- handler_called = 0; +- last_data = NULL; +- last_pid = 0; +- last_event = -1; +- last_status = 0; +- +- nih_child_poll (); +- +- TEST_TRUE (handler_called); +- TEST_EQ (last_pid, pid); +- TEST_EQ (last_event, NIH_CHILD_PTRACE); +- TEST_EQ (last_status, PTRACE_EVENT_EXEC); +- TEST_NOT_FREE (watch); +- +- assert0 (ptrace (PTRACE_DETACH, pid, NULL, SIGCONT)); +- +- waitid (P_PID, pid, &siginfo, WEXITED); +- nih_free (watch); +-#if HAVE_VALGRIND_VALGRIND_H +- } +-#endif +- +- + /* Check that we can watch for events from any process, which + * shouldn't be freed when the child dies. + */ +diff -up upstart-0.6.3/nih/tests/test_string.c.tests upstart-0.6.3/nih/tests/test_string.c +--- upstart-0.6.3/nih/tests/test_string.c.tests 2009-12-17 12:34:43.357844975 +0100 ++++ upstart-0.6.3/nih/tests/test_string.c 2009-12-17 12:38:41.911484010 +0100 +@@ -1511,8 +1511,6 @@ main (int argc, + test_array_copy (); + test_array_append (); + test_str_wrap (); +- test_str_screen_width (); +- test_str_screen_wrap (); + + return 0; + } diff --git a/upstart-shutdown-exitcode.patch b/upstart-shutdown-exitcode.patch new file mode 100644 index 0000000..0b70308 --- /dev/null +++ b/upstart-shutdown-exitcode.patch @@ -0,0 +1,28 @@ +diff --git a/util/shutdown.c b/util/shutdown.c +index 0a6d8bf..2ef847a 100644 +--- a/util/shutdown.c ++++ b/util/shutdown.c +@@ -459,6 +459,7 @@ shutdown_now (void) + { + nih_local char **extra_env = NULL; + NihDBusError * dbus_err; ++ int exit_val = 0; + + if (init_halt) { + char *e; +@@ -486,12 +487,14 @@ shutdown_now (void) + * yet rebooted ... so try /dev/initctl + */ + sysvinit_shutdown (); ++ nih_fatal ("Unable to shutdown system"); ++ exit_val = 1; + } + + unlink (ETC_NOLOGIN); + nih_main_unlink_pidfile (); + +- exit (0); ++ exit (exit_val); + } + + /** diff --git a/upstart-telinit.patch b/upstart-telinit.patch new file mode 100644 index 0000000..3cc2b1e --- /dev/null +++ b/upstart-telinit.patch @@ -0,0 +1,13 @@ +diff -up upstart-0.6.3/util/telinit.c.foo upstart-0.6.3/util/telinit.c +--- upstart-0.6.3/util/telinit.c.foo 2009-12-03 14:52:58.000000000 -0500 ++++ upstart-0.6.3/util/telinit.c 2009-12-03 14:53:06.000000000 -0500 +@@ -174,9 +174,6 @@ main (int argc, + break; + case 'U': + case 'u': +- ret = kill (1, SIGTERM); +- if (ret < 0) +- nih_error_raise_system (); + break; + default: + nih_assert_not_reached (); diff --git a/upstart-utmp.patch b/upstart-utmp.patch new file mode 100644 index 0000000..255bc50 --- /dev/null +++ b/upstart-utmp.patch @@ -0,0 +1,317 @@ +diff --git a/init/job_class.c b/init/job_class.c +index b521cf4..1b8d1cf 100644 +--- a/init/job_class.c ++++ b/init/job_class.c +@@ -218,6 +218,8 @@ job_class_new (const void *parent, + class->chroot = NULL; + class->chdir = NULL; + ++ class->utmp_id = NULL; ++ + class->deleted = FALSE; + + return class; +diff --git a/init/job_class.h b/init/job_class.h +index b7d4eed..1d29c59 100644 +--- a/init/job_class.h ++++ b/init/job_class.h +@@ -145,6 +145,7 @@ typedef struct job_class { + struct rlimit *limits[RLIMIT_NLIMITS]; + char *chroot; + char *chdir; ++ char *utmp_id; + + int deleted; + } JobClass; +diff --git a/init/job_process.c b/init/job_process.c +index e3080d8..8ce2f72 100644 +--- a/init/job_process.c ++++ b/init/job_process.c +@@ -38,6 +38,8 @@ + #include + #include + #include ++#include ++#include + + #include + #include +@@ -361,11 +363,13 @@ job_process_spawn (JobClass *class, + char * const *env, + int trace) + { +- sigset_t child_set, orig_set; +- pid_t pid; +- int i, fds[2]; +- char filename[PATH_MAX]; +- FILE *fd; ++ sigset_t child_set, orig_set; ++ pid_t pid; ++ int i, fds[2]; ++ char filename[PATH_MAX]; ++ FILE *fd; ++ struct utmpx utmp; ++ struct timeval tv; + + nih_assert (class != NULL); + +@@ -524,6 +528,20 @@ job_process_spawn (JobClass *class, + } + } + ++ /* Write utmp INIT_PROCESS entry */ ++ if (class->utmp_id) { ++ memset(&utmp, 0, sizeof(struct utmpx)); ++ strncpy(utmp.ut_id, class->utmp_id, sizeof(utmp.ut_id)); ++ utmp.ut_pid = getpid(); ++ utmp.ut_type = INIT_PROCESS; ++ gettimeofday(&tv, NULL); ++ utmp.ut_tv.tv_sec = tv.tv_sec; ++ utmp.ut_tv.tv_usec = tv.tv_usec; ++ setutxent(); ++ pututxline(&utmp); ++ endutxent(); ++ } ++ + /* Execute the process, if we escape from here it failed */ + if (execvp (argv[0], argv) < 0) { + nih_error_raise_system (); +@@ -967,6 +985,8 @@ job_process_terminated (Job *job, + int status) + { + int failed = FALSE, stop = FALSE, state = TRUE; ++ struct utmpx *utmptr; ++ struct timeval tv; + + nih_assert (job != NULL); + +@@ -1129,6 +1149,36 @@ job_process_terminated (Job *job, + job->kill_process = -1; + } + ++ /* Find existing utmp entry for the process pid */ ++ setutxent(); ++ while ((utmptr = getutxent()) != NULL) { ++ if (utmptr->ut_pid == job->pid[process]) { ++ /* set type and clean ut_user, ut_host, ++ * ut_time as described in utmp(5) ++ */ ++ utmptr->ut_type = DEAD_PROCESS; ++ memset(utmptr->ut_user, 0, UT_NAMESIZE); ++ memset(utmptr->ut_host, 0, UT_HOSTSIZE); ++ utmptr->ut_time = 0; ++ ++ /* Set class utmp_id for next spawn */ ++ job->class->utmp_id = nih_strdup (job->class, utmptr->ut_id); ++ ++ /* Update existing utmp file. */ ++ pututxline(utmptr); ++ ++ /* set ut_time for log */ ++ gettimeofday(&tv, NULL); ++ utmptr->ut_tv.tv_sec = tv.tv_sec; ++ utmptr->ut_tv.tv_usec = tv.tv_usec; ++ /* Write wtmp entry */ ++ updwtmpx (_PATH_WTMP, utmptr); ++ ++ break; ++ } ++ } ++ endutxent(); ++ + /* Clear the process pid field */ + job->pid[process] = 0; + +diff --git a/init/tests/test_job_process.c b/init/tests/test_job_process.c +index d43fa6e..b4f94e4 100644 +--- a/init/tests/test_job_process.c ++++ b/init/tests/test_job_process.c +@@ -36,6 +36,8 @@ + #include + #include + #include ++#include ++#include + + #include + #include +@@ -4474,6 +4476,171 @@ test_find (void) + } + + ++void ++test_utmp (void) ++{ ++ JobClass * class; ++ Job * job = NULL; ++ Blocked * blocked = NULL; ++ Event * event; ++ FILE * output; ++ char utmpname[PATH_MAX]; ++ struct utmpx utmp, *utmptr; ++ struct timeval tv; ++ ++ TEST_FUNCTION ("job_process_handler"); ++ program_name = "test"; ++ ++ class = job_class_new (NULL, "test"); ++ class->process[PROCESS_MAIN] = process_new (class); ++ class->process[PROCESS_MAIN]->command = "echo"; ++ ++ class->start_on = event_operator_new (class, EVENT_MATCH, ++ "foo", NULL); ++ class->stop_on = event_operator_new (class, EVENT_MATCH, ++ "foo", NULL); ++ nih_hash_add (job_classes, &class->entry); ++ ++ event = event_new (NULL, "foo", NULL); ++ ++ TEST_FILENAME(utmpname); ++ ++ /* Check that utmp record for the running task of the job terminating ++ * is properly changed to DEAD_PROCESS ++ */ ++ TEST_FEATURE ("with LOGIN_PROCESS utmp entry"); ++ TEST_ALLOC_FAIL { ++ TEST_ALLOC_SAFE { ++ job = job_new (class, ""); ++ ++ blocked = blocked_new (job, BLOCKED_EVENT, event); ++ event_block (event); ++ nih_list_add (&job->blocking, &blocked->entry); ++ } ++ ++ job->goal = JOB_START; ++ job->state = JOB_RUNNING; ++ job->pid[PROCESS_MAIN] = 1; ++ ++ TEST_FREE_TAG (blocked); ++ ++ job->blocker = NULL; ++ event->failed = FALSE; ++ ++ job->failed = FALSE; ++ job->failed_process = -1; ++ job->exit_status = 0; ++ ++ output = fopen (utmpname, "w"); ++ fclose (output); ++ ++ /* set utmp file */ ++ utmpxname(utmpname); ++ ++ /* set up utmp entries */ ++ memset (&utmp, 0, sizeof utmp); ++ ++ strcpy(utmp.ut_id, "2"); ++ utmp.ut_type = LOGIN_PROCESS; ++ utmp.ut_pid = 2; ++ ++ gettimeofday(&tv, NULL); ++ utmp.ut_tv.tv_sec = tv.tv_sec; ++ utmp.ut_tv.tv_usec = tv.tv_usec; ++ ++ setutxent(); ++ pututxline(&utmp); ++ ++ strcpy(utmp.ut_id, "1"); ++ utmp.ut_pid = 1; ++ pututxline(&utmp); ++ ++ endutxent(); ++ ++ job_process_handler (NULL, 1, NIH_CHILD_EXITED, 0); ++ ++ setutxent(); ++ ++ utmptr = getutxent(); ++ TEST_NE_P(utmptr, NULL); ++ TEST_EQ(utmptr->ut_pid, 2); ++ TEST_EQ(utmptr->ut_type, LOGIN_PROCESS); ++ ++ utmptr = getutxent(); ++ TEST_NE_P(utmptr, NULL); ++ TEST_EQ(utmptr->ut_pid, 1); ++ TEST_EQ(utmptr->ut_type, DEAD_PROCESS); ++ ++ nih_free (job); ++ } ++ TEST_FEATURE ("with USER_PROCESS utmp entry"); ++ TEST_ALLOC_FAIL { ++ TEST_ALLOC_SAFE { ++ job = job_new (class, ""); ++ ++ blocked = blocked_new (job, BLOCKED_EVENT, event); ++ event_block (event); ++ nih_list_add (&job->blocking, &blocked->entry); ++ } ++ ++ job->goal = JOB_START; ++ job->state = JOB_RUNNING; ++ job->pid[PROCESS_MAIN] = 1; ++ ++ TEST_FREE_TAG (blocked); ++ ++ job->blocker = NULL; ++ event->failed = FALSE; ++ ++ job->failed = FALSE; ++ job->failed_process = -1; ++ job->exit_status = 0; ++ ++ output = fopen (utmpname, "w"); ++ fclose (output); ++ ++ /* set utmp file */ ++ utmpxname(utmpname); ++ ++ /* set up utmp entries */ ++ memset (&utmp, 0, sizeof utmp); ++ ++ strcpy(utmp.ut_id, "2"); ++ utmp.ut_type = USER_PROCESS; ++ utmp.ut_pid = 2; ++ ++ gettimeofday(&tv, NULL); ++ utmp.ut_tv.tv_sec = tv.tv_sec; ++ utmp.ut_tv.tv_usec = tv.tv_usec; ++ ++ setutxent(); ++ pututxline(&utmp); ++ ++ strcpy(utmp.ut_id, "1"); ++ utmp.ut_pid = 1; ++ pututxline(&utmp); ++ ++ endutxent(); ++ ++ job_process_handler (NULL, 1, NIH_CHILD_EXITED, 0); ++ ++ setutxent(); ++ ++ utmptr = getutxent(); ++ TEST_NE_P(utmptr, NULL); ++ TEST_EQ(utmptr->ut_pid, 2); ++ TEST_EQ(utmptr->ut_type, USER_PROCESS); ++ ++ utmptr = getutxent(); ++ TEST_NE_P(utmptr, NULL); ++ TEST_EQ(utmptr->ut_pid, 1); ++ TEST_EQ(utmptr->ut_type, DEAD_PROCESS); ++ ++ nih_free (job); ++ } ++} ++ ++ + int + main (int argc, + char *argv[]) +@@ -4505,6 +4672,7 @@ main (int argc, + test_spawn (); + test_kill (); + test_handler (); ++ test_utmp (); + + test_find (); + diff --git a/upstart.spec b/upstart.spec new file mode 100644 index 0000000..78bb641 --- /dev/null +++ b/upstart.spec @@ -0,0 +1,240 @@ +Name: upstart +Version: 0.6.5 +Release: 7%{?dist} +Summary: An event-driven init system + +Group: System Environment/Base +License: GPLv2 and LGPLv2+ +URL: http://upstart.ubuntu.com +Source0: http://upstart.ubuntu.com/download/0.6/upstart-%{version}.tar.gz +Source1: init-system-dbus.conf +Patch1: upstart-telinit.patch +Patch2: upstart-audit-events.patch +# set DEAD_PROCESS for dead process with pid in utmp table (#572199, #632568) +Patch3: upstart-utmp.patch +Patch4: upstart-reexec.patch +# shutdown exits with nonzero exitcode when fails +Patch5: upstart-shutdown-exitcode.patch +# send close fd command to shell first (#646894) +Patch6: upstart-close-fd.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, audit-libs-devel, expat-devel +BuildRequires: dbus-devel >= 1:1.2.16, libnih-devel >= 1.0.1 +Conflicts: initscripts < 9.12 + +%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 +%patch1 -p1 -b .u +%patch2 -p1 -b .audit +%patch3 -p1 -b .utmp +%patch4 -p1 -b .reexec +%patch5 -p1 -b .exitcode +%patch6 -p1 -b .closefd + +%build +%configure --sbindir=/sbin --libdir=/%{_lib} +make %{?_smp_mflags} + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} + +# don't ship default jobs +rm -f %{buildroot}/%{_sysconfdir}/init/* +install -m 644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init/ + +%find_lang %{name} + +%check +#some tests fail in koji while pass in mock and local build +#to run make check use "--with check" +%if %{?_with_check:1}%{!?_with_check:0} + make check +%endif + +%clean +rm -rf %{buildroot} + +%triggerpostun -- upstart < 0.6.0 +[ -f /proc/1/exe -a -d /proc/1/root ] && kill -TERM 1 + +%files -f %{name}.lang +%defattr(-,root,root,-) +%doc AUTHORS +%doc COPYING +%doc NEWS +%doc README +%doc TODO +%doc HACKING +%{_sysconfdir}/init/ +%config(noreplace) %{_sysconfdir}/dbus-1/system.d/Upstart.conf +/sbin/halt +/sbin/init +/sbin/initctl +/sbin/poweroff +/sbin/reboot +/sbin/runlevel +/sbin/shutdown +/sbin/start +/sbin/status +/sbin/stop +/sbin/restart +/sbin/telinit +/sbin/reload +%{_mandir}/man5/init.5.gz +%{_mandir}/man5/inittab.5.gz +%{_mandir}/man7/control-alt-delete.7.gz +%{_mandir}/man7/keyboard-request.7.gz +%{_mandir}/man7/power-status-changed.7.gz +%{_mandir}/man7/runlevel.7.gz +%{_mandir}/man7/started.7.gz +%{_mandir}/man7/starting.7.gz +%{_mandir}/man7/startup.7.gz +%{_mandir}/man7/stopped.7.gz +%{_mandir}/man7/stopping.7.gz +%{_mandir}/man7/upstart.7.gz +%{_mandir}/man8/restart.8.gz +%{_mandir}/man8/halt.8.gz +%{_mandir}/man8/init.8.gz +%{_mandir}/man8/initctl.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 +%{_mandir}/man8/reload.8.gz + +%changelog +* Tue Oct 26 2010 Petr Lautrbach 0.6.5-7 +- send close fd command to shell first (#646894) + +* Tue Sep 21 2010 Petr Lautrbach 0.6.5-6 +- set DEAD_PROCESS for dead process with pid in utmp table (#572199, #632568) +- exit shutdown with nonzero exitcode when fails shutdown + +* Tue May 4 2010 Bill Nottingham 0.6.5-5 +- re-add SIGTERM handler so restart on shutdown works, avoiding dirty inodes (#576662) + +* Tue Apr 6 2010 Casey Dahlin 0.6.5-4 +- Reload init after install + +* Wed Feb 24 2010 Petr Lautrbach 0.6.5-3 +- run "make check" only with --with check + +* Fri Feb 19 2010 Casey Dahlin 0.6.5-2 +- be more specific about which libnih we need. + +* Wed Feb 17 2010 Petr Lautrbach 0.6.5-1 +- upgrade to 0.6.5 + +* Fri Jan 29 2010 Petr Lautrbach 0.6.3-7 +- add SIGUSR1 handler and init-system-dbus.conf (#559660) + +* Sun Jan 17 2010 Dennis Gilmore - 0.6.3-6 +- add patch from upstream fixing sparc alignment issues + +* Mon Jan 11 2010 Petr Lautrbach 0.6.3-5 +- License changed to GPLv2 and LGPLv2+ + +* Wed Dec 16 2009 Petr Lautrbach 0.6.3-4 +- audit events patch rebased for 0.6 (#470661) + +* Thu Dec 3 2009 Bill Nottingham 0.6.3-3 +- make 'telinit u' a no-op, temporarily + +* Fri Nov 27 2009 Petr Lautrbach 0.6.3-2 +- Removed tests which fail in koji + +* Fri Nov 20 2009 Casey Dahlin - 0.6.3-1 +- Upgrade to 0.6.3 + +* Fri Aug 21 2009 Tomas Mraz - 0.3.11-3 +- rebuilt with new audit + +* Sun Jul 26 2009 Fedora Release Engineering - 0.3.11-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jun 22 2009 Petr Lautrbach - 0.3.11-1 +- Update to 0.3.11 + +* Mon Apr 27 2009 Bill Nottingham - 0.3.9-24 +- Apply the audit patch correctly (#470661) + +* Fri Apr 3 2009 Casey Dahlin - 0.3.9-23 +- Add audit events patch from Steve Grubb (Bug #470661) + +* Fri Jan 23 2009 Casey Dahlin - 0.3.9-22 +- Re-add 'telinit u' support along with patch to fix it (#450488). Patch due to + + +* Mon Jan 12 2009 Bill Nottingham - 0.3.9-21 +- Remove 'telinit u' support as it is broken (#450488, ) + +* Fri Apr 25 2008 Bill Nottingham - 0.3.9-19 +- with the merge of event-compat-sysv, move the sysvinit obsoletes/provides here + +* Thu Apr 24 2008 Bill Nottingham - 0.3.9-18 +- fix some man page typos (#444008, ) + +* Wed Apr 09 2008 Casey Dahlin - 0.3.9-17 +- Added list of stock events to events(5) + +* Tue Apr 08 2008 Casey Dahlin - 0.3.9-16 +- Add telinit u support + +* Fri Apr 04 2008 Bill Nottingham - 0.3.9-15 +- Add a events(5) manpage that describes event syntax + +* Thu Apr 03 2008 Casey Dahlin - 0.3.9-14 +- Change bug report email address to fedora-devel-list@redhat.com + +* Thu Mar 14 2008 Bill Nottingham - 0.3.9-13 +- Ignore rpm temporary files of the foo; format +- Make ignores of .rpm{new,orig,save} match only at the end of the name + +* Wed Mar 13 2008 Bill Nottingham - 0.3.9-12 +- forgot about rpmorig too (ugh) + +* Wed Mar 13 2008 Casey Dahlin - 0.3.9-11 +- Make logd a noreplace + +* Wed Mar 13 2008 Casey Dahlin - 0.3.9-10 +- Add patch to ignore .rpm{new,save} files + +* Sun Mar 03 2008 Casey Dahlin - 0.3.9-9 +- Remove automake dependency, build Makefile.in changes into patch + +* Sun Mar 03 2008 Casey Dahlin - 0.3.9-8 +- Run automake after patching + +* Sun Mar 03 2008 Casey Dahlin - 0.3.9-7 +- Added BuildRequires: automake + +* Sun Mar 03 2008 Casey Dahlin - 0.3.9-6 +- Added patch to allow runtime tty changes + +* Fri Feb 15 2008 Casey Dahlin - 0.3.9-5 +- Added patch to imply --force on runlevels 0 and 6 + +* Wed Feb 06 2008 Casey Dahlin - 0.3.9-4 +- Patched for GCC 4.3 + +* Thu Jan 31 2008 Casey Dahlin - 0.3.9-3 +- Added AUTHORS, COPYING, etc. +- Made config --libdir option relative + +* Mon Jan 21 2008 Casey Dahlin - 0.3.9-2 +- Remove libnih and libupstart + +* Sun Jan 13 2008 Casey Dahlin - 0.3.9-1 +- Initial packaging