Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6f5ad018f | ||
|
|
2ffec89ed8 |
@@ -26,6 +26,13 @@ dist_doc_DATA = AUTHORS.txt ChangeLog NEWS README.txt \
|
||||
LICENSE_zlib.txt
|
||||
|
||||
|
||||
# nobase_ preserves their directory names.
|
||||
nobase_dist_doc_DATA = contrib/cron-based_noadmin/README \
|
||||
contrib/cron-based_noadmin/cron_gather_smart.sh \
|
||||
contrib/cron-based_noadmin/crontab.example \
|
||||
contrib/cron-based_noadmin/smartctl_subst.sh
|
||||
|
||||
|
||||
# Extra files bundled with distribution.
|
||||
# file2csource.sh is needed for building but not installed.
|
||||
EXTRA_DIST = COPYING TODO INSTALL configure autogen.sh \
|
||||
@@ -86,10 +93,18 @@ win-dist-prepare: all win-dist-clean
|
||||
|
||||
unix2dos nsis-dist/*.nsi nsis-dist/doc/*.txt
|
||||
|
||||
cp "@WIN32_ENV@"/libatkmm-*.dll "@WIN32_ENV@"/libcairomm-*.dll "@WIN32_ENV@"/libgdkmm-*.dll nsis-dist/
|
||||
cp "@WIN32_ENV@"/libgiomm-*.dll "@WIN32_ENV@"/libglibmm-*.dll "@WIN32_ENV@"/libgtkmm-*.dll nsis-dist/
|
||||
cp "@WIN32_ENV@"/libpangomm-*.dll "@WIN32_ENV@"/libsigc-*.dll "@WIN32_ENV@"/pcre3.dll nsis-dist/
|
||||
cp "@WIN32_ENV@"/mingwm10.dll "@WIN32_ENV@"/smartctl.exe "@WIN32_ENV@"/smartctl_console.exe nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libatkmm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libcairomm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libgdkmm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libgiomm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libglibmm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libgtkmm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libpangomm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libsigc-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/pcre3.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/mingwm10.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/smartctl.exe nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/smartctl_console.exe nsis-dist/
|
||||
|
||||
cp src/gsmartcontrol.exe nsis-dist/
|
||||
|
||||
@@ -1,10 +1,31 @@
|
||||
|
||||
Version 0.8.3, released on 2008-12-27
|
||||
A random "Smartctl returned an empty output" error on Windows was fixed.
|
||||
Thanks to Zurab Khetsuriani for testing.
|
||||
Fixed a parser issue which prevented running self-tests in Windows.
|
||||
The supplied icon (hopefully) shows correctly in Windows 2000 now.
|
||||
This release adds an official support for Windows 2000 SP4.
|
||||
Added scripts to allow GSmartControl to read smartctl data from
|
||||
cron-generated files. This allows users to read somewhat recent
|
||||
smartctl information without having to run GSmartControl as root.
|
||||
Generously contributed by Alex Butcher <alex dot butcher 'at'
|
||||
assursys.co.uk>.
|
||||
Configure script correctly aborts instead of printing a warning if gtkmm
|
||||
or libglademm (if needed) is not found.
|
||||
Configure script now accepts --enable-windows-console,
|
||||
--disable-abort-if-no-gtkmm, --disable-abort-if-no-glade-reader,
|
||||
as well as Windows-supporting "auto" for --enable-nsis-wine and
|
||||
--with-nsis.
|
||||
Configure's --with-win32-env has been renamed to --with-windows-dlls.
|
||||
The "About" dialog shows version information now.
|
||||
Minor bugs were fixed.
|
||||
|
||||
Version 0.8.2, released on 2008-12-10
|
||||
Fixed gsmartcontrol_root.sh script to support distributions with no
|
||||
/usr/sbin in their users' paths (thanks to Erwan Velu).
|
||||
Added desktop auto-detection to gsmartcontrol_root.sh script. This allows
|
||||
us to use only one desktop file (thanks to Erwan Velu).
|
||||
Added debian package directory (named "debian.dist" for now to avoid
|
||||
Added Debian package directory (named "debian.dist" for now to avoid
|
||||
control file conflicts with Build Service).
|
||||
Renamed gsmartcontrol_root.sh to gsmartcontrol-root, to make Debian happy.
|
||||
Added make targets for Windows packages (zip and NSIS).
|
||||
@@ -14,7 +35,7 @@ Version 0.8.2, released on 2008-12-10
|
||||
No more unnecessary parsing.
|
||||
No segfault on exit under Windows and Solaris.
|
||||
A friendlier message is displayed if smartctl was not found.
|
||||
No hilighted labels when switching tabs in Information window.
|
||||
No highlighted labels when switching tabs in Information window.
|
||||
|
||||
Version 0.8.1, released on 2008-11-11
|
||||
Disabled Linux "by-id" drive detection - it's unreliable on some broken
|
||||
@@ -18,7 +18,7 @@ http://gsmartcontrol.berlios.de
|
||||
|
||||
Features
|
||||
|
||||
Automatically report and hilight any abnormal SMART information.
|
||||
Automatically report and highlight any abnormal SMART information.
|
||||
|
||||
Ability to enable / disable SMART.
|
||||
|
||||
@@ -41,7 +41,7 @@ Extensive help information.
|
||||
|
||||
|
||||
|
||||
What is SMART?
|
||||
What Is SMART?
|
||||
|
||||
Short answer: SMART is a technology which provides hard disk drives with
|
||||
methods to predict certain kinds of failures with certain chance of success.
|
||||
@@ -101,8 +101,8 @@ You need to have the following software installed:
|
||||
* libglademm, version 2.4 or higher - see http://www.gtkmm.org .
|
||||
Note: libglademm is not needed when using GTK 2.12 and Gtkmm 2.12.
|
||||
|
||||
Note that GTK+ 2.12 and Gtkmm 2.12 are HIGHLY recommended. While earlier
|
||||
versions may work, they may produce suboptimal results and buggy behaviour.
|
||||
Note that having GTK+ 2.12 and Gtkmm 2.12 is HIGHLY recommended. While earlier
|
||||
versions may work, they may produce suboptimal results and buggy behavior.
|
||||
Libglademm is not needed when using GTK / Gtkmm 2.12.
|
||||
|
||||
Most of these packages are probably already provided by your distribution.
|
||||
@@ -126,6 +126,10 @@ Note that usually you need to specify only these packages - the rest is
|
||||
installed automatically by the package manager's dependency resolver. Keep in
|
||||
mind that you also need smartmontools to run the program.
|
||||
|
||||
Note: If using the official Windows package, the requirements are listed on
|
||||
GSmartControl's website.
|
||||
|
||||
|
||||
|
||||
The following operating systems are supported:
|
||||
|
||||
@@ -137,9 +141,8 @@ The following operating systems are supported:
|
||||
|
||||
* OpenBSD - Tested with OpenBSD 4.3 / x86-64 / gcc-3.3.5.
|
||||
|
||||
* Windows (XP or higher) - Tested with Windows XP and Vista. Windows 2000 does
|
||||
not work for some unknown reason. The Windows port uses pd0, pd1, etc... for
|
||||
physical drives 0, 1, etc... .
|
||||
* Windows (2000 SP4 or newer) - Tested with Windows 2000 SP4, XP SP2 and Vista
|
||||
SP1. The Windows port uses pd0, pd1, etc... for physical drives 0, 1, etc... .
|
||||
|
||||
* Solaris - Tested with Solaris 10 / x86 / gcc-3.4.3 / blastwave,
|
||||
Solaris 10 / x86 / sunstudio12 / sunfreeware. OpenSolaris should work but has
|
||||
@@ -158,7 +161,11 @@ to work without any issues.
|
||||
|
||||
Installation
|
||||
|
||||
Short answer: ./configure; make; make install
|
||||
Short answer: build and install via: ./configure; make; make install
|
||||
|
||||
Run gsmartcontrol-root to invoke gsmartcontrol with your desktop's su
|
||||
mechanism, or use the desktop menu entry.
|
||||
|
||||
|
||||
Long answer: read below.
|
||||
|
||||
@@ -174,15 +181,49 @@ dependencies (see Software Requirements section). Then the usual
|
||||
|
||||
./configure; make; make install
|
||||
|
||||
will build and install it. Installation usually requires adminstrative
|
||||
will build and install it. Installation usually requires administrative
|
||||
privileges, but you don't need to install the program in order to run it
|
||||
directly from the compilation directory.
|
||||
directly from the build directory.
|
||||
|
||||
|
||||
|
||||
Command Line Options
|
||||
|
||||
GSmartControl inherits options from GTK+ and other libraries, so be sure to
|
||||
run it with --help option to get a full list of accepted parameters.
|
||||
Note: The Windows version may not have a text output at all, so --help and
|
||||
similar arguments won't have any effect. However, --verbose will still
|
||||
increase the verbosity of a log saved via "Options -> View Execution Log ->
|
||||
Save All".
|
||||
|
||||
The most important parameters are:
|
||||
|
||||
-?, --help - Show help options.
|
||||
|
||||
-V, --version - Display version information.
|
||||
|
||||
-l, --no-locale - Disable locale.
|
||||
|
||||
--no-scan - Don't scan devices on startup.
|
||||
|
||||
--no-hide-tabs - Don't hide non-identity tabs when SMART is disabled.
|
||||
|
||||
--add-virtual - Load smartctl data from file, creating a virtual drive.
|
||||
|
||||
--add-device - Add this device to device list. Useful with --no-scan to list
|
||||
certain drives only.
|
||||
|
||||
-v, --verbose - Enable verbose logging; same as --verbosity-level 5.
|
||||
|
||||
-q, --quiet - Disable logging; same as --verbosity-level 0.
|
||||
|
||||
-b, --verbosity-level - Set verbosity level [0-5].
|
||||
|
||||
|
||||
|
||||
Permission Problems
|
||||
|
||||
Short answer: you need to be root (Administrator in Windows).
|
||||
Short answer: you need to be root (that's Administrator in Windows).
|
||||
In X11, use kdesu, gnomesu, sux, xdg-su or similar.
|
||||
|
||||
Long answer: read below.
|
||||
@@ -227,9 +268,10 @@ previously, it will be re-enabled on reboot.
|
||||
The easiest way to work around this is to set the desired settings on system
|
||||
startup. You may use smartctl or smartd to do that. For example, to enable
|
||||
both SMART and Automatic Offline Data Collection on /dev/sda, one would write
|
||||
the following to his/her boot.local, rc.local or similar:
|
||||
the following to the system startup script (e.g. boot.local, rc.local or
|
||||
similar on Linux):
|
||||
|
||||
smartctl --smart=on --offlineauto=on /dev/sda
|
||||
smartctl -s on -o on /dev/sda
|
||||
|
||||
For more information, see smartctl and smartd documentation.
|
||||
|
||||
@@ -251,13 +293,15 @@ have X11 / Gtkmm running, so this is a low priority task.
|
||||
* I only have ATA drives, so testing would be almost impossible.
|
||||
|
||||
Immediate Offline Tests are not supported. I haven't found a way to reliably
|
||||
monitor them yet.
|
||||
monitor them yet. Besides, they run automatically anyway if Automatic Offline
|
||||
Data Collection is enabled.
|
||||
|
||||
You may run several tests on different drives in parallel, but you will only
|
||||
see the progress information of the last executing test. So, if you run tests
|
||||
on drives A, B and C (in that order), you won't be able to monitor the tests
|
||||
on A and B until C completes. And you won't be able to see any progress on A
|
||||
until both B and C complete their tests.
|
||||
until both B and C complete their tests. This doesn't affect the tests
|
||||
themselves, just your ability to see their progress.
|
||||
|
||||
Testing is only supported on drives which correctly report their progress
|
||||
information in capabilities.
|
||||
@@ -283,6 +327,10 @@ terminal emulator (e.g., xterm, konsole or gnome-terminal):
|
||||
|
||||
smartctl -a /dev/sda
|
||||
|
||||
Note: If using official Windows packages, smartctl.exe doesn't provide any
|
||||
output. Use smartctl_console.exe instead. The devices name should be /dev/pd1
|
||||
for the second physical drive, etc... .
|
||||
|
||||
If you still think it's a GSmartControl issue, please collect the following
|
||||
information about your system. Without it, it may be very hard or impossible
|
||||
to fix the bug.
|
||||
@@ -300,6 +348,8 @@ dialog):
|
||||
|
||||
gsmartcontrol-root auto -v
|
||||
|
||||
Note: On Windows, run gsmartcontrol.exe with "-v" switch as Administrator.
|
||||
|
||||
Perform the steps needed to reproduce the bug, then go to
|
||||
"Options -> View Execution Log", and click "Save All".
|
||||
|
||||
@@ -36,10 +36,10 @@ TODO:
|
||||
|
||||
Patch pangomm for Pango::strip_markup().
|
||||
|
||||
+Make a test case of IconView positioning bug, file a bug report.
|
||||
|
||||
Patch gtkmm, glibmm, pangomm for static win32 builds.
|
||||
|
||||
No Gtk::AboutDialog::set_logo(NULL);
|
||||
|
||||
|
||||
libdebug:
|
||||
per-channel disabling.
|
||||
@@ -48,9 +48,6 @@ libdebug:
|
||||
bug: if -q is passed, Execution log doesn't contain libdebug log. (requires per-channel status control).
|
||||
|
||||
|
||||
OpenSuse Build Service:
|
||||
fails with error when tarball already contains the debian directory.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,12 @@ AC_DEFUN([APP_CHOOSE_GLD_READER], [
|
||||
# These requirements check compile-time presence, not that they were called
|
||||
AC_REQUIRE([AX_COMPILER_VENDOR])
|
||||
|
||||
AC_ARG_ENABLE(abort-if-no-glade-reader, AS_HELP_STRING([--disable-abort-if-no-glade-reader],
|
||||
[disable abort if no glade file reader is found (default: configure aborts when glade file reader is not found)]),
|
||||
[app_cv_abort_if_no_glade_reader=${enableval}], [app_cv_abort_if_no_glade_reader=yes])
|
||||
|
||||
AC_MSG_NOTICE([Abort if no glade file reader is found: $app_cv_abort_if_no_glade_reader])
|
||||
|
||||
# This is just in case
|
||||
# PKG_PROG_PKG_CONFIG()
|
||||
|
||||
@@ -91,7 +97,13 @@ AC_DEFUN([APP_CHOOSE_GLD_READER], [
|
||||
|
||||
# still not found.
|
||||
if test "$app_cv_gld_reader" = "none"; then
|
||||
AC_MSG_WARN([Neither GtkBuilder nor $app_cv_gld_reader_libglade_name found. The program will be unable to compile fully.])
|
||||
if test "x$app_cv_abort_if_no_glade_reader" = "xno"; then
|
||||
AC_MSG_WARN([$LIBGLADE_PKG_ERRORS])
|
||||
AC_MSG_WARN([Neither GtkBuilder nor $app_cv_gld_reader_libglade_name found. The program will be unable to compile fully.])
|
||||
else
|
||||
AC_MSG_WARN([Neither GtkBuilder nor $app_cv_gld_reader_libglade_name found.])
|
||||
AC_MSG_ERROR([$LIBGLADE_PKG_ERRORS])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -53,13 +53,10 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|
||||
if test "x$app_cv_target_os_env" = "xmingw" || test "x$app_cv_target_os_env" = "xcygwin"; then
|
||||
# mingw gcc options:
|
||||
# -mno-cygwin - generate non-cygwin executables in cygwin's mingw.
|
||||
# -mwindows - hide console window. possibly suppresses any std output / error.
|
||||
# -mconsole - opposite of -mwindows, default.
|
||||
# -mms-bitfields - make structures compatible with msvc. recommended default for non-cygwin.
|
||||
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -mms-bitfields -mwindows"
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -mms-bitfields -mwindows"
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -mms-bitfields -mwindows"
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -mms-bitfields"
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -mms-bitfields"
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -mms-bitfields"
|
||||
fi
|
||||
|
||||
# Note: Disabled -Wconversion, it was causing lots of silly warnings under x86-64.
|
||||
@@ -119,13 +116,6 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|
||||
|
||||
# gcc, mingw
|
||||
if test "x$app_cv_compiler_debug_options" = "xgnu"; then
|
||||
if test "x$app_cv_target_os_env" = "xmingw" || test "x$app_cv_target_os_env" = "xcygwin"; then
|
||||
# Enable console window for debug builds
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -mconsole"
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -mconsole"
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -mconsole"
|
||||
fi
|
||||
|
||||
# We could put libstdc++ debug options here, but it generates binary-incompatible
|
||||
# C++ code, which leads to runtime errors with e.g. libsigc++.
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -g3 -O0";
|
||||
@@ -175,7 +165,7 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|
||||
# gcc, mingw
|
||||
if test "x$app_cv_compiler_optimize_options" = "xgnu"; then
|
||||
# -mtune=generic is since gcc 4.0 iirc
|
||||
if test "$app_cv_target_os_env" = "mingw" || test "$app_cv_target_os_env" = "cygwin"; then
|
||||
if test "x$app_cv_target_os_env" = "xmingw" || test "x$app_cv_target_os_env" = "xcygwin"; then
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -g0 -O3 -s -march=i586";
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -g0 -O3 -s -march=i586";
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -g0 -O3 -s -march=i586";
|
||||
@@ -222,6 +212,41 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|
||||
|
||||
|
||||
|
||||
# ---- Compiler options for Mingw's mwindows/mconsole
|
||||
|
||||
# -mwindows - hide console window. possibly suppresses any std output / error.
|
||||
# -mconsole - opposite of -mwindows, default.
|
||||
|
||||
AC_ARG_ENABLE(windows-console, AS_HELP_STRING([--enable-windows-console=yes|no|auto],
|
||||
[enable windows console (MinGW only). Accepted values are yes, no, auto. ]
|
||||
[Auto means disabled for optimized builds, enabled for all others. (Default: auto)]),
|
||||
[app_cv_compiler_windows_console=${enableval}], [app_cv_compiler_windows_console=auto])
|
||||
|
||||
if test "x$app_cv_compiler_windows_console" = "xauto"; then
|
||||
# disable console for optimized builds.
|
||||
if test "x$app_cv_compiler_optimize_options" != "xnone"; then
|
||||
app_cv_compiler_windows_console="no";
|
||||
else
|
||||
app_cv_compiler_windows_console="yes";
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$app_cv_target_os_env" = "xmingw" || test "x$app_cv_target_os_env" = "xcygwin"; then
|
||||
if test "x$app_cv_compiler_windows_console" = "xno"; then
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -mwindows";
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -mwindows";
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -mwindows";
|
||||
else
|
||||
# specify -mconsole even if it's the default - it should override the user-supplied setting
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -mconsole";
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -mconsole";
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -mconsole";
|
||||
fi
|
||||
AC_MSG_NOTICE([Enable windows console: $app_cv_compiler_windows_console])
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# ---- Export our variables
|
||||
|
||||
if test "x$$1[]CFLAGS" = "x"; then
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
AC_INIT([GSmartControl], 0.8.2, [], [gsmartcontrol])
|
||||
AC_INIT([GSmartControl], 0.8.3, [], [gsmartcontrol])
|
||||
|
||||
AC_CONFIG_SRCDIR([configure.ac])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
@@ -52,6 +52,7 @@ AX_COMPILER_VENDOR
|
||||
# (also define automake conditionals).
|
||||
APP_DETECT_OS_KERNEL([target], [CONFIG_KERNEL_])
|
||||
APP_DETECT_OS_ENV([target], [CONFIG_OS_ENV_])
|
||||
APP_DETECT_OS_KERNEL([build], [CONFIG_HOST_KERNEL_])
|
||||
|
||||
# Detect common (warning, debug, optimize) compiler flags and
|
||||
# export them to C(XX)FLAGS, LDFLAGS.
|
||||
@@ -158,6 +159,12 @@ AM_CONDITIONAL([ENABLE_TESTS], [test "$with_tests" = "yes"])
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
AC_ARG_ENABLE(abort-if-no-gtkmm, AS_HELP_STRING([--disable-abort-if-no-gtkmm],
|
||||
[disable abort if no gtkmm is found (default: configure aborts when gtkmm is not found)]),
|
||||
[app_cv_abort_if_no_gtkmm=${enableval}], [app_cv_abort_if_no_gtkmm=yes])
|
||||
|
||||
AC_MSG_NOTICE([Abort if no gtkmm is found: $app_cv_abort_if_no_gtkmm])
|
||||
|
||||
# iconview is available since 2.6.0. gthread is not enabled by default.
|
||||
pkg_modules="gtkmm-2.4 >= 2.6.0 gthread-2.0 >= 2.0"
|
||||
|
||||
@@ -167,14 +174,16 @@ gtkmm_found="no"
|
||||
PKG_CHECK_MODULES([GTKMM], [$pkg_modules], [
|
||||
AC_DEFINE([ENABLE_GLIB], [1], [Whether GLib is installed])
|
||||
AC_DEFINE([ENABLE_GLIBMM], [1], [Whether GLibmm is installed])
|
||||
gtkmm_found="yes"
|
||||
], [
|
||||
gtkmm_found="yes"], [gtkmm_found="no"])
|
||||
|
||||
if test "x$gtkmm_found" = "xno"; then
|
||||
if test "x$app_cv_abort_if_no_gtkmm" = "xno"; then
|
||||
AC_MSG_WARN([$GTKMM_PKG_ERRORS])
|
||||
AC_MSG_WARN([The program will be unable to compile fully.])
|
||||
])
|
||||
|
||||
# use this instead of the above one to enable abort-on-not-found behaviour.
|
||||
# PKG_CHECK_MODULES([GTKMM], [$pkg_modules])
|
||||
else
|
||||
AC_MSG_ERROR([$GTKMM_PKG_ERRORS])
|
||||
fi
|
||||
fi
|
||||
|
||||
# GTK flags must be prepended, or glib_config.h conflict between
|
||||
# gtk 2.x and 1.2 may occur.
|
||||
@@ -228,36 +237,66 @@ LIBS="$LIBS $PCRE_LIBS"
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Test stuff here...
|
||||
# <nothing>
|
||||
|
||||
#SDL_VERSION=1.2.0
|
||||
#AM_PATH_SDL($SDL_VERSION, :,
|
||||
# AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) )
|
||||
#CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
#CXXFLAGS="$CXXFLAGS $SDL_CFLAGS "
|
||||
#LIBS="$LIBS $SDL_LIBS"
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Win32 distribution support (NSIS, zip)
|
||||
|
||||
AC_ARG_WITH([nsis], [AS_HELP_STRING([--with-nsis],
|
||||
AC_ARG_WITH([nsis], [AS_HELP_STRING([--with-nsis=<location>|auto],
|
||||
[specify makensis.exe location to support making NSIS packages]
|
||||
[ (default: ~/".wine/drive_c/Program Files/NSIS/makensis.exe")])],
|
||||
[ (default: "C:\Program Files\NSIS\makensis.exe" for windows, ]
|
||||
["~/.wine/drive_c/Program Files/NSIS/makensis.exe" for others)])],
|
||||
[with_nsis=${withval}], [with_nsis=auto])
|
||||
|
||||
AC_ARG_ENABLE([nsis-wine], [AS_HELP_STRING([--enable-nsis-wine],
|
||||
[use wine to run makensis.exe when making NSIS packages (default: yes)])],
|
||||
AC_ARG_ENABLE([nsis-wine], [AS_HELP_STRING([--enable-nsis-wine=yes|no|auto],
|
||||
[use wine to run makensis.exe when making NSIS packages (default: auto, which is no for windows, yes for others)])],
|
||||
[with_nsis_wine=${enableval}], [with_nsis_wine=yes])
|
||||
|
||||
AC_ARG_WITH([win32-env], [AS_HELP_STRING([--with-win32-env],
|
||||
[specify location of win32 dlls when making win32 packages (default: /target/bin)])],
|
||||
[with_win32_env=${withval}], [win_win32_env=auto])
|
||||
AC_ARG_WITH([windows-dlls], [AS_HELP_STRING([--with-windows-dlls],
|
||||
[specify location of Windows dlls when making Windows packages (default: /target/bin)])],
|
||||
[with_windows_env=${withval}], [win_windows_dlls=auto])
|
||||
|
||||
if test "x$with_nsis" = "xauto" || test "x$with_nsis" = "x"; then
|
||||
with_nsis="~/\".wine/drive_c/Program Files/NSIS/makensis.exe\""
|
||||
if test "x$app_cv_build_os_kernel" = "xwindows"; then
|
||||
with_nsis="~/\".wine/drive_c/Program Files/NSIS/makensis.exe\"";
|
||||
else
|
||||
with_nsis="\"C:\\Program Files\\NSIS\\makensis.exe\"";
|
||||
fi
|
||||
fi
|
||||
if test "x$with_win32_env" = "xauto" || test "x$with_win32_env" = "x"; then
|
||||
with_win32_env="/target/bin"
|
||||
|
||||
if test "x$with_nsis_wine" = "xauto"; then
|
||||
if test "x$app_cv_build_os_kernel" = "xwindows"; then
|
||||
with_nsis_wine="no";
|
||||
else
|
||||
with_nsis_wine="yes";
|
||||
fi
|
||||
fi
|
||||
|
||||
NSIS_EXEC="$with_nsis";
|
||||
if test "x$with_nsis_wine" != "xno"; then
|
||||
NSIS_EXEC="wine $with_nsis";
|
||||
fi
|
||||
WIN32_ENV="$with_win32_env";
|
||||
|
||||
if test "x$with_windows_dlls" = "xauto" || test "x$with_windows_dlls" = "x"; then
|
||||
with_windows_dlls="/target/bin"
|
||||
fi
|
||||
WINDOWS_DLLS_LOCATION="$with_windows_dlls";
|
||||
|
||||
AC_SUBST(NSIS_EXEC)
|
||||
AC_SUBST(WIN32_ENV)
|
||||
AC_SUBST(WINDOWS_DLLS_LOCATION)
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
This directory contains scripts and an example crontab to allow GSmartControl
|
||||
to read smartctl data from cron-generated files. This allows users to read
|
||||
somewhat recent smartctl information without having to run GSmartControl as
|
||||
root.
|
||||
|
||||
Put the scripts into /usr/local/bin, run GSmartControl and set smartctl path
|
||||
to "/usr/local/bin/smartctl_subst.sh" (without quotes). An example crontab
|
||||
runs cron_gather_smart.sh script every 10 minutes, storing its output to
|
||||
"/var/run/smart-$devname". The smartctl_subst.sh script prints the contents of
|
||||
this file instead of running smartctl, thus eliminating the need to run
|
||||
GSmartControl as root when reading SMART values.
|
||||
|
||||
Note: These scripts provide read-only capabilities only, they don't allow
|
||||
changing SMART settings or running self-tests.
|
||||
|
||||
Contributed by Alex Butcher <alex dot butcher 'at' assursys.co.uk>.
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_whatever.txt file
|
||||
############################################################################
|
||||
|
||||
device="$1";
|
||||
|
||||
if [ "$device" = "" ]; then
|
||||
echo "Usage: $0 <device>"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
dev_base="`basename \"$device\"`"
|
||||
out_file=/var/run/smart-"$dev_base"
|
||||
|
||||
# Change the path to smartctl if necessary.
|
||||
smartctl -a "$device" 2>&1 > "$out_file"
|
||||
|
||||
chmod 644 "$out_file"
|
||||
@@ -0,0 +1,2 @@
|
||||
*/10 * * * * root /usr/local/bin/cron-smart.sh /dev/sda
|
||||
*/10 * * * * root /usr/local/bin/cron-smart.sh /dev/sdb
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_whatever.txt file
|
||||
############################################################################
|
||||
|
||||
if [ "$1" = "-V" ]; then
|
||||
smartctl -V 2>&1
|
||||
exit
|
||||
fi
|
||||
|
||||
while [ $# -ge 1 ]; do
|
||||
device="$1"
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$device" = "" ]; then
|
||||
echo "Usage: $0 <device>"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
dev_base="`basename \"$device\"`"
|
||||
out_file=/var/run/smart-"$dev_base"
|
||||
|
||||
cat "$out_file"
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
@@ -1,6 +1,8 @@
|
||||
|
||||
SUBDIRS = 16 22 24 32 48 64 128 256 nsis
|
||||
|
||||
# This command is needed if installing with make install (the cache
|
||||
# file is ignored for rpms).
|
||||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
|
||||
|
||||
install-data-hook: update-icon-cache
|
||||
|
Before Width: | Height: | Size: 165 KiB After Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
@@ -0,0 +1,6 @@
|
||||
|
||||
noinst_DATA = changelog.in compat control copyright menu postinst postrm rules
|
||||
|
||||
# include the generated file too
|
||||
EXTRA_DIST=changelog.in changelog compat control copyright menu postinst \
|
||||
postrm rules
|
||||
@@ -22,7 +22,7 @@
|
||||
<kdevautoproject>
|
||||
<general>
|
||||
<activetarget>src/gsmartcontrol</activetarget>
|
||||
<useconfiguration>debuggy</useconfiguration>
|
||||
<useconfiguration>win32</useconfiguration>
|
||||
</general>
|
||||
<run>
|
||||
<mainprogram>/10/devel/projects/gsmartcontrol/current/gsmartcontrol/debuggy</mainprogram>
|
||||
@@ -111,7 +111,7 @@
|
||||
</icc>
|
||||
<win32>
|
||||
<envvars/>
|
||||
<configargs>--disable-user-flags --enable-optimize-options --enable-tests --target=i386-mingw32msvc --host=i386-mingw32msvc --build=i686-linux PKG_CONFIG_PATH=/target/lib/pkgconfig PKG_CONFIG_LIBDIR=/target/lib PATH="/opt/cross-tools/bin:/target/bin:$PATH"</configargs>
|
||||
<configargs>--disable-user-flags --enable-optimize-options --enable-tests --target=i386-mingw32 --host=i386-mingw32 --build=i686-linux PKG_CONFIG_PATH=/target/lib/pkgconfig PKG_CONFIG_LIBDIR=/target/lib PATH="/opt/cross-tools/bin:/target/bin:$PATH"</configargs>
|
||||
<builddir>win32</builddir>
|
||||
<topsourcedir/>
|
||||
<cppflags/>
|
||||
@@ -119,8 +119,8 @@
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<ccompilerbinary>i386-mingw32msvc-gcc</ccompilerbinary>
|
||||
<cxxcompilerbinary>i386-mingw32msvc-g++</cxxcompilerbinary>
|
||||
<ccompilerbinary>i386-mingw32-gcc</ccompilerbinary>
|
||||
<cxxcompilerbinary>i386-mingw32-g++</cxxcompilerbinary>
|
||||
<f77compilerbinary/>
|
||||
<cflags/>
|
||||
<cxxflags/>
|
||||
@@ -164,7 +164,7 @@
|
||||
</portland>
|
||||
<win32-debug>
|
||||
<envvars/>
|
||||
<configargs>--disable-user-flags --enable-debug-options --enable-tests --target=i386-mingw32msvc --host=i386-mingw32msvc --build=i686-linux PKG_CONFIG_PATH=/target/lib/pkgconfig PKG_CONFIG_LIBDIR=/target/lib PATH="/opt/cross-tools/bin:/target/bin:$PATH"</configargs>
|
||||
<configargs>--disable-user-flags --enable-debug-options --enable-tests --target=i386-mingw32 --host=i386-mingw32 --build=i686-linux PKG_CONFIG_PATH=/target/lib/pkgconfig PKG_CONFIG_LIBDIR=/target/lib PATH="/opt/cross-tools/bin:/target/bin:$PATH"</configargs>
|
||||
<builddir>win32-debug</builddir>
|
||||
<topsourcedir/>
|
||||
<cppflags/>
|
||||
@@ -172,8 +172,8 @@
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<ccompilerbinary>i386-mingw32msvc-gcc</ccompilerbinary>
|
||||
<cxxcompilerbinary>i386-mingw32msvc-g++</cxxcompilerbinary>
|
||||
<ccompilerbinary>i386-mingw32-gcc</ccompilerbinary>
|
||||
<cxxcompilerbinary>i386-mingw32-g++</cxxcompilerbinary>
|
||||
<f77compilerbinary/>
|
||||
<cflags/>
|
||||
<cxxflags/>
|
||||
@@ -60,7 +60,8 @@ BuildRequires: gcc-c++, pcre-devel, gtkmm24-devel >= 2.6.0, libglademm24-devel >
|
||||
%endif
|
||||
|
||||
|
||||
# Mandriva
|
||||
# Mandriva. Check the latest official spec file at
|
||||
# http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/gsmartcontrol/current/
|
||||
%if 0%{?mandriva_version}
|
||||
|
||||
%if 0%{?mandriva_version} >= 2008
|
||||
@@ -101,6 +102,9 @@ make -j$numprocs
|
||||
%install
|
||||
# %makeinstall
|
||||
make DESTDIR=%buildroot install-strip
|
||||
# Remove the icon cache file "make install" generates, to avoid package conflicts.
|
||||
rm -f $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/icon-theme.cache
|
||||
|
||||
|
||||
%if 0%{?mandriva_version}
|
||||
desktop-file-install --vendor="" \
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
noinst_DATA = changelog.in compat control copyright docs menu postinst \
|
||||
postrm rules
|
||||
|
||||
# include the generated file too
|
||||
EXTRA_DIST=changelog.in changelog compat control copyright docs menu postinst \
|
||||
postrm rules
|
||||
@@ -1,5 +0,0 @@
|
||||
gsmartcontrol (0.8.2+nmu1) unstable; urgency=low
|
||||
|
||||
* Permanently Initial Release.
|
||||
|
||||
-- Alexander Shaduri <ashaduriREMOVETHIS@gmail.com> Sat, 15 Nov 2008 00:12:04 +0400
|
||||
@@ -1,12 +0,0 @@
|
||||
AUTHORS.txt
|
||||
LICENSE_boost_1_0.txt
|
||||
LICENSE_bsd-ucb.txt
|
||||
LICENSE_gpl2.txt
|
||||
LICENSE_gpl3.txt
|
||||
LICENSE_gsmartcontrol.txt
|
||||
LICENSE_hz.txt
|
||||
LICENSE_pcrecpp.txt
|
||||
LICENSE_whatever.txt
|
||||
LICENSE_zlib.txt
|
||||
NEWS
|
||||
README.txt
|
||||
@@ -1,130 +0,0 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2006 Applied Informatics Software Engineering GmbH
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_boost_1_0.txt file
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HZ_BUFFER_H
|
||||
#define HZ_BUFFER_H
|
||||
|
||||
#include "hz_config.h" // feature macros
|
||||
|
||||
#include <cstddef> // std::size_t
|
||||
#include <stdexcept> // std::out_of_range
|
||||
|
||||
// Don't use DBG_ASSERT() here, it's too error-prone to use in this context.
|
||||
#include <cassert>
|
||||
#ifndef ASSERT // assert() is undefined if NDEBUG is defined.
|
||||
#define ASSERT(a) assert(a)
|
||||
#endif
|
||||
|
||||
#include "exceptions.h" // THROW_FATAL
|
||||
|
||||
|
||||
// This library is heavily based on Poco::Buffer class from poco
|
||||
// library.
|
||||
|
||||
|
||||
namespace hz {
|
||||
|
||||
|
||||
|
||||
// Buffer - a simple scoped buffer.
|
||||
|
||||
// Note: Constructing Buffer is not exception-safe!
|
||||
|
||||
|
||||
template<typename T>
|
||||
class Buffer {
|
||||
public:
|
||||
|
||||
Buffer(std::size_t size) : size_(size), ptr_(new T[size])
|
||||
{ }
|
||||
|
||||
~Buffer()
|
||||
{
|
||||
delete[] ptr_;
|
||||
ptr_ = 0; // exception-safety (needed here?)
|
||||
}
|
||||
|
||||
|
||||
std::size_t size() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
|
||||
T* begin()
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
const T* begin() const
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
|
||||
// Do NOT dereference the returned value!
|
||||
T* end()
|
||||
{
|
||||
return ptr_ + size_;
|
||||
}
|
||||
|
||||
// Do NOT dereference the returned value!
|
||||
const T* end() const
|
||||
{
|
||||
return ptr_ + size_;
|
||||
}
|
||||
|
||||
|
||||
T& operator[] (std::size_t index)
|
||||
{
|
||||
ASSERT(index >= 0 && index < size_);
|
||||
return ptr_[index];
|
||||
}
|
||||
|
||||
const T& operator[] (std::size_t index) const
|
||||
{
|
||||
ASSERT(index >= 0 && index < size_);
|
||||
return ptr_[index];
|
||||
}
|
||||
|
||||
|
||||
T& at(std::size_t index)
|
||||
{
|
||||
if (!(index >= 0 && index < size_))
|
||||
THROW_FATAL(std::out_of_range("Buffer::at(): Out of range."));
|
||||
return ptr_[index];
|
||||
}
|
||||
|
||||
const T& at(std::size_t index) const
|
||||
{
|
||||
if (!(index >= 0 && index < size_))
|
||||
THROW_FATAL(std::out_of_range("Buffer::at(): Out of range."));
|
||||
return ptr_[index];
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Buffer(const Buffer&); // not implemented
|
||||
|
||||
Buffer& operator= (const Buffer&); // not implemented
|
||||
|
||||
std::size_t size_;
|
||||
|
||||
T* ptr_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
} // ns
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -26,7 +26,13 @@
|
||||
|
||||
inline pcrecpp::RE_Options app_pcre_get_options(const char* modifiers)
|
||||
{
|
||||
// ANYCRLF means any of crlf, cr, lf. Used in ^ and $.
|
||||
// This overrides the build-time newline setting of pcre.
|
||||
#ifdef PCRE_NEWLINE_ANYCRLF
|
||||
pcrecpp::RE_Options options(PCRE_NEWLINE_ANYCRLF);
|
||||
#else
|
||||
pcrecpp::RE_Options options;
|
||||
#endif
|
||||
|
||||
if (modifiers) {
|
||||
char c = '\0';
|
||||
@@ -58,6 +64,8 @@ inline pcrecpp::RE_Options app_pcre_get_options(const char* modifiers)
|
||||
// Note: Slashes should be escaped within the pattern.
|
||||
// If the string doesn't start with a slash, it is treated as an ordinary pattern
|
||||
// without modifiers.
|
||||
// This function will make a RE object with ANYCRLF option set for portability
|
||||
// across various pcre builds.
|
||||
inline pcrecpp::RE app_pcre_re(const std::string& perl_pattern)
|
||||
{
|
||||
if (perl_pattern.size() >= 2 && perl_pattern[0] == '/') {
|
||||
@@ -71,7 +79,7 @@ inline pcrecpp::RE app_pcre_re(const std::string& perl_pattern)
|
||||
app_pcre_get_options(perl_pattern.substr(endpos + 1).c_str()));
|
||||
}
|
||||
|
||||
return pcrecpp::RE(perl_pattern);
|
||||
return pcrecpp::RE(perl_pattern, app_pcre_get_options(0));
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,8 @@
|
||||
inline bool app_ui_res_create_from(app_ui_res_ref_t& ref,
|
||||
const unsigned char* buf, unsigned int buf_size, std::string& error_msg)
|
||||
{
|
||||
error_msg = "Neither Gtk::Builder (gtkmm >= 2.12) nor libglademm were present during compilation."
|
||||
" Recompile when either dependency is resolved.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
#include "hz/tls_policy_glib.h"
|
||||
#include "hz/debug.h"
|
||||
#include "hz/string_num.h" // hz::number_to_string()
|
||||
#include "hz/env_tools.h" // hz::ScopedEnv
|
||||
#include "hz/scoped_ptr.h"
|
||||
|
||||
#include "cmdex.h"
|
||||
|
||||
|
||||
|
||||
using hz::Error;
|
||||
using hz::ErrorLevel;
|
||||
|
||||
@@ -115,38 +116,36 @@ bool Cmdex::execute()
|
||||
|
||||
// Make command vector
|
||||
|
||||
int argcp = 0; // number of args
|
||||
gchar** argvp = 0; // args vector
|
||||
GError* shell_error = 0;
|
||||
if (!g_shell_parse_argv(cmd.c_str(), &argcp, &argvp, &shell_error)) {
|
||||
push_error(Error<void>("gshell", ErrorLevel::error, shell_error->message), false);
|
||||
g_error_free(shell_error);
|
||||
hz::scoped_ptr<gchar*> argvp(0, g_strfreev); // args vector
|
||||
|
||||
g_strfreev(argvp);
|
||||
return false;
|
||||
{
|
||||
int argcp = 0; // number of args
|
||||
hz::scoped_ptr<GError> shell_error(0, g_error_free);
|
||||
if (!g_shell_parse_argv(cmd.c_str(), &argcp, &argvp.get_ref(), &shell_error.get_ref())) {
|
||||
push_error(Error<void>("gshell", ErrorLevel::error, shell_error->message), false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Set the locale for a child to Classic - otherwise it may mangle the output.
|
||||
// LANG is posix-only, so it has no effect on win32.
|
||||
// Unfortunately, I was unable to find a way to execute a child with a different
|
||||
// locale in win32. Locale seems to be non-inheritable, so setting it here won't help.
|
||||
#ifndef _WIN32
|
||||
// TODO: make this controllable.
|
||||
const gchar* old_lang_gchar = g_getenv("LANG");
|
||||
bool old_lang_set = (old_lang_gchar);
|
||||
std::string old_lang = (old_lang_gchar ? old_lang_gchar : "");
|
||||
if (old_lang_set)
|
||||
g_setenv("LANG", "C", true);
|
||||
#endif
|
||||
bool change_lang = true;
|
||||
#ifdef _WIN32
|
||||
// LANG is posix-only, so it has no effect on win32.
|
||||
// Unfortunately, I was unable to find a way to execute a child with a different
|
||||
// locale in win32. Locale seems to be non-inheritable, so setting it here won't help.
|
||||
change_lang = false;
|
||||
#endif
|
||||
|
||||
hz::ScopedEnv lang_env("LANG", "C", change_lang);
|
||||
|
||||
|
||||
debug_out_info("app", DBG_FUNC_MSG << "Executing \"" << cmd << "\".\n");
|
||||
|
||||
if (argvp) {
|
||||
debug_out_dump("app", DBG_FUNC_MSG << "Dumping argvp:\n");
|
||||
gchar** elem = argvp;
|
||||
gchar** elem = argvp.get();
|
||||
while (*elem) {
|
||||
debug_out_dump("app", *elem << "\n");
|
||||
++elem;
|
||||
@@ -156,46 +155,62 @@ bool Cmdex::execute()
|
||||
|
||||
// Execute the command
|
||||
|
||||
gchar* curr_dir = g_get_current_dir();
|
||||
GError* spawn_error = 0;
|
||||
hz::scoped_ptr<gchar> curr_dir(g_get_current_dir(), g_free);
|
||||
hz::scoped_ptr<GError> spawn_error(0, g_error_free);
|
||||
|
||||
if (!g_spawn_async_with_pipes(curr_dir, argvp, NULL,
|
||||
GSpawnFlags(G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD),
|
||||
NULL, NULL, // child setup function
|
||||
&this->pid_, 0, &fd_stdout_, &fd_stderr_, &spawn_error)) {
|
||||
/*
|
||||
#ifdef APP_CMDEX_USE_SYNC
|
||||
|
||||
push_error(Error<void>("gspawn", ErrorLevel::error, spawn_error->message), false);
|
||||
g_error_free(spawn_error);
|
||||
|
||||
g_free(curr_dir);
|
||||
g_strfreev(argvp);
|
||||
|
||||
#ifndef _WIN32
|
||||
if (old_lang_set)
|
||||
g_setenv("LANG", old_lang.c_str(), true);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
g_free(curr_dir);
|
||||
g_strfreev(argvp);
|
||||
|
||||
#ifndef _WIN32
|
||||
if (old_lang_set)
|
||||
g_setenv("LANG", old_lang.c_str(), true);
|
||||
#endif
|
||||
hz::scoped_ptr<gchar*> stdout_str(0, g_free);
|
||||
hz::scoped_ptr<gchar*> stderr_str(0, g_free);
|
||||
gint exit_status = 0;
|
||||
|
||||
g_timer_start(timer_); // start the timer
|
||||
|
||||
if (!g_spawn_sync(curr_dir.get(), argvp.get(), NULL,
|
||||
GSpawnFlags(G_SPAWN_SEARCH_PATH),
|
||||
NULL, NULL, // child setup function
|
||||
&stdout_str.get_ref(), &stderr_str.get_ref(), &exit_status, &spawn_error.get_ref()))
|
||||
{
|
||||
// no data is returned to &-parameters on error.
|
||||
push_error(Error<void>("gspawn", ErrorLevel::error, spawn_error->message), false);
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
channel_stdout_ = g_io_channel_win32_new_fd(fd_stdout_);
|
||||
channel_stderr_ = g_io_channel_win32_new_fd(fd_stderr_);
|
||||
#else
|
||||
channel_stdout_ = g_io_channel_unix_new(fd_stdout_);
|
||||
channel_stderr_ = g_io_channel_unix_new(fd_stderr_);
|
||||
#endif
|
||||
#else // async way:
|
||||
*/
|
||||
if (!g_spawn_async_with_pipes(curr_dir.get(), argvp.get(), NULL,
|
||||
GSpawnFlags(G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD),
|
||||
NULL, NULL, // child setup function
|
||||
&this->pid_, 0, &fd_stdout_, &fd_stderr_, &spawn_error.get_ref()))
|
||||
{
|
||||
// no data is returned to &-parameters on error.
|
||||
push_error(Error<void>("gspawn", ErrorLevel::error, spawn_error->message), false);
|
||||
return false;
|
||||
}
|
||||
|
||||
g_timer_start(timer_); // start the timer
|
||||
|
||||
// #endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
// Without this timeout the program randomly says that the child's output
|
||||
// is empty (happens only in windows). Sounds like a race condition, but
|
||||
// doesn't seem like it's in my code (all other platforms are ok).
|
||||
// Note: Testing is really hard when moving this around - the error might
|
||||
// occur once in 200 runs.
|
||||
// g_usleep(50*1000); // 50 msec.
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
channel_stdout_ = g_io_channel_win32_new_fd(fd_stdout_);
|
||||
channel_stderr_ = g_io_channel_win32_new_fd(fd_stderr_);
|
||||
#else
|
||||
channel_stdout_ = g_io_channel_unix_new(fd_stdout_);
|
||||
channel_stderr_ = g_io_channel_unix_new(fd_stderr_);
|
||||
#endif
|
||||
|
||||
// The internal encoding is always UTF8. To read command output correctly, use
|
||||
// "" for binary data, or set io encoding to current locale.
|
||||
@@ -258,7 +273,6 @@ bool Cmdex::execute()
|
||||
g_child_watch_add(this->pid_, &cmdex_child_watch_handler, this);
|
||||
|
||||
|
||||
|
||||
this->running_ = true; // process is running now.
|
||||
// actually, it may be already stopped, but the watcher function is blocked
|
||||
// until we exit, so the actions are serialized.
|
||||
@@ -479,9 +493,9 @@ gboolean Cmdex::on_channel_io_as_available(GIOChannel* source,
|
||||
|
||||
// while there's anything to read, read it
|
||||
do {
|
||||
GError* channel_error = 0;
|
||||
hz::scoped_ptr<GError> channel_error(0, g_error_free);
|
||||
gsize bytes_read = 0;
|
||||
GIOStatus status = g_io_channel_read_chars(channel, buf, count, &bytes_read, &channel_error);
|
||||
GIOStatus status = g_io_channel_read_chars(channel, buf, count, &bytes_read, &channel_error.get_ref());
|
||||
if (bytes_read)
|
||||
output_str->append(buf, bytes_read);
|
||||
|
||||
@@ -497,6 +511,7 @@ gboolean Cmdex::on_channel_io_as_available(GIOChannel* source,
|
||||
}
|
||||
} while (g_io_channel_get_buffer_condition(channel) & G_IO_IN);
|
||||
|
||||
// DBG_FUNCTION_EXIT_MSG;
|
||||
|
||||
// false if the source should be removed, true otherwise.
|
||||
return continue_events;
|
||||
@@ -559,9 +574,9 @@ gboolean Cmdex::on_channel_io_buffered(GIOChannel* source,
|
||||
|
||||
// while there's anything to read, read it
|
||||
do {
|
||||
GError* channel_error = 0;
|
||||
hz::scoped_ptr<GError> channel_error(0, g_error_free);
|
||||
gsize bytes_read = 0;
|
||||
GIOStatus status = g_io_channel_read_chars(source, buf, count, &bytes_read, &channel_error);
|
||||
GIOStatus status = g_io_channel_read_chars(source, buf, count, &bytes_read, &channel_error.get_ref());
|
||||
if (bytes_read)
|
||||
s_final_str->append(buf, bytes_read);
|
||||
|
||||
@@ -32,19 +32,22 @@ from the _main_ thread.
|
||||
|
||||
|
||||
|
||||
// typedef hz::SyncPolicyGlib CmdexSyncPolicy;
|
||||
typedef hz::SyncPolicyMtDefault CmdexSyncPolicy;
|
||||
|
||||
|
||||
|
||||
// inheriting from sigc::trackable automatically disconnects this class's
|
||||
// slots upon destruction.
|
||||
class Cmdex : public hz::ErrorHolder<hz::SyncPolicyGlib> {
|
||||
class Cmdex : public hz::ErrorHolder<CmdexSyncPolicy> {
|
||||
|
||||
public:
|
||||
|
||||
using hz::ErrorHolder<hz::SyncPolicyGlib>::ptr_error_list_t; // auto-deleting container
|
||||
using hz::ErrorHolder<hz::SyncPolicyGlib>::error_list_t;
|
||||
using hz::ErrorHolder<CmdexSyncPolicy>::ptr_error_list_t; // auto-deleting container
|
||||
using hz::ErrorHolder<CmdexSyncPolicy>::error_list_t;
|
||||
|
||||
typedef hz::ErrorHolder<hz::SyncPolicyGlib>::ErrorScopedLock ScopedLock;
|
||||
typedef hz::ErrorHolder<hz::SyncPolicyGlib>::ErrorLockPolicy LockPolicy;
|
||||
typedef hz::ErrorHolder<CmdexSyncPolicy>::ErrorScopedLock ScopedLock;
|
||||
typedef hz::ErrorHolder<CmdexSyncPolicy>::ErrorLockPolicy LockPolicy;
|
||||
|
||||
typedef std::string (*exit_status_translator_func_t)(int, void*);
|
||||
typedef void (*exited_callback_func_t)(void*);
|
||||
@@ -62,7 +65,9 @@ class Cmdex : public hz::ErrorHolder<hz::SyncPolicyGlib> {
|
||||
fd_stdout_(0), fd_stderr_(0), channel_stdout_(0), channel_stderr_(0),
|
||||
channel_stdout_buffer_size_(100 * 1024), channel_stderr_buffer_size_(10 * 1024), // 100K and 10K
|
||||
event_source_id_stdout_(0), event_source_id_stderr_(0),
|
||||
stdout_make_str_as_available_(false), stderr_make_str_as_available_(true),
|
||||
// Don't set false here (in any of these) - there's a bug in windows which causes
|
||||
// output to be completely swallowed at random times.
|
||||
stdout_make_str_as_available_(true), stderr_make_str_as_available_(true),
|
||||
translator_func_(0), translator_func_data_(0),
|
||||
exited_callback_(exited_cb), exited_callback_data_(exited_cb_data)
|
||||
{ }
|
||||