diff options
author | Michael Biebl <biebl@debian.org> | 2009-07-14 17:41:06 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2009-07-14 17:41:06 +0200 |
commit | 1f223c41689bbbd64f8749ff7c09967a49407022 (patch) | |
tree | 940cfec56674c79c9a00820529f9c98f7dd6f48a /tools | |
parent | 517ae9bab3e1aeda58ef4f042fa1346d411a9a4c (diff) | |
download | consolekit-1f223c41689bbbd64f8749ff7c09967a49407022.tar.gz |
Imported Upstream version 0.2.10upstream/0.2.10
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 66 | ||||
-rw-r--r-- | tools/Makefile.in | 339 | ||||
-rw-r--r-- | tools/ck-collect-session-info.c | 6 | ||||
-rw-r--r-- | tools/ck-history.c | 866 | ||||
-rw-r--r-- | tools/ck-launch-session.c | 92 | ||||
-rw-r--r-- | tools/ck-log-system-restart.c | 174 | ||||
-rw-r--r-- | tools/ck-log-system-start.c | 174 | ||||
-rw-r--r-- | tools/ck-log-system-stop.c | 174 | ||||
-rw-r--r-- | tools/freebsd/Makefile.am | 38 | ||||
-rw-r--r-- | tools/freebsd/Makefile.in | 585 | ||||
-rwxr-xr-x | tools/freebsd/ck-system-restart | 12 | ||||
-rwxr-xr-x | tools/freebsd/ck-system-stop | 18 | ||||
-rw-r--r-- | tools/linux/Makefile.am | 38 | ||||
-rw-r--r-- | tools/linux/Makefile.in | 203 | ||||
-rwxr-xr-x | tools/linux/ck-system-restart | 12 | ||||
-rwxr-xr-x | tools/linux/ck-system-stop | 12 | ||||
-rw-r--r-- | tools/list-sessions.c | 58 | ||||
-rw-r--r-- | tools/solaris/Makefile.am | 38 | ||||
-rw-r--r-- | tools/solaris/Makefile.in | 585 | ||||
-rwxr-xr-x | tools/solaris/ck-system-restart | 3 | ||||
-rwxr-xr-x | tools/solaris/ck-system-stop | 3 |
21 files changed, 3260 insertions, 236 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index 5283e18..13c191f 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -10,14 +10,25 @@ if CK_COMPILE_LINUX SUBDIRS += linux endif +if CK_COMPILE_FREEBSD +SUBDIRS += freebsd +endif + +if CK_COMPILE_SOLARIS +SUBDIRS += solaris +endif + DIST_SUBDIRS = \ linux \ + freebsd \ + solaris \ $(NULL) INCLUDES = \ -I. \ -I$(srcdir) \ -I$(top_srcdir)/src \ + -I$(top_srcdir)/libck-connector \ $(CONSOLE_KIT_CFLAGS) \ $(DISABLE_DEPRECATED_CFLAGS) \ -DPREFIX=\""$(prefix)"\" \ @@ -26,13 +37,32 @@ INCLUDES = \ -DLIBEXECDIR=\""$(libexecdir)"\" \ -DDATADIR=\""$(datadir)"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DLOCALSTATEDIR=\""$(localstatedir)"\" \ + $(HISTORY_CFLAGS) \ $(WARN_CFLAGS) \ $(DEBUG_CFLAGS) \ $(DBUS_CFLAGS) \ $(NULL) bin_PROGRAMS = \ + ck-launch-session \ ck-list-sessions \ + ck-history \ + $(NULL) + +sbin_PROGRAMS = \ + ck-log-system-start \ + ck-log-system-restart \ + ck-log-system-stop \ + $(NULL) + +ck_launch_session_SOURCES = \ + ck-launch-session.c \ + $(NULL) + +ck_launch_session_LDADD = \ + $(top_builddir)/libck-connector/libck-connector.la \ + $(CONSOLE_KIT_LIBS) \ $(NULL) ck_list_sessions_SOURCES = \ @@ -43,6 +73,42 @@ ck_list_sessions_LDADD = \ $(CONSOLE_KIT_LIBS) \ $(NULL) +ck_history_SOURCES = \ + ck-history.c \ + $(NULL) + +ck_history_LDADD = \ + $(HISTORY_LIBS) \ + $(Z_LIBS) \ + $(top_builddir)/src/libck-event-log.la \ + $(NULL) + +ck_log_system_start_SOURCES = \ + ck-log-system-start.c \ + $(NULL) + +ck_log_system_start_LDADD = \ + $(HISTORY_LIBS) \ + $(top_builddir)/src/libck-event-log.la \ + $(NULL) + +ck_log_system_restart_SOURCES = \ + ck-log-system-restart.c \ + $(NULL) + +ck_log_system_restart_LDADD = \ + $(HISTORY_LIBS) \ + $(top_builddir)/src/libck-event-log.la \ + $(NULL) + +ck_log_system_stop_SOURCES = \ + ck-log-system-stop.c \ + $(NULL) + +ck_log_system_stop_LDADD = \ + $(HISTORY_LIBS) \ + $(top_builddir)/src/libck-event-log.la \ + $(NULL) libexec_PROGRAMS = \ ck-collect-session-info \ diff --git a/tools/Makefile.in b/tools/Makefile.in index a876d3b..a6ffb73 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,15 +14,11 @@ @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -37,7 +33,13 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @CK_COMPILE_LINUX_TRUE@am__append_1 = linux -bin_PROGRAMS = ck-list-sessions$(EXEEXT) $(am__EXEEXT_1) +@CK_COMPILE_FREEBSD_TRUE@am__append_2 = freebsd +@CK_COMPILE_SOLARIS_TRUE@am__append_3 = solaris +bin_PROGRAMS = ck-launch-session$(EXEEXT) ck-list-sessions$(EXEEXT) \ + ck-history$(EXEEXT) $(am__EXEEXT_1) +sbin_PROGRAMS = ck-log-system-start$(EXEEXT) \ + ck-log-system-restart$(EXEEXT) ck-log-system-stop$(EXEEXT) \ + $(am__EXEEXT_1) libexec_PROGRAMS = ck-collect-session-info$(EXEEXT) \ ck-get-x11-server-pid$(EXEEXT) \ ck-get-x11-display-device$(EXEEXT) $(am__EXEEXT_1) @@ -52,10 +54,12 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__EXEEXT_1 = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(sbindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) libexecPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) $(libexec_PROGRAMS) +sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) $(libexec_PROGRAMS) $(sbin_PROGRAMS) am__objects_1 = am_ck_collect_session_info_OBJECTS = \ ck-collect-session-info.$(OBJEXT) $(am__objects_1) @@ -75,39 +79,72 @@ am_ck_get_x11_server_pid_OBJECTS = ck-get-x11-server-pid.$(OBJEXT) \ ck_get_x11_server_pid_OBJECTS = $(am_ck_get_x11_server_pid_OBJECTS) ck_get_x11_server_pid_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(top_builddir)/src/libck.la $(am__DEPENDENCIES_1) +am_ck_history_OBJECTS = ck-history.$(OBJEXT) $(am__objects_1) +ck_history_OBJECTS = $(am_ck_history_OBJECTS) +ck_history_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(top_builddir)/src/libck-event-log.la $(am__DEPENDENCIES_1) +am_ck_launch_session_OBJECTS = ck-launch-session.$(OBJEXT) \ + $(am__objects_1) +ck_launch_session_OBJECTS = $(am_ck_launch_session_OBJECTS) +ck_launch_session_DEPENDENCIES = \ + $(top_builddir)/libck-connector/libck-connector.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_ck_list_sessions_OBJECTS = list-sessions.$(OBJEXT) $(am__objects_1) ck_list_sessions_OBJECTS = $(am_ck_list_sessions_OBJECTS) ck_list_sessions_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +am_ck_log_system_restart_OBJECTS = ck-log-system-restart.$(OBJEXT) \ + $(am__objects_1) +ck_log_system_restart_OBJECTS = $(am_ck_log_system_restart_OBJECTS) +ck_log_system_restart_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/src/libck-event-log.la $(am__DEPENDENCIES_1) +am_ck_log_system_start_OBJECTS = ck-log-system-start.$(OBJEXT) \ + $(am__objects_1) +ck_log_system_start_OBJECTS = $(am_ck_log_system_start_OBJECTS) +ck_log_system_start_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/src/libck-event-log.la $(am__DEPENDENCIES_1) +am_ck_log_system_stop_OBJECTS = ck-log-system-stop.$(OBJEXT) \ + $(am__objects_1) +ck_log_system_stop_OBJECTS = $(am_ck_log_system_stop_OBJECTS) +ck_log_system_stop_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/src/libck-event-log.la $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ SOURCES = $(ck_collect_session_info_SOURCES) \ $(ck_get_x11_display_device_SOURCES) \ - $(ck_get_x11_server_pid_SOURCES) $(ck_list_sessions_SOURCES) + $(ck_get_x11_server_pid_SOURCES) $(ck_history_SOURCES) \ + $(ck_launch_session_SOURCES) $(ck_list_sessions_SOURCES) \ + $(ck_log_system_restart_SOURCES) \ + $(ck_log_system_start_SOURCES) $(ck_log_system_stop_SOURCES) DIST_SOURCES = $(ck_collect_session_info_SOURCES) \ $(ck_get_x11_display_device_SOURCES) \ - $(ck_get_x11_server_pid_SOURCES) $(ck_list_sessions_SOURCES) + $(ck_get_x11_server_pid_SOURCES) $(ck_history_SOURCES) \ + $(ck_launch_session_SOURCES) $(ck_list_sessions_SOURCES) \ + $(ck_log_system_restart_SOURCES) \ + $(ck_log_system_start_SOURCES) $(ck_log_system_stop_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -120,12 +157,6 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CK_BACKEND = @CK_BACKEND@ -CK_COMPILE_FREEBSD_FALSE = @CK_COMPILE_FREEBSD_FALSE@ -CK_COMPILE_FREEBSD_TRUE = @CK_COMPILE_FREEBSD_TRUE@ -CK_COMPILE_LINUX_FALSE = @CK_COMPILE_LINUX_FALSE@ -CK_COMPILE_LINUX_TRUE = @CK_COMPILE_LINUX_TRUE@ -CK_COMPILE_SOLARIS_FALSE = @CK_COMPILE_SOLARIS_FALSE@ -CK_COMPILE_SOLARIS_TRUE = @CK_COMPILE_SOLARIS_TRUE@ CONSOLE_KIT_CFLAGS = @CONSOLE_KIT_CFLAGS@ CONSOLE_KIT_LIBS = @CONSOLE_KIT_LIBS@ CONSOLE_KIT_PID_FILE = @CONSOLE_KIT_PID_FILE@ @@ -142,17 +173,11 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_DOCS_ENABLED_FALSE = @DOCBOOK_DOCS_ENABLED_FALSE@ -DOCBOOK_DOCS_ENABLED_TRUE = @DOCBOOK_DOCS_ENABLED_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ -ENABLE_INOTIFY_FALSE = @ENABLE_INOTIFY_FALSE@ -ENABLE_INOTIFY_TRUE = @ENABLE_INOTIFY_TRUE@ -ENABLE_PAM_MODULE_FALSE = @ENABLE_PAM_MODULE_FALSE@ -ENABLE_PAM_MODULE_TRUE = @ENABLE_PAM_MODULE_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ @@ -162,8 +187,10 @@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ HAVE_PAM = @HAVE_PAM@ -HAVE_PAM_FALSE = @HAVE_PAM_FALSE@ -HAVE_PAM_TRUE = @HAVE_PAM_TRUE@ +HAVE_POLKIT = @HAVE_POLKIT@ +HISTORY_CFLAGS = @HISTORY_CFLAGS@ +HISTORY_LIBS = @HISTORY_LIBS@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -180,9 +207,8 @@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ @@ -198,10 +224,13 @@ PAM_MODULE_DIR = @PAM_MODULE_DIR@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POFILES = @POFILES@ +POLKIT_CFLAGS = @POLKIT_CFLAGS@ +POLKIT_LIBS = @POLKIT_LIBS@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ +RBAC_LIBS = @RBAC_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -212,13 +241,14 @@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ XGETTEXT = @XGETTEXT@ XMLTO = @XMLTO@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -230,6 +260,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -257,19 +288,25 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.7 NULL = -SUBDIRS = $(NULL) $(am__append_1) +SUBDIRS = $(NULL) $(am__append_1) $(am__append_2) $(am__append_3) DIST_SUBDIRS = \ linux \ + freebsd \ + solaris \ $(NULL) INCLUDES = \ -I. \ -I$(srcdir) \ -I$(top_srcdir)/src \ + -I$(top_srcdir)/libck-connector \ $(CONSOLE_KIT_CFLAGS) \ $(DISABLE_DEPRECATED_CFLAGS) \ -DPREFIX=\""$(prefix)"\" \ @@ -278,11 +315,22 @@ INCLUDES = \ -DLIBEXECDIR=\""$(libexecdir)"\" \ -DDATADIR=\""$(datadir)"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DLOCALSTATEDIR=\""$(localstatedir)"\" \ + $(HISTORY_CFLAGS) \ $(WARN_CFLAGS) \ $(DEBUG_CFLAGS) \ $(DBUS_CFLAGS) \ $(NULL) +ck_launch_session_SOURCES = \ + ck-launch-session.c \ + $(NULL) + +ck_launch_session_LDADD = \ + $(top_builddir)/libck-connector/libck-connector.la \ + $(CONSOLE_KIT_LIBS) \ + $(NULL) + ck_list_sessions_SOURCES = \ list-sessions.c \ $(NULL) @@ -291,6 +339,43 @@ ck_list_sessions_LDADD = \ $(CONSOLE_KIT_LIBS) \ $(NULL) +ck_history_SOURCES = \ + ck-history.c \ + $(NULL) + +ck_history_LDADD = \ + $(HISTORY_LIBS) \ + $(Z_LIBS) \ + $(top_builddir)/src/libck-event-log.la \ + $(NULL) + +ck_log_system_start_SOURCES = \ + ck-log-system-start.c \ + $(NULL) + +ck_log_system_start_LDADD = \ + $(HISTORY_LIBS) \ + $(top_builddir)/src/libck-event-log.la \ + $(NULL) + +ck_log_system_restart_SOURCES = \ + ck-log-system-restart.c \ + $(NULL) + +ck_log_system_restart_LDADD = \ + $(HISTORY_LIBS) \ + $(top_builddir)/src/libck-event-log.la \ + $(NULL) + +ck_log_system_stop_SOURCES = \ + ck-log-system-stop.c \ + $(NULL) + +ck_log_system_stop_LDADD = \ + $(HISTORY_LIBS) \ + $(top_builddir)/src/libck-event-log.la \ + $(NULL) + ck_collect_session_info_SOURCES = \ ck-collect-session-info.c \ $(NULL) @@ -360,7 +445,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -388,7 +473,7 @@ clean-binPROGRAMS: done install-libexecPROGRAMS: $(libexec_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(libexecdir)" || $(mkdir_p) "$(DESTDIR)$(libexecdir)" + test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)" @list='$(libexec_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -414,18 +499,61 @@ clean-libexecPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ + rm -f "$(DESTDIR)$(sbindir)/$$f"; \ + done + +clean-sbinPROGRAMS: + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done ck-collect-session-info$(EXEEXT): $(ck_collect_session_info_OBJECTS) $(ck_collect_session_info_DEPENDENCIES) @rm -f ck-collect-session-info$(EXEEXT) - $(LINK) $(ck_collect_session_info_LDFLAGS) $(ck_collect_session_info_OBJECTS) $(ck_collect_session_info_LDADD) $(LIBS) + $(LINK) $(ck_collect_session_info_OBJECTS) $(ck_collect_session_info_LDADD) $(LIBS) ck-get-x11-display-device$(EXEEXT): $(ck_get_x11_display_device_OBJECTS) $(ck_get_x11_display_device_DEPENDENCIES) @rm -f ck-get-x11-display-device$(EXEEXT) - $(LINK) $(ck_get_x11_display_device_LDFLAGS) $(ck_get_x11_display_device_OBJECTS) $(ck_get_x11_display_device_LDADD) $(LIBS) + $(LINK) $(ck_get_x11_display_device_OBJECTS) $(ck_get_x11_display_device_LDADD) $(LIBS) ck-get-x11-server-pid$(EXEEXT): $(ck_get_x11_server_pid_OBJECTS) $(ck_get_x11_server_pid_DEPENDENCIES) @rm -f ck-get-x11-server-pid$(EXEEXT) - $(LINK) $(ck_get_x11_server_pid_LDFLAGS) $(ck_get_x11_server_pid_OBJECTS) $(ck_get_x11_server_pid_LDADD) $(LIBS) + $(LINK) $(ck_get_x11_server_pid_OBJECTS) $(ck_get_x11_server_pid_LDADD) $(LIBS) +ck-history$(EXEEXT): $(ck_history_OBJECTS) $(ck_history_DEPENDENCIES) + @rm -f ck-history$(EXEEXT) + $(LINK) $(ck_history_OBJECTS) $(ck_history_LDADD) $(LIBS) +ck-launch-session$(EXEEXT): $(ck_launch_session_OBJECTS) $(ck_launch_session_DEPENDENCIES) + @rm -f ck-launch-session$(EXEEXT) + $(LINK) $(ck_launch_session_OBJECTS) $(ck_launch_session_LDADD) $(LIBS) ck-list-sessions$(EXEEXT): $(ck_list_sessions_OBJECTS) $(ck_list_sessions_DEPENDENCIES) @rm -f ck-list-sessions$(EXEEXT) - $(LINK) $(ck_list_sessions_LDFLAGS) $(ck_list_sessions_OBJECTS) $(ck_list_sessions_LDADD) $(LIBS) + $(LINK) $(ck_list_sessions_OBJECTS) $(ck_list_sessions_LDADD) $(LIBS) +ck-log-system-restart$(EXEEXT): $(ck_log_system_restart_OBJECTS) $(ck_log_system_restart_DEPENDENCIES) + @rm -f ck-log-system-restart$(EXEEXT) + $(LINK) $(ck_log_system_restart_OBJECTS) $(ck_log_system_restart_LDADD) $(LIBS) +ck-log-system-start$(EXEEXT): $(ck_log_system_start_OBJECTS) $(ck_log_system_start_DEPENDENCIES) + @rm -f ck-log-system-start$(EXEEXT) + $(LINK) $(ck_log_system_start_OBJECTS) $(ck_log_system_start_LDADD) $(LIBS) +ck-log-system-stop$(EXEEXT): $(ck_log_system_stop_OBJECTS) $(ck_log_system_stop_DEPENDENCIES) + @rm -f ck-log-system-stop$(EXEEXT) + $(LINK) $(ck_log_system_stop_OBJECTS) $(ck_log_system_stop_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -436,25 +564,30 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-collect-session-info.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-get-x11-display-device.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-get-x11-server-pid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-history.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-launch-session.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-log-system-restart.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-log-system-start.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-log-system-stop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list-sessions.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @@ -465,10 +598,6 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, @@ -500,8 +629,7 @@ $(RECURSIVE_TARGETS): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: +$(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ @@ -602,22 +730,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -631,7 +758,7 @@ distdir: $(DISTFILES) list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ @@ -639,6 +766,8 @@ distdir: $(DISTFILES) $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ @@ -648,8 +777,8 @@ check: check-recursive all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive @@ -679,13 +808,13 @@ maintainer-clean-generic: clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libexecPROGRAMS \ - clean-libtool mostlyclean-am + clean-libtool clean-sbinPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-recursive @@ -699,12 +828,21 @@ info-am: install-data-am: -install-exec-am: install-binPROGRAMS install-libexecPROGRAMS +install-dvi: install-dvi-recursive + +install-exec-am: install-binPROGRAMS install-libexecPROGRAMS \ + install-sbinPROGRAMS + +install-html: install-html-recursive install-info: install-info-recursive install-man: +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -725,27 +863,30 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ - uninstall-libexecPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-libexecPROGRAMS \ + uninstall-sbinPROGRAMS -uninstall-info: uninstall-info-recursive +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-binPROGRAMS clean-generic clean-libexecPROGRAMS \ - clean-libtool clean-recursive ctags ctags-recursive distclean \ +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-sbinPROGRAMS ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-libexecPROGRAMS \ - install-man install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-sbinPROGRAMS install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-info-am \ - uninstall-libexecPROGRAMS + uninstall-binPROGRAMS uninstall-libexecPROGRAMS \ + uninstall-sbinPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/tools/ck-collect-session-info.c b/tools/ck-collect-session-info.c index 45abb07..334c088 100644 --- a/tools/ck-collect-session-info.c +++ b/tools/ck-collect-session-info.c @@ -42,7 +42,6 @@ typedef struct { char *x11_display; gboolean x11_can_connect; char *remote_host_name; - char *session_type; gboolean is_local; gboolean is_local_is_set; } SessionInfo; @@ -54,7 +53,6 @@ session_info_free (SessionInfo *si) g_free (si->x11_display_device); g_free (si->x11_display); g_free (si->remote_host_name); - g_free (si->session_type); g_free (si); } @@ -300,7 +298,6 @@ fill_session_info (SessionInfo *si) } si->display_device = ck_process_stat_get_tty (stat); - si->session_type = ck_process_stat_get_cmd (stat); ck_process_stat_free (stat); fill_x11_info (si); @@ -328,9 +325,6 @@ print_session_info (SessionInfo *si) if (si->display_device != NULL) { printf ("display-device = %s\n", si->display_device); } - if (si->session_type != NULL) { - printf ("session-type = %s\n", si->session_type); - } if (si->remote_host_name != NULL) { printf ("remote-host-name = %s\n", si->remote_host_name); } diff --git a/tools/ck-history.c b/tools/ck-history.c new file mode 100644 index 0000000..716c3ef --- /dev/null +++ b/tools/ck-history.c @@ -0,0 +1,866 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +#include "config.h" + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <sys/types.h> +#include <pwd.h> +#include <string.h> +#include <errno.h> + +#include <locale.h> +#include <zlib.h> + +#include <glib.h> +#include <glib/gi18n.h> +#include <glib/gstdio.h> + +#include "ck-log-event.h" + +typedef enum { + REPORT_TYPE_SUMMARY = 0, + REPORT_TYPE_LAST, + REPORT_TYPE_LAST_COMPAT, + REPORT_TYPE_FREQUENT, + REPORT_TYPE_LOG, +} ReportType; + +/* same record types as sysvinit last */ +typedef enum { + RECORD_STATUS_CRASH = 1, /* No logout record, system boot in between */ + RECORD_STATUS_DOWN, /* System brought down in decent way */ + RECORD_STATUS_NORMAL, /* Normal */ + RECORD_STATUS_NOW, /* Still logged in */ + RECORD_STATUS_REBOOT, /* Reboot record. */ + RECORD_STATUS_PHANTOM, /* No logout record but session is stale. */ + RECORD_STATUS_TIMECHANGE, /* NEW_TIME or OLD_TIME */ +} RecordStatus; + +#define DEFAULT_LOG_FILENAME LOCALSTATEDIR "/log/ConsoleKit/history" +#define MAX_LINE_LEN 2048 + +static GList *all_events = NULL; + +static gboolean +process_event_line (const char *line) +{ + GString *str; + CkLogEvent *event; + + str = g_string_new (line); + event = ck_log_event_new_from_string (str); + g_string_free (str, TRUE); + + if (event != NULL) { + all_events = g_list_prepend (all_events, event); + } + + return TRUE; +} + +static gboolean +process_log_gzstream (gzFile *fstream) +{ + char line[MAX_LINE_LEN]; + + while (gzgets (fstream, line, sizeof (line)) != Z_NULL) { + if (strlen (line) == sizeof (line) - 1) { + g_warning ("Log line truncated"); + } + + process_event_line (line); + } + + return TRUE; +} + +static gboolean +process_log_stream (FILE *fstream) +{ + char line[MAX_LINE_LEN]; + + while (fgets (line, sizeof (line), fstream) != NULL) { + if (strlen (line) == sizeof (line) - 1) { + g_warning ("Log line truncated"); + } + + process_event_line (line); + } + + return TRUE; +} + +static gboolean +process_log_file (const char *filename) +{ + gboolean ret; + + if (g_str_has_suffix (filename, ".gz")) { + gzFile *f; + f = gzopen (filename, "r"); + if (f == NULL) { + int errnum; + const char *errmsg; + errmsg = gzerror (f, &errnum); + if (errnum == Z_ERRNO) { + errmsg = g_strerror (errno); + } + g_warning ("Error opening %s (%s)\n", + filename, + errmsg); + return FALSE; + } + ret = process_log_gzstream (f); + gzclose (f); + } else { + FILE *f; + + f = g_fopen (filename, "r"); + if (f == NULL) { + g_warning ("Error opening %s (%s)\n", + filename, + g_strerror (errno)); + return FALSE; + } + ret = process_log_stream (f); + fclose (f); + } + + return ret; +} + +static GList * +get_log_file_list (void) +{ + int num; + GList *files; + + /* always try the primary file */ + files = NULL; + files = g_list_prepend (files, g_strdup (DEFAULT_LOG_FILENAME)); + num = 1; + while (1) { + char *filename; + filename = g_strdup_printf ("%s.%d", DEFAULT_LOG_FILENAME, num); + if (g_access (filename, R_OK) != 0) { + char *filename_gz; + + /* check for .gz */ + filename_gz = g_strdup_printf ("%s.gz", filename); + g_free (filename); + + if (g_access (filename_gz, R_OK) != 0) { + g_free (filename_gz); + break; + } + filename = filename_gz; + } + num++; + files = g_list_prepend (files, filename); + }; + + return files; +} + +static gboolean +process_logs (void) +{ + gboolean ret; + GList *files; + GList *l; + + ret = FALSE; + + files = get_log_file_list (); + + for (l = files; l != NULL; l = l->next) { + gboolean res; + char *filename; + + filename = l->data; + + res = process_log_file (filename); + if (! res) { + goto out; + } + } + + ret = TRUE; + + out: + g_list_foreach (files, (GFunc)g_free, NULL); + g_list_free (files); + + return ret; +} + +static void +generate_report_summary (int uid, + const char *seat, + const char *session_type) +{ +} + +static CkLogEvent * +find_first_matching_remove_event (GList *events, + CkLogSeatSessionAddedEvent *event) +{ + CkLogEvent *revent; + GList *l; + + revent = NULL; + + for (l = events; l != NULL; l = l->next) { + CkLogEventType etype; + + etype = ((CkLogEvent *)l->data)->type; + /* skip all non removal events */ + if (etype != CK_LOG_EVENT_SEAT_SESSION_REMOVED + || etype == CK_LOG_EVENT_SYSTEM_START + || etype == CK_LOG_EVENT_SYSTEM_STOP + || etype == CK_LOG_EVENT_SYSTEM_RESTART) { + continue; + } + + if (etype == CK_LOG_EVENT_SEAT_SESSION_REMOVED) { + CkLogSeatSessionRemovedEvent *e; + e = l->data; + + if (e->session_id != NULL + && event->session_id != NULL + && strcmp (e->session_id, event->session_id) == 0) { + revent = (CkLogEvent *)l->data; + break; + } + } else { + revent = (CkLogEvent *)l->data; + break; + } + } + + return revent; +} + +static char * +get_user_name_for_uid (int uid) +{ + struct passwd *pwent; + char *name; + + name = NULL; + + pwent = getpwuid (uid); + + if (pwent != NULL) { + name = g_strdup (pwent->pw_name); + } + + return name; +} + +static int +get_uid_for_username (const char *username) +{ + struct passwd *pwent; + int uid; + + g_assert (username != NULL); + + uid = -1; + + pwent = getpwnam (username); + if (pwent != NULL) { + uid = pwent->pw_uid; + } + + return uid; +} + +static char * +get_utline_for_event (CkLogEvent *event) +{ + char *utline; + + utline = NULL; + + switch (event->type) { + case CK_LOG_EVENT_SEAT_SESSION_ADDED: + { + CkLogSeatSessionAddedEvent *e; + e = (CkLogSeatSessionAddedEvent *)event; + if (e->session_x11_display != NULL && e->session_x11_display[0] != '\0') { + utline = g_strdup (e->session_x11_display); + } else { + if (g_str_has_prefix (e->session_display_device, "/dev/")) { + utline = g_strdup (e->session_display_device + 5); + } else { + utline = g_strdup (e->session_display_device); + } + } + } + break; + case CK_LOG_EVENT_SYSTEM_START: + utline = g_strdup ("system boot"); + break; + default: + g_assert_not_reached (); + } + + return utline; +} + +static char * +get_user_name_for_event (CkLogEvent *event) +{ + char *username; + + username = NULL; + + switch (event->type) { + case CK_LOG_EVENT_SEAT_SESSION_ADDED: + username = get_user_name_for_uid (((CkLogSeatSessionAddedEvent *)event)->session_unix_user); + break; + case CK_LOG_EVENT_SYSTEM_START: + username = g_strdup ("reboot"); + break; + default: + g_assert_not_reached (); + } + + return username; +} + +static char * +get_host_for_event (CkLogEvent *event) +{ + char *username; + + username = NULL; + + switch (event->type) { + case CK_LOG_EVENT_SEAT_SESSION_ADDED: + username = g_strdup (((CkLogSeatSessionAddedEvent *)event)->session_remote_host_name); + break; + case CK_LOG_EVENT_SYSTEM_START: + /* FIXME: get kernel version */ + username = g_strdup (""); + break; + default: + g_assert_not_reached (); + } + + return username; +} + +static RecordStatus +get_event_record_status (CkLogEvent *remove_event) +{ + RecordStatus status; + + status = RECORD_STATUS_NOW; + + if (remove_event == NULL) { + goto out; + } + + if (remove_event->type == CK_LOG_EVENT_SEAT_SESSION_REMOVED) { + status = RECORD_STATUS_NORMAL; + } else if (remove_event->type == CK_LOG_EVENT_SYSTEM_START) { + status = RECORD_STATUS_CRASH; + } else if (remove_event->type == CK_LOG_EVENT_SYSTEM_STOP) { + status = RECORD_STATUS_DOWN; + } else if (remove_event->type == CK_LOG_EVENT_SYSTEM_RESTART) { + status = RECORD_STATUS_DOWN; + } + + out: + return status; +} + +static char * +get_duration (CkLogEvent *event, + CkLogEvent *remove_event) +{ + time_t secs; + int mins; + int hours; + int days; + char *duration; + + secs = remove_event->timestamp.tv_sec - event->timestamp.tv_sec; + mins = (secs / 60) % 60; + hours = (secs / 3600) % 24; + days = secs / 86400; + if (days > 0) { + duration = g_strdup_printf ("(%d+%02d:%02d)", days, hours, mins); + } else { + duration = g_strdup_printf (" (%02d:%02d)", hours, mins); + } + return duration; +} + +static void +print_last_report_record (GList *list, + CkLogEvent *event, + gboolean legacy_compat) +{ + GString *str; + char *username; + char *utline; + char *host; + char *addedtime; + char *removedtime; + char *duration; + char *session_type; + char *session_id; + char *seat_id; + CkLogSeatSessionAddedEvent *e; + CkLogEvent *remove_event; + RecordStatus status; + + if (event->type != CK_LOG_EVENT_SEAT_SESSION_ADDED + && event->type != CK_LOG_EVENT_SYSTEM_START) { + return; + } + + remove_event = NULL; + + if (event->type == CK_LOG_EVENT_SEAT_SESSION_ADDED) { + e = (CkLogSeatSessionAddedEvent *)event; + + remove_event = find_first_matching_remove_event (list, e); + status = get_event_record_status (remove_event); + + session_type = e->session_type; + session_id = e->session_id; + seat_id = e->seat_id; + } else { + status = RECORD_STATUS_REBOOT; + + session_type = ""; + session_id = ""; + seat_id = ""; + } + + str = g_string_new (NULL); + + username = get_user_name_for_event (event); + utline = get_utline_for_event (event); + host = get_host_for_event (event); + + addedtime = g_strndup (ctime (&event->timestamp.tv_sec), 16); + + if (legacy_compat) { + g_string_printf (str, + "%-8.8s %-12.12s %-16.16s %-16.16s", + username, + utline != NULL ? utline : "", + host != NULL ? host : "", + addedtime); + } else { + g_string_printf (str, + "%-8.8s %12s %-10.10s %-7.7s %-12.12s %-16.16s %-16.16s", + username, + session_type, + session_id, + seat_id, + utline, + host != NULL ? host : "", + addedtime); + } + + g_free (username); + g_free (addedtime); + g_free (utline); + g_free (host); + + removedtime = NULL; + duration = NULL; + + switch (status) { + case RECORD_STATUS_CRASH: + duration = get_duration (event, remove_event); + removedtime = g_strdup ("- crash"); + break; + case RECORD_STATUS_DOWN: + duration = get_duration (event, remove_event); + removedtime = g_strdup ("- down "); + break; + case RECORD_STATUS_NOW: + duration = g_strdup ("logged in"); + removedtime = g_strdup (" still"); + break; + case RECORD_STATUS_PHANTOM: + duration = g_strdup ("- no logout"); + removedtime = g_strdup (" gone"); + break; + case RECORD_STATUS_REBOOT: + removedtime = g_strdup (""); + break; + case RECORD_STATUS_TIMECHANGE: + removedtime = g_strdup (""); + break; + case RECORD_STATUS_NORMAL: + duration = get_duration (event, remove_event); + removedtime = g_strdup_printf ("- %s", ctime (&remove_event->timestamp.tv_sec) + 11); + removedtime[7] = 0; + break; + default: + g_assert_not_reached (); + break; + } + + g_string_append_printf (str, + " %-7.7s %-12.12s", + removedtime, + duration); + + g_print ("%s\n", str->str); + g_string_free (str, TRUE); + g_free (removedtime); + g_free (duration); +} + +static void +generate_report_last (int uid, + const char *seat, + const char *session_type) +{ + GList *oldest; + CkLogEvent *oldest_event; + GList *l; + + /* print events in reverse time order */ + + for (l = g_list_last (all_events); l != NULL; l = l->prev) { + CkLogEvent *event; + + event = l->data; + + if (event->type == CK_LOG_EVENT_SEAT_SESSION_ADDED) { + CkLogSeatSessionAddedEvent *e; + e = (CkLogSeatSessionAddedEvent *)event; + + if (uid >= 0 && e->session_unix_user != uid) { + continue; + } + + if (seat != NULL && e->seat_id != NULL && strcmp (e->seat_id, seat) != 0) { + continue; + } + + if (session_type != NULL && e->session_type != NULL && strcmp (e->session_type, session_type) != 0) { + continue; + } + } + + print_last_report_record (l, event, FALSE); + } + + oldest = g_list_first (all_events); + if (oldest != NULL) { + oldest_event = oldest->data; + g_print ("\nLog begins %s", ctime (&oldest_event->timestamp.tv_sec)); + } +} + +static void +generate_report_last_compat (int uid, + const char *seat, + const char *session_type) +{ + GList *oldest; + CkLogEvent *oldest_event; + GList *l; + + /* print events in reverse time order */ + + for (l = g_list_last (all_events); l != NULL; l = l->prev) { + CkLogEvent *event; + + event = l->data; + + if (event->type == CK_LOG_EVENT_SEAT_SESSION_ADDED) { + CkLogSeatSessionAddedEvent *e; + e = (CkLogSeatSessionAddedEvent *)event; + + if (uid >= 0 && e->session_unix_user != uid) { + continue; + } + + if (seat != NULL && e->seat_id != NULL && strcmp (e->seat_id, seat) != 0) { + continue; + } + + if (session_type != NULL && e->session_type != NULL && strcmp (e->session_type, session_type) != 0) { + continue; + } + } + + print_last_report_record (l, event, TRUE); + } + + oldest = g_list_first (all_events); + if (oldest != NULL) { + oldest_event = oldest->data; + g_print ("\nLog begins %s", ctime (&oldest_event->timestamp.tv_sec)); + } +} + +typedef struct { + int uid; + guint count; +} CountData; + +static void +listify_counts (gpointer key, + gpointer val, + GList **list) +{ + CountData *count_data; + count_data = g_new0 (CountData, 1); + count_data->uid = GPOINTER_TO_INT (key); + count_data->count = GPOINTER_TO_UINT (val); + *list = g_list_prepend (*list, count_data); +} + +static int +counts_compare (CountData *a, + CountData *b) +{ + if (a->count < b->count) { + return 1; + } else if (a->count > b->count) { + return -1; + } else { + return 0; + } +} + +static void +generate_report_frequent (int uid, + const char *seat, + const char *session_type) +{ + GHashTable *counts; + GList *l; + GList *user_counts; + + /* FIXME: we can probably do this more efficiently */ + + counts = g_hash_table_new (NULL, NULL); + + for (l = g_list_first (all_events); l != NULL; l = l->next) { + CkLogEvent *event; + CkLogSeatSessionAddedEvent *e; + guint count; + gpointer val; + + event = l->data; + + if (event->type != CK_LOG_EVENT_SEAT_SESSION_ADDED) { + continue; + } + + e = (CkLogSeatSessionAddedEvent *)event; + + if (uid >= 0 && e->session_unix_user != uid) { + continue; + } + + if (seat != NULL && e->seat_id != NULL && strcmp (e->seat_id, seat) != 0) { + continue; + } + + if (session_type != NULL && e->session_type != NULL && strcmp (e->session_type, session_type) != 0) { + continue; + } + + val = g_hash_table_lookup (counts, GINT_TO_POINTER (e->session_unix_user)); + if (val != NULL) { + count = GPOINTER_TO_INT (val); + } else { + count = 0; + } + + g_hash_table_insert (counts, + GINT_TO_POINTER (e->session_unix_user), + GUINT_TO_POINTER (count + 1)); + } + + user_counts = NULL; + g_hash_table_foreach (counts, (GHFunc)listify_counts, &user_counts); + g_hash_table_destroy (counts); + + if (user_counts == NULL) { + return; + } + + user_counts = g_list_sort (user_counts, (GCompareFunc)counts_compare); + while (user_counts != NULL) { + CountData *data; + char *username; + + data = user_counts->data; + + username = get_user_name_for_uid (data->uid); + g_print ("%-8.8s %u\n", username, data->count); + g_free (data); + user_counts = g_list_delete_link (user_counts, user_counts); + g_free (username); + } + + g_list_free (user_counts); +} + +static void +generate_report_log (int uid, + const char *seat, + const char *session_type) +{ + GList *l; + + for (l = all_events; l != NULL; l = l->next) { + CkLogEvent *event; + GString *str; + + event = l->data; + str = g_string_new (NULL); + ck_log_event_to_string (event, str); + g_print ("%s\n", str->str); + g_string_free (str, TRUE); + } +} + +static void +generate_report (int report_type, + int uid, + const char *seat, + const char *session_type) +{ + + all_events = g_list_reverse (all_events); + + switch (report_type) { + case REPORT_TYPE_SUMMARY: + generate_report_summary (uid, seat, session_type); + break; + case REPORT_TYPE_LAST: + generate_report_last (uid, seat, session_type); + break; + case REPORT_TYPE_LAST_COMPAT: + generate_report_last_compat (uid, seat, session_type); + break; + case REPORT_TYPE_FREQUENT: + generate_report_frequent (uid, seat, session_type); + break; + case REPORT_TYPE_LOG: + generate_report_log (uid, seat, session_type); + break; + default: + g_assert_not_reached (); + break; + } +} + +static void +free_events (void) +{ + /* FIXME: */ +} + +int +main (int argc, + char **argv) +{ + GOptionContext *context; + gboolean retval; + GError *error = NULL; + int report_type; + int uid; + static gboolean do_version = FALSE; + static gboolean report_last_compat = FALSE; + static gboolean report_last = FALSE; + static gboolean report_frequent = FALSE; + static gboolean report_log = FALSE; + static char *username = NULL; + static char *seat = NULL; + static char *session_type = NULL; + static GOptionEntry entries [] = { + { "version", 'V', 0, G_OPTION_ARG_NONE, &do_version, N_("Version of this application"), NULL }, + { "frequent", 0, 0, G_OPTION_ARG_NONE, &report_frequent, N_("Show listing of frequent users"), NULL }, + { "last", 0, 0, G_OPTION_ARG_NONE, &report_last, N_("Show listing of last logged in users"), NULL }, + { "last-compat", 0, 0, G_OPTION_ARG_NONE, &report_last_compat, N_("Show 'last' compatible listing of last logged in users"), NULL }, + { "log", 0, 0, G_OPTION_ARG_NONE, &report_log, N_("Show full event log"), NULL }, + { "seat", 's', 0, G_OPTION_ARG_STRING, &seat, N_("Show entries for the specified seat"), N_("SEAT") }, + { "session-type", 't', 0, G_OPTION_ARG_STRING, &session_type, N_("Show entries for the specified session type"), N_("TYPE") }, + { "user", 'u', 0, G_OPTION_ARG_STRING, &username, N_("Show entries for the specified user"), N_("NAME") }, + { NULL } + }; + + context = g_option_context_new (NULL); + g_option_context_add_main_entries (context, entries, NULL); + retval = g_option_context_parse (context, &argc, &argv, &error); + + g_option_context_free (context); + + if (! retval) { + g_warning ("%s", error->message); + g_error_free (error); + exit (1); + } + + if (do_version) { + g_print ("%s %s\n", argv [0], VERSION); + exit (1); + } + + if (report_last_compat) { + report_type = REPORT_TYPE_LAST_COMPAT; + } else if (report_last) { + report_type = REPORT_TYPE_LAST; + } else if (report_frequent) { + report_type = REPORT_TYPE_FREQUENT; + } else if (report_log) { + report_type = REPORT_TYPE_LOG; + } else { + report_type = REPORT_TYPE_SUMMARY; + } + + if (username != NULL) { + uid = get_uid_for_username (username); + if (uid == -1) { + g_warning ("Unknown username: %s", username); + exit (1); + } + } else { + uid = -1; + } + + process_logs (); + generate_report (report_type, uid, seat, session_type); + free_events (); + + return 0; +} diff --git a/tools/ck-launch-session.c b/tools/ck-launch-session.c new file mode 100644 index 0000000..7311181 --- /dev/null +++ b/tools/ck-launch-session.c @@ -0,0 +1,92 @@ +/* + * Copyright Red Hat, Inc. 2007-2008. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Red Hat, Inc., nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Gate a process inside of a ConsoleKit session. + * + */ + +#include <sys/types.h> +#include <sys/wait.h> +#ifdef HAVE_PATHS_H +#include <paths.h> +#else +#define _PATH_BSHELL "/bin/sh" +#endif + +#include <stdlib.h> +#include <syslog.h> +#include <unistd.h> + +#include "ck-connector.h" + +int +main (int argc, char **argv) +{ + CkConnector *ckc = NULL; + DBusError error; + const char *shell; + pid_t pid; + int status; + + ckc = ck_connector_new (); + if (ckc != NULL) { + dbus_error_init (&error); + if (ck_connector_open_session (ckc, &error)) { + pid = fork (); + switch (pid) { + case -1: + syslog (LOG_ERR, "error forking child"); + break; + case 0: + setenv ("XDG_SESSION_COOKIE", + ck_connector_get_cookie (ckc), 1); + break; + default: + waitpid (pid, &status, 0); + exit (status); + break; + } + } else { + syslog (LOG_ERR, "error connecting to ConsoleKit"); + } + } else { + syslog (LOG_ERR, "error setting up to connection to ConsoleKit"); + } + + if (argc > 1) { + execvp (argv[1], argv + 1); + } else { + shell = getenv ("SHELL"); + if (shell == NULL) { + shell = _PATH_BSHELL; + } + execlp (shell, shell, NULL); + } + _exit (1); +} diff --git a/tools/ck-log-system-restart.c b/tools/ck-log-system-restart.c new file mode 100644 index 0000000..e53670f --- /dev/null +++ b/tools/ck-log-system-restart.c @@ -0,0 +1,174 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +#include "config.h" + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <string.h> + +#include <locale.h> + +#include <glib.h> +#include <glib/gi18n.h> +#include <glib/gstdio.h> + +#include "ck-log-event.h" + +#define DEFAULT_LOG_FILENAME LOCALSTATEDIR "/log/ConsoleKit/history" + + +/* Adapted from auditd auditd-event.c */ +static gboolean +open_log_file (const char *filename, + int *fdp, + FILE **filep) +{ + int flags; + int fd; + FILE *file; + gboolean ret; + + ret = FALSE; + + /* + * Likely errors on rotate: ENFILE, ENOMEM, ENOSPC + */ + flags = O_WRONLY | O_APPEND; +#ifdef O_NOFOLLOW + flags |= O_NOFOLLOW; +#endif + +retry: + fd = g_open (filename, flags, 0600); + if (fd < 0) { + if (errno == ENOENT) { + /* FIXME: should we just skip if file doesn't exist? */ + fd = g_open (filename, + O_CREAT | O_EXCL | O_APPEND, + S_IRUSR | S_IWUSR | S_IRGRP); + if (fd < 0) { + g_warning ("Couldn't create log file %s (%s)", + filename, + g_strerror (errno)); + goto out; + } + + close (fd); + fd = g_open (filename, flags, 0600); + } else if (errno == ENFILE) { + /* All system descriptors used, try again... */ + goto retry; + } + if (fd < 0) { + g_warning ("Couldn't open log file %s (%s)", + filename, + g_strerror (errno)); + goto out; + } + } + + if (fcntl (fd, F_SETFD, FD_CLOEXEC) == -1) { + close (fd); + g_warning ("Error setting log file CLOEXEC flag (%s)", + g_strerror (errno)); + goto out; + } + + fchown (fd, 0, 0); + + file = fdopen (fd, "a"); + if (file == NULL) { + g_warning ("Error setting up log descriptor (%s)", + g_strerror (errno)); + close (fd); + goto out; + } + + /* Set it to line buffering */ + setlinebuf (file); + + ret = TRUE; + + if (fdp != NULL) { + *fdp = fd; + } + if (filep != NULL) { + *filep = file; + } + + out: + + return ret; +} + +static gboolean +write_log_for_event (CkLogEvent *event) +{ + GString *str; + FILE *file; + int fd; + + str = g_string_new (NULL); + + ck_log_event_to_string (event, str); + + if (! open_log_file (DEFAULT_LOG_FILENAME, &fd, &file)) { + exit (1); + } + + if (file != NULL) { + int rc; + + rc = fprintf (file, "%s\n", str->str); + if (rc <= 0) { + g_warning ("Record was not written to disk (%s)", + g_strerror (errno)); + } + } else { + g_warning ("Log file not open for writing"); + } + + g_string_free (str, TRUE); + + return TRUE; +} + +int +main (int argc, + char **argv) +{ + CkLogEvent event; + + memset (&event, 0, sizeof (CkLogEvent)); + + event.type = CK_LOG_EVENT_SYSTEM_RESTART; + g_get_current_time (&event.timestamp); + + write_log_for_event (&event); + + return 0; +} diff --git a/tools/ck-log-system-start.c b/tools/ck-log-system-start.c new file mode 100644 index 0000000..4afdfa0 --- /dev/null +++ b/tools/ck-log-system-start.c @@ -0,0 +1,174 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +#include "config.h" + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <string.h> + +#include <locale.h> + +#include <glib.h> +#include <glib/gi18n.h> +#include <glib/gstdio.h> + +#include "ck-log-event.h" + +#define DEFAULT_LOG_FILENAME LOCALSTATEDIR "/log/ConsoleKit/history" + + +/* Adapted from auditd auditd-event.c */ +static gboolean +open_log_file (const char *filename, + int *fdp, + FILE **filep) +{ + int flags; + int fd; + FILE *file; + gboolean ret; + + ret = FALSE; + + /* + * Likely errors on rotate: ENFILE, ENOMEM, ENOSPC + */ + flags = O_WRONLY | O_APPEND; +#ifdef O_NOFOLLOW + flags |= O_NOFOLLOW; +#endif + +retry: + fd = g_open (filename, flags, 0600); + if (fd < 0) { + if (errno == ENOENT) { + /* FIXME: should we just skip if file doesn't exist? */ + fd = g_open (filename, + O_CREAT | O_EXCL | O_APPEND, + S_IRUSR | S_IWUSR | S_IRGRP); + if (fd < 0) { + g_warning ("Couldn't create log file %s (%s)", + filename, + g_strerror (errno)); + goto out; + } + + close (fd); + fd = g_open (filename, flags, 0600); + } else if (errno == ENFILE) { + /* All system descriptors used, try again... */ + goto retry; + } + if (fd < 0) { + g_warning ("Couldn't open log file %s (%s)", + filename, + g_strerror (errno)); + goto out; + } + } + + if (fcntl (fd, F_SETFD, FD_CLOEXEC) == -1) { + close (fd); + g_warning ("Error setting log file CLOEXEC flag (%s)", + g_strerror (errno)); + goto out; + } + + fchown (fd, 0, 0); + + file = fdopen (fd, "a"); + if (file == NULL) { + g_warning ("Error setting up log descriptor (%s)", + g_strerror (errno)); + close (fd); + goto out; + } + + /* Set it to line buffering */ + setlinebuf (file); + + ret = TRUE; + + if (fdp != NULL) { + *fdp = fd; + } + if (filep != NULL) { + *filep = file; + } + + out: + + return ret; +} + +static gboolean +write_log_for_event (CkLogEvent *event) +{ + GString *str; + FILE *file; + int fd; + + str = g_string_new (NULL); + + ck_log_event_to_string (event, str); + + if (! open_log_file (DEFAULT_LOG_FILENAME, &fd, &file)) { + exit (1); + } + + if (file != NULL) { + int rc; + + rc = fprintf (file, "%s\n", str->str); + if (rc <= 0) { + g_warning ("Record was not written to disk (%s)", + g_strerror (errno)); + } + } else { + g_warning ("Log file not open for writing"); + } + + g_string_free (str, TRUE); + + return TRUE; +} + +int +main (int argc, + char **argv) +{ + CkLogEvent event; + + memset (&event, 0, sizeof (CkLogEvent)); + + event.type = CK_LOG_EVENT_SYSTEM_START; + g_get_current_time (&event.timestamp); + + write_log_for_event (&event); + + return 0; +} diff --git a/tools/ck-log-system-stop.c b/tools/ck-log-system-stop.c new file mode 100644 index 0000000..a59a1e9 --- /dev/null +++ b/tools/ck-log-system-stop.c @@ -0,0 +1,174 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +#include "config.h" + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <string.h> + +#include <locale.h> + +#include <glib.h> +#include <glib/gi18n.h> +#include <glib/gstdio.h> + +#include "ck-log-event.h" + +#define DEFAULT_LOG_FILENAME LOCALSTATEDIR "/log/ConsoleKit/history" + + +/* Adapted from auditd auditd-event.c */ +static gboolean +open_log_file (const char *filename, + int *fdp, + FILE **filep) +{ + int flags; + int fd; + FILE *file; + gboolean ret; + + ret = FALSE; + + /* + * Likely errors on rotate: ENFILE, ENOMEM, ENOSPC + */ + flags = O_WRONLY | O_APPEND; +#ifdef O_NOFOLLOW + flags |= O_NOFOLLOW; +#endif + +retry: + fd = g_open (filename, flags, 0600); + if (fd < 0) { + if (errno == ENOENT) { + /* FIXME: should we just skip if file doesn't exist? */ + fd = g_open (filename, + O_CREAT | O_EXCL | O_APPEND, + S_IRUSR | S_IWUSR | S_IRGRP); + if (fd < 0) { + g_warning ("Couldn't create log file %s (%s)", + filename, + g_strerror (errno)); + goto out; + } + + close (fd); + fd = g_open (filename, flags, 0600); + } else if (errno == ENFILE) { + /* All system descriptors used, try again... */ + goto retry; + } + if (fd < 0) { + g_warning ("Couldn't open log file %s (%s)", + filename, + g_strerror (errno)); + goto out; + } + } + + if (fcntl (fd, F_SETFD, FD_CLOEXEC) == -1) { + close (fd); + g_warning ("Error setting log file CLOEXEC flag (%s)", + g_strerror (errno)); + goto out; + } + + fchown (fd, 0, 0); + + file = fdopen (fd, "a"); + if (file == NULL) { + g_warning ("Error setting up log descriptor (%s)", + g_strerror (errno)); + close (fd); + goto out; + } + + /* Set it to line buffering */ + setlinebuf (file); + + ret = TRUE; + + if (fdp != NULL) { + *fdp = fd; + } + if (filep != NULL) { + *filep = file; + } + + out: + + return ret; +} + +static gboolean +write_log_for_event (CkLogEvent *event) +{ + GString *str; + FILE *file; + int fd; + + str = g_string_new (NULL); + + ck_log_event_to_string (event, str); + + if (! open_log_file (DEFAULT_LOG_FILENAME, &fd, &file)) { + exit (1); + } + + if (file != NULL) { + int rc; + + rc = fprintf (file, "%s\n", str->str); + if (rc <= 0) { + g_warning ("Record was not written to disk (%s)", + g_strerror (errno)); + } + } else { + g_warning ("Log file not open for writing"); + } + + g_string_free (str, TRUE); + + return TRUE; +} + +int +main (int argc, + char **argv) +{ + CkLogEvent event; + + memset (&event, 0, sizeof (CkLogEvent)); + + event.type = CK_LOG_EVENT_SYSTEM_STOP; + g_get_current_time (&event.timestamp); + + write_log_for_event (&event); + + return 0; +} diff --git a/tools/freebsd/Makefile.am b/tools/freebsd/Makefile.am new file mode 100644 index 0000000..d25930e --- /dev/null +++ b/tools/freebsd/Makefile.am @@ -0,0 +1,38 @@ +## We require new-style dependency handling. +AUTOMAKE_OPTIONS = 1.7 + +NULL = + +SUBDIRS = \ + $(NULL) + +scriptdir = $(libdir)/ConsoleKit/scripts +script_SCRIPTS = \ + ck-system-stop \ + ck-system-restart \ + $(NULL) + +EXTRA_DIST = \ + $(script_SCRIPTS) \ + $(NULL) + +MAINTAINERCLEANFILES = \ + *~ \ + Makefile.in + + +check: + for f in $(script_SCRIPTS); do \ + echo -n "Validate bash syntax in $$f : "; \ + bash -n $(srcdir)/$$f 2> bash.error;\ + if test -s bash.error; then \ + echo failed; \ + cat bash.error; \ + rm -f bash.error; \ + exit 1; \ + else \ + echo ok; \ + rm -f bash.error; \ + fi; \ + done; + diff --git a/tools/freebsd/Makefile.in b/tools/freebsd/Makefile.in new file mode 100644 index 0000000..34cb61f --- /dev/null +++ b/tools/freebsd/Makefile.in @@ -0,0 +1,585 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = tools/freebsd +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(scriptdir)" +scriptSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(script_SCRIPTS) +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CK_BACKEND = @CK_BACKEND@ +CONSOLE_KIT_CFLAGS = @CONSOLE_KIT_CFLAGS@ +CONSOLE_KIT_LIBS = @CONSOLE_KIT_LIBS@ +CONSOLE_KIT_PID_FILE = @CONSOLE_KIT_PID_FILE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_SYS_DIR = @DBUS_SYS_DIR@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +HAVE_PAM = @HAVE_PAM@ +HAVE_POLKIT = @HAVE_POLKIT@ +HISTORY_CFLAGS = @HISTORY_CFLAGS@ +HISTORY_LIBS = @HISTORY_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +KVM_LIBS = @KVM_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBDBUS_CFLAGS = @LIBDBUS_CFLAGS@ +LIBDBUS_LIBS = @LIBDBUS_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PAM_LIBS = @PAM_LIBS@ +PAM_MODULE_DIR = @PAM_MODULE_DIR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POLKIT_CFLAGS = @POLKIT_CFLAGS@ +POLKIT_LIBS = @POLKIT_LIBS@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +RBAC_LIBS = @RBAC_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOOLS_CFLAGS = @TOOLS_CFLAGS@ +TOOLS_LIBS = @TOOLS_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XMLTO = @XMLTO@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = 1.7 +NULL = +SUBDIRS = \ + $(NULL) + +scriptdir = $(libdir)/ConsoleKit/scripts +script_SCRIPTS = \ + ck-system-stop \ + ck-system-restart \ + $(NULL) + +EXTRA_DIST = \ + $(script_SCRIPTS) \ + $(NULL) + +MAINTAINERCLEANFILES = \ + *~ \ + Makefile.in + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/freebsd/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu tools/freebsd/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-scriptSCRIPTS: $(script_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(scriptdir)" || $(MKDIR_P) "$(DESTDIR)$(scriptdir)" + @list='$(script_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(scriptSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(scriptdir)/$$f'"; \ + $(scriptSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(scriptdir)/$$f"; \ + else :; fi; \ + done + +uninstall-scriptSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(script_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(scriptdir)/$$f'"; \ + rm -f "$(DESTDIR)$(scriptdir)/$$f"; \ + done + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(SCRIPTS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(scriptdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-scriptSCRIPTS + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-scriptSCRIPTS + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-scriptSCRIPTS install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am \ + uninstall-scriptSCRIPTS + + +check: + for f in $(script_SCRIPTS); do \ + echo -n "Validate bash syntax in $$f : "; \ + bash -n $(srcdir)/$$f 2> bash.error;\ + if test -s bash.error; then \ + echo failed; \ + cat bash.error; \ + rm -f bash.error; \ + exit 1; \ + else \ + echo ok; \ + rm -f bash.error; \ + fi; \ + done; +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tools/freebsd/ck-system-restart b/tools/freebsd/ck-system-restart new file mode 100755 index 0000000..8e0664e --- /dev/null +++ b/tools/freebsd/ck-system-restart @@ -0,0 +1,12 @@ +#!/bin/sh + +#Try for common tools +if [ -x "/sbin/shutdown" ] ; then + /sbin/shutdown -r now + exit $? +elif [ -x "/usr/sbin/shutdown" ] ; then + /usr/sbin/shutdown -r now + exit $? +else + exit 1 +fi diff --git a/tools/freebsd/ck-system-stop b/tools/freebsd/ck-system-stop new file mode 100755 index 0000000..c947bea --- /dev/null +++ b/tools/freebsd/ck-system-stop @@ -0,0 +1,18 @@ +#!/bin/sh + +unsupported() { + echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2 + echo "No shutdown command found" >&2 + exit 1 +} + +#Try for common tools +if [ -x "/sbin/shutdown" ] ; then + /sbin/shutdown -p now + exit $? +elif [ -x "/usr/sbin/shutdown" ] ; then + /usr/sbin/shutdown -p now + exit $? +else + unsupported +fi diff --git a/tools/linux/Makefile.am b/tools/linux/Makefile.am index 0830734..51196c0 100644 --- a/tools/linux/Makefile.am +++ b/tools/linux/Makefile.am @@ -6,27 +6,33 @@ NULL = SUBDIRS = \ $(NULL) -INCLUDES = \ - -I. \ - -I$(srcdir) \ - -I$(top_srcdir)/src \ - $(CONSOLE_KIT_CFLAGS) \ - $(DISABLE_DEPRECATED_CFLAGS) \ - -DPREFIX=\""$(prefix)"\" \ - -DBINDIR=\""$(bindir)"\" \ - -DLIBDIR=\""$(libdir)"\" \ - -DLIBEXECDIR=\""$(libexecdir)"\" \ - -DDATADIR=\""$(datadir)"\" \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - $(WARN_CFLAGS) \ - $(DEBUG_CFLAGS) \ - $(TOOLS_CFLAGS) \ +scriptdir = $(libdir)/ConsoleKit/scripts +script_SCRIPTS = \ + ck-system-stop \ + ck-system-restart \ $(NULL) - EXTRA_DIST = \ + $(script_SCRIPTS) \ $(NULL) MAINTAINERCLEANFILES = \ *~ \ Makefile.in + + +check: + for f in $(script_SCRIPTS); do \ + echo -n "Validate bash syntax in $$f : "; \ + bash -n $(srcdir)/$$f 2> bash.error;\ + if test -s bash.error; then \ + echo failed; \ + cat bash.error; \ + rm -f bash.error; \ + exit 1; \ + else \ + echo ok; \ + rm -f bash.error; \ + fi; \ + done; + diff --git a/tools/linux/Makefile.in b/tools/linux/Makefile.in index 39209cb..f91ed6e 100644 --- a/tools/linux/Makefile.in +++ b/tools/linux/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,15 +13,12 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -45,21 +42,25 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(scriptdir)" +scriptSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(script_SCRIPTS) SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -72,12 +73,6 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CK_BACKEND = @CK_BACKEND@ -CK_COMPILE_FREEBSD_FALSE = @CK_COMPILE_FREEBSD_FALSE@ -CK_COMPILE_FREEBSD_TRUE = @CK_COMPILE_FREEBSD_TRUE@ -CK_COMPILE_LINUX_FALSE = @CK_COMPILE_LINUX_FALSE@ -CK_COMPILE_LINUX_TRUE = @CK_COMPILE_LINUX_TRUE@ -CK_COMPILE_SOLARIS_FALSE = @CK_COMPILE_SOLARIS_FALSE@ -CK_COMPILE_SOLARIS_TRUE = @CK_COMPILE_SOLARIS_TRUE@ CONSOLE_KIT_CFLAGS = @CONSOLE_KIT_CFLAGS@ CONSOLE_KIT_LIBS = @CONSOLE_KIT_LIBS@ CONSOLE_KIT_PID_FILE = @CONSOLE_KIT_PID_FILE@ @@ -94,17 +89,11 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_DOCS_ENABLED_FALSE = @DOCBOOK_DOCS_ENABLED_FALSE@ -DOCBOOK_DOCS_ENABLED_TRUE = @DOCBOOK_DOCS_ENABLED_TRUE@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ -ENABLE_INOTIFY_FALSE = @ENABLE_INOTIFY_FALSE@ -ENABLE_INOTIFY_TRUE = @ENABLE_INOTIFY_TRUE@ -ENABLE_PAM_MODULE_FALSE = @ENABLE_PAM_MODULE_FALSE@ -ENABLE_PAM_MODULE_TRUE = @ENABLE_PAM_MODULE_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ @@ -114,8 +103,10 @@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ HAVE_PAM = @HAVE_PAM@ -HAVE_PAM_FALSE = @HAVE_PAM_FALSE@ -HAVE_PAM_TRUE = @HAVE_PAM_TRUE@ +HAVE_POLKIT = @HAVE_POLKIT@ +HISTORY_CFLAGS = @HISTORY_CFLAGS@ +HISTORY_LIBS = @HISTORY_LIBS@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -132,9 +123,8 @@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ @@ -150,10 +140,13 @@ PAM_MODULE_DIR = @PAM_MODULE_DIR@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POFILES = @POFILES@ +POLKIT_CFLAGS = @POLKIT_CFLAGS@ +POLKIT_LIBS = @POLKIT_LIBS@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ +RBAC_LIBS = @RBAC_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -164,13 +157,14 @@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ XGETTEXT = @XGETTEXT@ XMLTO = @XMLTO@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -182,6 +176,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -209,31 +204,24 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.7 NULL = SUBDIRS = \ $(NULL) -INCLUDES = \ - -I. \ - -I$(srcdir) \ - -I$(top_srcdir)/src \ - $(CONSOLE_KIT_CFLAGS) \ - $(DISABLE_DEPRECATED_CFLAGS) \ - -DPREFIX=\""$(prefix)"\" \ - -DBINDIR=\""$(bindir)"\" \ - -DLIBDIR=\""$(libdir)"\" \ - -DLIBEXECDIR=\""$(libexecdir)"\" \ - -DDATADIR=\""$(datadir)"\" \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - $(WARN_CFLAGS) \ - $(DEBUG_CFLAGS) \ - $(TOOLS_CFLAGS) \ +scriptdir = $(libdir)/ConsoleKit/scripts +script_SCRIPTS = \ + ck-system-stop \ + ck-system-restart \ $(NULL) EXTRA_DIST = \ + $(script_SCRIPTS) \ $(NULL) MAINTAINERCLEANFILES = \ @@ -272,6 +260,25 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-scriptSCRIPTS: $(script_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(scriptdir)" || $(MKDIR_P) "$(DESTDIR)$(scriptdir)" + @list='$(script_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(scriptSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(scriptdir)/$$f'"; \ + $(scriptSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(scriptdir)/$$f"; \ + else :; fi; \ + done + +uninstall-scriptSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(script_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(scriptdir)/$$f'"; \ + rm -f "$(DESTDIR)$(scriptdir)/$$f"; \ + done mostlyclean-libtool: -rm -f *.lo @@ -279,10 +286,6 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, @@ -314,8 +317,7 @@ $(RECURSIVE_TARGETS): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: +$(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ @@ -416,22 +418,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -445,7 +446,7 @@ distdir: $(DISTFILES) list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ @@ -453,15 +454,20 @@ distdir: $(DISTFILES) $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive -all-am: Makefile +all-am: Makefile $(SCRIPTS) installdirs: installdirs-recursive installdirs-am: + for dir in "$(DESTDIR)$(scriptdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -493,8 +499,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags +distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive @@ -506,14 +511,22 @@ info: info-recursive info-am: -install-data-am: +install-data-am: install-scriptSCRIPTS + +install-dvi: install-dvi-recursive install-exec-am: +install-html: install-html-recursive + install-info: install-info-recursive install-man: +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -532,23 +545,41 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-info-am +uninstall-am: uninstall-scriptSCRIPTS -uninstall-info: uninstall-info-recursive +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am html \ +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-libtool \ - mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am uninstall-info-am - + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-scriptSCRIPTS install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am \ + uninstall-scriptSCRIPTS + + +check: + for f in $(script_SCRIPTS); do \ + echo -n "Validate bash syntax in $$f : "; \ + bash -n $(srcdir)/$$f 2> bash.error;\ + if test -s bash.error; then \ + echo failed; \ + cat bash.error; \ + rm -f bash.error; \ + exit 1; \ + else \ + echo ok; \ + rm -f bash.error; \ + fi; \ + done; # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/tools/linux/ck-system-restart b/tools/linux/ck-system-restart new file mode 100755 index 0000000..8e0664e --- /dev/null +++ b/tools/linux/ck-system-restart @@ -0,0 +1,12 @@ +#!/bin/sh + +#Try for common tools +if [ -x "/sbin/shutdown" ] ; then + /sbin/shutdown -r now + exit $? +elif [ -x "/usr/sbin/shutdown" ] ; then + /usr/sbin/shutdown -r now + exit $? +else + exit 1 +fi diff --git a/tools/linux/ck-system-stop b/tools/linux/ck-system-stop new file mode 100755 index 0000000..e26bca3 --- /dev/null +++ b/tools/linux/ck-system-stop @@ -0,0 +1,12 @@ +#!/bin/sh + +#Try for common tools +if [ -x "/sbin/shutdown" ] ; then + /sbin/shutdown -h now + exit $? +elif [ -x "/usr/sbin/shutdown" ] ; then + /usr/sbin/shutdown -h now + exit $? +else + exit 1 +fi diff --git a/tools/list-sessions.c b/tools/list-sessions.c index 75828ed..746c2f7 100644 --- a/tools/list-sessions.c +++ b/tools/list-sessions.c @@ -55,10 +55,10 @@ get_int (DBusGProxy *proxy, gboolean res; error = NULL; - res = dbus_g_proxy_call (proxy, - method, - &error, - G_TYPE_INVALID, + res = dbus_g_proxy_call (proxy, + method, + &error, + G_TYPE_INVALID, G_TYPE_INT, val, G_TYPE_INVALID); if (! res) { @@ -78,10 +78,10 @@ get_path (DBusGProxy *proxy, gboolean res; error = NULL; - res = dbus_g_proxy_call (proxy, - method, - &error, - G_TYPE_INVALID, + res = dbus_g_proxy_call (proxy, + method, + &error, + G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, str, G_TYPE_INVALID); if (! res) { @@ -101,10 +101,10 @@ get_string (DBusGProxy *proxy, gboolean res; error = NULL; - res = dbus_g_proxy_call (proxy, - method, - &error, - G_TYPE_INVALID, + res = dbus_g_proxy_call (proxy, + method, + &error, + G_TYPE_INVALID, G_TYPE_STRING, str, G_TYPE_INVALID); if (! res) { @@ -124,10 +124,10 @@ get_boolean (DBusGProxy *proxy, gboolean res; error = NULL; - res = dbus_g_proxy_call (proxy, - method, - &error, - G_TYPE_INVALID, + res = dbus_g_proxy_call (proxy, + method, + &error, + G_TYPE_INVALID, G_TYPE_BOOLEAN, value, G_TYPE_INVALID); if (! res) { @@ -175,7 +175,7 @@ list_session (DBusGConnection *connection, char *short_sid; const char *short_ssid; - proxy = dbus_g_proxy_new_for_name (connection, + proxy = dbus_g_proxy_new_for_name (connection, CK_NAME, ssid, CK_SESSION_INTERFACE); @@ -256,7 +256,7 @@ list_sessions (DBusGConnection *connection, GPtrArray *sessions; int i; - proxy = dbus_g_proxy_new_for_name (connection, + proxy = dbus_g_proxy_new_for_name (connection, CK_NAME, sid, CK_SEAT_INTERFACE); @@ -267,13 +267,13 @@ list_sessions (DBusGConnection *connection, sessions = NULL; error = NULL; - res = dbus_g_proxy_call (proxy, - "GetSessions", - &error, - G_TYPE_INVALID, + res = dbus_g_proxy_call (proxy, + "GetSessions", + &error, + G_TYPE_INVALID, dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &sessions, - G_TYPE_INVALID); + G_TYPE_INVALID); if (! res) { g_warning ("Failed to get list of sessions for %s: %s", sid, error->message); g_error_free (error); @@ -315,13 +315,13 @@ list_seats (DBusGConnection *connection) seats = NULL; error = NULL; - res = dbus_g_proxy_call (proxy, - "GetSeats", - &error, - G_TYPE_INVALID, + res = dbus_g_proxy_call (proxy, + "GetSeats", + &error, + G_TYPE_INVALID, dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &seats, - G_TYPE_INVALID); + G_TYPE_INVALID); if (! res) { g_warning ("Failed to get list of seats: %s", error->message); g_error_free (error); @@ -387,5 +387,5 @@ main (int argc, list_seats (connection); - return 0; + return 0; } diff --git a/tools/solaris/Makefile.am b/tools/solaris/Makefile.am new file mode 100644 index 0000000..d25930e --- /dev/null +++ b/tools/solaris/Makefile.am @@ -0,0 +1,38 @@ +## We require new-style dependency handling. +AUTOMAKE_OPTIONS = 1.7 + +NULL = + +SUBDIRS = \ + $(NULL) + +scriptdir = $(libdir)/ConsoleKit/scripts +script_SCRIPTS = \ + ck-system-stop \ + ck-system-restart \ + $(NULL) + +EXTRA_DIST = \ + $(script_SCRIPTS) \ + $(NULL) + +MAINTAINERCLEANFILES = \ + *~ \ + Makefile.in + + +check: + for f in $(script_SCRIPTS); do \ + echo -n "Validate bash syntax in $$f : "; \ + bash -n $(srcdir)/$$f 2> bash.error;\ + if test -s bash.error; then \ + echo failed; \ + cat bash.error; \ + rm -f bash.error; \ + exit 1; \ + else \ + echo ok; \ + rm -f bash.error; \ + fi; \ + done; + diff --git a/tools/solaris/Makefile.in b/tools/solaris/Makefile.in new file mode 100644 index 0000000..d029a5b --- /dev/null +++ b/tools/solaris/Makefile.in @@ -0,0 +1,585 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = tools/solaris +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(scriptdir)" +scriptSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(script_SCRIPTS) +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CK_BACKEND = @CK_BACKEND@ +CONSOLE_KIT_CFLAGS = @CONSOLE_KIT_CFLAGS@ +CONSOLE_KIT_LIBS = @CONSOLE_KIT_LIBS@ +CONSOLE_KIT_PID_FILE = @CONSOLE_KIT_PID_FILE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_SYS_DIR = @DBUS_SYS_DIR@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +HAVE_PAM = @HAVE_PAM@ +HAVE_POLKIT = @HAVE_POLKIT@ +HISTORY_CFLAGS = @HISTORY_CFLAGS@ +HISTORY_LIBS = @HISTORY_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +KVM_LIBS = @KVM_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBDBUS_CFLAGS = @LIBDBUS_CFLAGS@ +LIBDBUS_LIBS = @LIBDBUS_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PAM_LIBS = @PAM_LIBS@ +PAM_MODULE_DIR = @PAM_MODULE_DIR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POLKIT_CFLAGS = @POLKIT_CFLAGS@ +POLKIT_LIBS = @POLKIT_LIBS@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +RBAC_LIBS = @RBAC_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOOLS_CFLAGS = @TOOLS_CFLAGS@ +TOOLS_LIBS = @TOOLS_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XMLTO = @XMLTO@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = 1.7 +NULL = +SUBDIRS = \ + $(NULL) + +scriptdir = $(libdir)/ConsoleKit/scripts +script_SCRIPTS = \ + ck-system-stop \ + ck-system-restart \ + $(NULL) + +EXTRA_DIST = \ + $(script_SCRIPTS) \ + $(NULL) + +MAINTAINERCLEANFILES = \ + *~ \ + Makefile.in + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/solaris/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu tools/solaris/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-scriptSCRIPTS: $(script_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(scriptdir)" || $(MKDIR_P) "$(DESTDIR)$(scriptdir)" + @list='$(script_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(scriptSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(scriptdir)/$$f'"; \ + $(scriptSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(scriptdir)/$$f"; \ + else :; fi; \ + done + +uninstall-scriptSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(script_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(scriptdir)/$$f'"; \ + rm -f "$(DESTDIR)$(scriptdir)/$$f"; \ + done + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(SCRIPTS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(scriptdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-scriptSCRIPTS + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-scriptSCRIPTS + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-scriptSCRIPTS install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am \ + uninstall-scriptSCRIPTS + + +check: + for f in $(script_SCRIPTS); do \ + echo -n "Validate bash syntax in $$f : "; \ + bash -n $(srcdir)/$$f 2> bash.error;\ + if test -s bash.error; then \ + echo failed; \ + cat bash.error; \ + rm -f bash.error; \ + exit 1; \ + else \ + echo ok; \ + rm -f bash.error; \ + fi; \ + done; +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tools/solaris/ck-system-restart b/tools/solaris/ck-system-restart new file mode 100755 index 0000000..c61799f --- /dev/null +++ b/tools/solaris/ck-system-restart @@ -0,0 +1,3 @@ +#!/bin/sh + +/sbin/init 6 diff --git a/tools/solaris/ck-system-stop b/tools/solaris/ck-system-stop new file mode 100755 index 0000000..d5b2fde --- /dev/null +++ b/tools/solaris/ck-system-stop @@ -0,0 +1,3 @@ +#!/bin/sh + +/sbin/init 5 |