summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ConfigureChecks.cmake86
-rw-r--r--config.h.cmake4
-rw-r--r--kcontrol/tdm/tdm-shut.cpp16
-rw-r--r--tdm/config.def15
4 files changed, 99 insertions, 22 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 926b29a43..244a6e48a 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -593,6 +593,92 @@ if( BUILD_KCONTROL OR BUILD_TDM )
endif()
set( KSTAT_LIBRARIES "" )
endif( )
+
+ if( NOT DEFINED REBOOT_BINARY )
+ message( STATUS "Looking for reboot" )
+ find_program( REBOOT_BINARY reboot
+ HINTS /sbin
+ /usr/sbin
+ )
+ if( REBOOT_BINARY )
+ message( STATUS "Looking for reboot - ${REBOOT_BINARY}" )
+ endif( REBOOT_BINARY )
+ endif( NOT DEFINED REBOOT_BINARY )
+
+ if( NOT DEFINED POWEROFF_BINARY )
+ message( STATUS "Looking for poweroff" )
+ find_program( POWEROFF_BINARY poweroff
+ HINTS /sbin
+ /usr/sbin
+ )
+ if( POWEROFF_BINARY )
+ message( STATUS "Looking for poweroff - ${POWEROFF_BINARY}" )
+ endif( POWEROFF_BINARY )
+ endif( NOT DEFINED POWEROFF_BINARY )
+
+ if( NOT DEFINED HALT_BINARY )
+ message( STATUS "Looking for halt" )
+ find_program( HALT_BINARY halt
+ HINTS /sbin
+ /usr/sbin
+ )
+ if( HALT_BINARY )
+ message( STATUS "Looking for halt - ${HALT_BINARY}" )
+ endif( HALT_BINARY )
+ endif( NOT DEFINED HALT_BINARY )
+
+ if( NOT DEFINED SHUTDOWN_BINARY )
+ message( STATUS "Looking for shutdown" )
+ find_program( SHUTDOWN_BINARY shutdown
+ HINTS /sbin
+ /usr/sbin
+ )
+ if( SHUTDOWN_BINARY )
+ message( STATUS "Looking for shutdown - ${SHUTDOWN_BINARY}" )
+ endif( SHUTDOWN_BINARY )
+ endif( NOT DEFINED SHUTDOWN_BINARY )
+
+ if( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
+ # SunOS based systems
+ if( NOT REBOOT_BINARY AND SHUTDOWN_BINARY )
+ # emulate reboot
+ set( REBOOT_BINARY "${SHUTDOWN_BINARY} -y -i 6")
+ endif( NOT REBOOT_BINARY AND SHUTDOWN_BINARY )
+
+ if( NOT POWEROFF_BINARY AND SHUTDOWN_BINARY )
+ # emulate poweroff
+ set( POWEROFF_BINARY "${SHUTDOWN_BINARY} -y -i 5")
+ endif( NOT POWEROFF_BINARY AND SHUTDOWN_BINARY )
+
+ else( ) # default condition
+ if( NOT REBOOT_BINARY AND SHUTDOWN_BINARY )
+ # emulate reboot
+ set( REBOOT_BINARY "${SHUTDOWN_BINARY} -r now")
+ endif( NOT REBOOT_BINARY AND SHUTDOWN_BINARY )
+
+ if( NOT POWEROFF_BINARY AND SHUTDOWN_BINARY )
+ # emulate poweroff
+ set( POWEROFF_BINARY "${SHUTDOWN_BINARY} -h now")
+ endif( NOT POWEROFF_BINARY AND SHUTDOWN_BINARY )
+
+ if( NOT POWEROFF_BINARY AND HALT_BINARY )
+ # emulate poweroff
+ set( POWEROFF_BINARY "${HALT_BINARY} -p")
+ endif( NOT POWEROFF_BINARY AND HALT_BINARY )
+
+ endif( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
+
+ if( NOT REBOOT_BINARY )
+ tde_message_fatal( "reboot command is not defined" )
+ endif( NOT REBOOT_BINARY )
+
+ if( NOT POWEROFF_BINARY )
+ tde_message_fatal( "poweroff command is not defined" )
+ endif( NOT POWEROFF_BINARY )
+
+ message( STATUS "poweroff - ${POWEROFF_BINARY}" )
+ message( STATUS "reboot - ${REBOOT_BINARY}" )
+
endif( BUILD_KCONTROL OR BUILD_TDM )
check_include_files( "sys/time.h;sys/loadavg.h" HAVE_SYS_LOADAVG_H )
diff --git a/config.h.cmake b/config.h.cmake
index 09baec618..fec3909f4 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -238,3 +238,7 @@
// TDE man installation folder
#define TDE_MANDIR "@MAN_INSTALL_DIR@"
+
+// System control binaries used in kcontrol/tdm
+#define POWEROFF_BINARY "@POWEROFF_BINARY@"
+#define REBOOT_BINARY "@REBOOT_BINARY@"
diff --git a/kcontrol/tdm/tdm-shut.cpp b/kcontrol/tdm/tdm-shut.cpp
index 14e681d18..da120ae4c 100644
--- a/kcontrol/tdm/tdm-shut.cpp
+++ b/kcontrol/tdm/tdm-shut.cpp
@@ -17,6 +17,8 @@
Boston, MA 02110-1301, USA.
*/
+#include "config.h"
+
#include <unistd.h>
#include <sys/types.h>
@@ -91,7 +93,7 @@ TDMSessionsWidget::TDMSessionsWidget(TQWidget *parent, const char *name)
bm_combo = new KBackedComboBox( group4 );
bm_combo->insertItem("None", i18n("boot manager", "None"));
bm_combo->insertItem("Grub", i18n("Grub"));
-#if defined(__linux__) && ( defined(__i386__) || defined(__amd64__) )
+#if defined(Q_OS_LINUX) && ( defined(__i386__) || defined(__amd64__) )
bm_combo->insertItem("Lilo", i18n("Lilo"));
#endif
TQLabel *bm_label = new TQLabel( bm_combo, i18n("Boot manager:"), group4 );
@@ -208,12 +210,8 @@ void TDMSessionsWidget::load()
readSD(sdrcombo, "Root");
config->setGroup("Shutdown");
- restart_lined->setURL(config->readEntry("RebootCmd", "/sbin/reboot"));
-#if defined(__OpenBSD__)
- shutdown_lined->setURL(config->readEntry("HaltCmd", "/sbin/halt -p"));
-#else
- shutdown_lined->setURL(config->readEntry("HaltCmd", "/sbin/poweroff"));
-#endif
+ restart_lined->setURL(config->readEntry("RebootCmd", REBOOT_BINARY));
+ shutdown_lined->setURL(config->readEntry("HaltCmd", POWEROFF_BINARY));
bm_combo->setCurrentId(config->readEntry("BootManager", "None"));
}
@@ -222,8 +220,8 @@ void TDMSessionsWidget::load()
void TDMSessionsWidget::defaults()
{
- restart_lined->setURL("/sbin/reboot");
- shutdown_lined->setURL("/sbin/poweroff");
+ restart_lined->setURL(REBOOT_BINARY);
+ shutdown_lined->setURL(POWEROFF_BINARY);
sdlcombo->setCurrentItem(SdAll);
sdrcombo->setCurrentItem(SdRoot);
diff --git a/tdm/config.def b/tdm/config.def
index 7ffdd2376..43de11c71 100644
--- a/tdm/config.def
+++ b/tdm/config.def
@@ -33,19 +33,8 @@
#define TDMCONF KDE_CONFDIR "/tdm"
#define TDMDATA KDE_DATADIR "/tdm"
-#ifdef _AIX
-# define HALT_CMD "/usr/sbin/shutdown -h now"
-# define REBOOT_CMD "/usr/sbin/shutdown -r now"
-#elif defined(BSD)
-# define HALT_CMD "/sbin/shutdown -h now"
-# define REBOOT_CMD "/sbin/shutdown -r now"
-#elif defined(__SVR4)
-# define HALT_CMD "/usr/sbin/halt"
-# define REBOOT_CMD "/usr/sbin/reboot"
-#else
-# define HALT_CMD "/sbin/poweroff"
-# define REBOOT_CMD "/sbin/reboot"
-#endif
+# define HALT_CMD POWEROFF_BINARY
+# define REBOOT_CMD REBOOT_BINARY
#if defined(BSD) || defined(__linux__)
# define DEF_USER_PATH "/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games"