summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS8
-rw-r--r--TODO1
-rw-r--r--config.h.in18
-rwxr-xr-xconfigure129
-rw-r--r--configure.ac40
-rw-r--r--xfce4-session/util.c56
-rw-r--r--xfce4-session/util.h4
-rw-r--r--xfce4-shutdown/main.c39
8 files changed, 196 insertions, 99 deletions
diff --git a/NEWS b/NEWS
index 9053f406..83d66e77 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+20040110:
+---------
+ * Version 0.2.0
+ * Added support for user defined poweroff/halt/reboot commands,
+ and some cleanups, thanks to Brian Tarricone.
+ * Various fixes in the meantime, too bad I have no spare time for
+ xfce :-(
+
20030721:
---------
* Fix problem with Xrandr MCS plugin and splash screen not using
diff --git a/TODO b/TODO
index bd070677..c6e1e7ce 100644
--- a/TODO
+++ b/TODO
@@ -11,5 +11,6 @@
* Fix "Autostart" with default.session
* Add configure options to make packagers life easier regarding the
"shutdown/reboot" thing (see the Mail from Marcel Pol on 20031120)
+ [partly done]
* Add option to disable binding of a TCP/IP socket with ICE (see Moritz
mail on 20031211).
diff --git a/config.h.in b/config.h.in
index 11489228..d7566528 100644
--- a/config.h.in
+++ b/config.h.in
@@ -12,9 +12,15 @@
/* Name of default gettext domain */
#undef GETTEXT_PACKAGE
+/* halt command */
+#undef HALT_CMD
+
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
#undef HAVE_BIND_TEXTDOMAIN_CODESET
+/* Define to 1 if you have the `clearenv' function. */
+#undef HAVE_CLEARENV
+
/* Define to 1 if you have the `dcgettext' function. */
#undef HAVE_DCGETTEXT
@@ -27,9 +33,6 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
-/* Define to 1 if you have the `gethostname' function. */
-#undef HAVE_GETHOSTNAME
-
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
@@ -57,6 +60,9 @@
/* Define to 1 if you have the `mkdir' function. */
#undef HAVE_MKDIR
+/* Define to 1 if you have the `putenv' function. */
+#undef HAVE_PUTENV
+
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
@@ -117,6 +123,12 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
+/* poweroff command */
+#undef POWEROFF_CMD
+
+/* reboot command */
+#undef REBOOT_CMD
+
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
diff --git a/configure b/configure
index 73447a4b..f12226df 100755
--- a/configure
+++ b/configure
@@ -1055,6 +1055,10 @@ Optional Packages:
include additional configurations [automatic]
--with-x use the X Window System
--with-locales-dir=DIR Install locales into DIR
+ --with-poweroff=cmd command used to power down (full path with
+ arguments)
+ --with-halt=cmd command used to halt (full path with arguments)
+ --with-reboot=cmd command used to reboot (full path with arguments)
Some influential environment variables:
CC C compiler command
@@ -1753,7 +1757,7 @@ fi
# Define the identity of the package.
PACKAGE=xfce4-session
- VERSION=0.1.4
+ VERSION=0.2.0
cat >>confdefs.h <<_ACEOF
@@ -5167,7 +5171,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 5170 "configure"' > conftest.$ac_ext
+ echo '#line 5174 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -6206,7 +6210,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:6209:" \
+echo "$as_me:6213:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -7218,11 +7222,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7221: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7225: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7225: \$? = $ac_status" >&5
+ echo "$as_me:7229: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -7451,11 +7455,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7454: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7458: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7458: \$? = $ac_status" >&5
+ echo "$as_me:7462: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -7518,11 +7522,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7521: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7525: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7525: \$? = $ac_status" >&5
+ echo "$as_me:7529: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -9565,7 +9569,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9568 "configure"
+#line 9572 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9663,7 +9667,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9666 "configure"
+#line 9670 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11818,11 +11822,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11821: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11825: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11825: \$? = $ac_status" >&5
+ echo "$as_me:11829: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -11885,11 +11889,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11888: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11892: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11892: \$? = $ac_status" >&5
+ echo "$as_me:11896: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -13154,7 +13158,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 13157 "configure"
+#line 13161 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13252,7 +13256,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 13255 "configure"
+#line 13259 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14075,11 +14079,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14078: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14082: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14082: \$? = $ac_status" >&5
+ echo "$as_me:14086: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -14142,11 +14146,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14145: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14149: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14149: \$? = $ac_status" >&5
+ echo "$as_me:14153: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16119,11 +16123,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16122: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16126: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16126: \$? = $ac_status" >&5
+ echo "$as_me:16130: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -16352,11 +16356,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16355: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16359: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16359: \$? = $ac_status" >&5
+ echo "$as_me:16363: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -16419,11 +16423,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16422: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16426: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16426: \$? = $ac_status" >&5
+ echo "$as_me:16430: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -18466,7 +18470,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 18469 "configure"
+#line 18473 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18564,7 +18568,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 18567 "configure"
+#line 18571 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19735,7 +19739,8 @@ fi
-for ac_func in gethostname mkdir setenv sigaction
+
+for ac_func in mkdir clearenv putenv setenv sigaction
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -19826,8 +19831,9 @@ done
+
for ac_header in errno.h fcntl.h limits.h signal.h sys/param.h sys/utsname.h \
- sys/wait.h time.h
+ sys/wait.h time.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -23153,6 +23159,67 @@ echo "${ECHO_T}yes" >&6
fi
+
+echo "$as_me:$LINENO: checking for custom 'poweroff' command" >&5
+echo $ECHO_N "checking for custom 'poweroff' command... $ECHO_C" >&6
+
+# Check whether --with-poweroff or --without-poweroff was given.
+if test "${with_poweroff+set}" = set; then
+ withval="$with_poweroff"
+ with_poweroff="$withval"
+else
+ with_poweroff="no"
+fi;
+if test "x$with_poweroff" != "xno"; then
+
+cat >>confdefs.h <<_ACEOF
+#define POWEROFF_CMD "$with_poweroff"
+_ACEOF
+
+fi
+echo "$as_me:$LINENO: result: $with_poweroff" >&5
+echo "${ECHO_T}$with_poweroff" >&6
+
+echo "$as_me:$LINENO: checking for custom 'halt' command" >&5
+echo $ECHO_N "checking for custom 'halt' command... $ECHO_C" >&6
+
+# Check whether --with-halt or --without-halt was given.
+if test "${with_halt+set}" = set; then
+ withval="$with_halt"
+ with_halt="$withval"
+else
+ with_halt="no"
+fi;
+if test "x$with_halt" != "xno"; then
+
+cat >>confdefs.h <<_ACEOF
+#define HALT_CMD "$with_halt"
+_ACEOF
+
+fi
+echo "$as_me:$LINENO: result: $with_halt" >&5
+echo "${ECHO_T}$with_halt" >&6
+
+echo "$as_me:$LINENO: checking for custom 'reboot' command" >&5
+echo $ECHO_N "checking for custom 'reboot' command... $ECHO_C" >&6
+
+# Check whether --with-reboot or --without-reboot was given.
+if test "${with_reboot+set}" = set; then
+ withval="$with_reboot"
+ with_reboot="$withval"
+else
+ with_reboot="no"
+fi;
+if test "x$with_reboot" != "xno"; then
+
+cat >>confdefs.h <<_ACEOF
+#define REBOOT_CMD "$with_reboot"
+_ACEOF
+
+fi
+echo "$as_me:$LINENO: result: $with_reboot" >&5
+echo "${ECHO_T}$with_reboot" >&6
+
ac_config_files="$ac_config_files Makefile defaults/Makefile defaults/splash/Makefile docs/Makefile settings/Makefile po/Makefile.in xfce4-session.spec xfce4-session/Makefile xfce4-shutdown/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
diff --git a/configure.ac b/configure.ac
index 191c490e..123af787 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@ AC_INIT([configure.ac])
AM_CONFIG_HEADER([config.h])
-AM_INIT_AUTOMAKE([xfce4-session], [0.1.4])
+AM_INIT_AUTOMAKE([xfce4-session], [0.2.0])
AM_MAINTAINER_MODE
@@ -23,9 +23,9 @@ AC_PROG_LIBTOOL
dnl check for standard header files
AC_HEADER_STDC
-AC_CHECK_FUNCS([gethostname mkdir setenv sigaction])
+AC_CHECK_FUNCS([mkdir clearenv putenv setenv sigaction])
AC_CHECK_HEADERS([errno.h fcntl.h limits.h signal.h sys/param.h sys/utsname.h \
- sys/wait.h time.h])
+ sys/wait.h time.h unistd.h])
dnl Check for X11 installed
BM_LIBX11_REQUIRE
@@ -48,6 +48,40 @@ XFCE_MCS_PLUGIN([XFCE_MCS_MANAGER], [4.0.0])
dnl Check for debugging support
BM_DEBUG_SUPPORT
+dnl
+dnl arguments to set shutdown commands
+dnl
+
+AC_MSG_CHECKING([for custom 'poweroff' command])
+AC_ARG_WITH([poweroff],
+ AC_HELP_STRING([--with-poweroff=cmd], [command used to power down (full path with arguments)]),
+ [with_poweroff="$withval"],
+ [with_poweroff="no"])
+if test "x$with_poweroff" != "xno"; then
+ AC_DEFINE_UNQUOTED(POWEROFF_CMD, "$with_poweroff", [poweroff command])
+fi
+AC_MSG_RESULT([$with_poweroff])
+
+AC_MSG_CHECKING([for custom 'halt' command])
+AC_ARG_WITH([halt],
+ AC_HELP_STRING([--with-halt=cmd], [command used to halt (full path with arguments)]),
+ [with_halt="$withval"],
+ [with_halt="no"])
+if test "x$with_halt" != "xno"; then
+ AC_DEFINE_UNQUOTED(HALT_CMD, "$with_halt", [halt command])
+fi
+AC_MSG_RESULT([$with_halt])
+
+AC_MSG_CHECKING([for custom 'reboot' command])
+AC_ARG_WITH([reboot],
+ AC_HELP_STRING([--with-reboot=cmd], [command used to reboot (full path with arguments)]),
+ [with_reboot="$withval"],
+ [with_reboot="no"])
+if test "x$with_reboot" != "xno"; then
+ AC_DEFINE_UNQUOTED(REBOOT_CMD, "$with_reboot", [reboot command])
+fi
+AC_MSG_RESULT([$with_reboot])
+
AC_OUTPUT([
Makefile
defaults/Makefile
diff --git a/xfce4-session/util.c b/xfce4-session/util.c
index d17c89a8..cb4e0571 100644
--- a/xfce4-session/util.c
+++ b/xfce4-session/util.c
@@ -93,62 +93,6 @@ fstrwrite(FILE *fp, const char *string)
}
/*
- * XXX - move to libxfce4util
- */
-gchar *
-xfce_strjoin(gchar *separator, gchar **strings, gint count)
-{
- gchar *result;
- gint length;
- gint n;
-
- g_return_val_if_fail(count < 1, NULL);
- g_return_val_if_fail(strings != NULL, NULL);
-
- for (length = 1, n = 0; n < count; n++)
- length += strlen(strings[n]);
-
- if (separator != NULL)
- length += (count - 1) * strlen(separator);
-
- result = g_new0(gchar, length);
-
- for (n = 0; n < count; n++) {
- (void)g_strlcat(result, strings[n], length);
-
- if (separator != NULL && n + 1 < count)
- (void)g_strlcat(result, separator, length);
- }
-
- return(result);
-}
-
-/*
- * XXX - move to libxfce4util
- */
-gchar *
-xfce_gethostname(void)
-{
-#ifdef HAVE_GETHOSTNAME
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 256
-#endif
- char hostname[MAXHOSTNAMELEN];
-
- if (gethostname(hostname, MAXHOSTNAMELEN) == 0)
- return(g_strdup(hostname));
-#else
- struct utsname name;
-
- if (uname(&name) == 0)
- return(g_strdup(name.nodename));
-#endif
- g_error("Unable to determine your hostname: %s", g_strerror(errno));
- /* NOT REACHED */
- return(NULL);
-}
-
-/*
*/
GtkWidget *
xfsm_imgbtn_new(const gchar *text, const gchar *icon)
diff --git a/xfce4-session/util.h b/xfce4-session/util.h
index 66106da5..f87aad13 100644
--- a/xfce4-session/util.h
+++ b/xfce4-session/util.h
@@ -35,9 +35,6 @@
extern char *fstrread(FILE *);
extern void fstrwrite(FILE *, const char *);
-extern gchar *xfce_strjoin(gchar *, gchar **, gint);
-extern gchar *xfce_gethostname(void);
-
extern GtkWidget *xfsm_imgbtn_new(const gchar *, const gchar *);
#if 0
@@ -47,4 +44,3 @@ extern void netk_gtk_window_set_skip_tasklist(GtkWindow *,gboolean);
#endif
#endif /* !__XFSM_UTIL_H__ */
-
diff --git a/xfce4-shutdown/main.c b/xfce4-shutdown/main.c
index 21c4a099..f992d618 100644
--- a/xfce4-shutdown/main.c
+++ b/xfce4-shutdown/main.c
@@ -112,8 +112,7 @@ sudo(const gchar *action)
err = NULL;
command = g_strdup_printf("sudo -S -u root /sbin/%s", action);
- result = g_spawn_command_line_sync(command, &outbuf, &errbuf, &status,
- &err);
+ result = g_spawn_command_line_sync(command, &outbuf, &errbuf, &status, &err);
g_free(command);
if (!result) {
@@ -173,19 +172,50 @@ main(int argc, char **argv)
PATH_SHUTDOWNALLOW);
return(EXIT_FAILURE);
}
+
+ /*
+ * XXX - I wonder if this is actually a good idea.
+ * - bm, 20040110
+ */
+#if defined(POWEROFF_CMD) || defined(HALT_CMD) || defined(REBOOT_CMD)
+#ifdef HAVE_CLEARENV
+ clearenv();
+#endif
+#if defined(HAVE_SETENV)
+ setenv("PATH", "/bin:/sbin:/usr/bin:/usr/sbin", 1);
+ setenv("IFS", " \t\n", 1);
+#elif defined(HAVE_PUTENV)
+ putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin");
+ putenv("IFS= \t\n");
+#endif
+#endif
/* Ok, lets get this box down */
if (!strcmp(action, "poweroff")) {
+#ifdef POWEROFF_CMD
+ if (g_spawn_command_line_sync(POWEROFF_CMD, NULL, NULL, NULL, NULL))
+ return(EXIT_SUCCESS);
+#endif
+
+ /* Ok, now the dirty way */
execl("/sbin/poweroff", "poweroff", NULL);
execl("/sbin/halt", "halt", "-p", NULL);
/* FALLTHROUGH */
}
if (!strcmp(action, "reboot")) {
+#ifdef REBOOT_CMD
+ if(g_spawn_command_line_sync(REBOOT_CMD, NULL, NULL, NULL, NULL))
+ return(EXIT_SUCCESS);
+#endif
execl("/sbin/reboot", "reboot", NULL);
/* FALLTHROUGH */
}
+#ifdef HALT_CMD
+ if(g_spawn_command_line_sync(HALT_CMD, NULL, NULL, NULL, NULL))
+ return(EXIT_SUCCESS);
+#endif
execl("/sbin/halt", "halt", NULL);
fprintf(stderr, _(
@@ -197,12 +227,17 @@ main(int argc, char **argv)
/* try using sudo (should not return) */
if (sudo(action)) {
+#if 0
/*
* Ok, sudo returned indicating success, that means, the
* system is about to go down, so idle a bit
*/
for (;;)
sleep(1);
+#else
+ /* better return to caller here */
+ return(EXIT_SUCCESS);
+#endif
}
fprintf(stderr, _(