mirror of
https://github.com/ashaduri/gsmartcontrol.git
synced 2026-09-28 22:55:33 +00:00
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.
112 lines
2.8 KiB
Bash
112 lines
2.8 KiB
Bash
#!/bin/bash
|
|
############################################################################
|
|
# Copyright:
|
|
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
|
# License: See LICENSE_zlib.txt file
|
|
############################################################################
|
|
|
|
# Run gsmartcontrol with root, asking for root password first.
|
|
|
|
EXEC_BIN="@prefix@/bin/gsmartcontrol";
|
|
prog_name="gsmartcontrol"
|
|
|
|
DESKTOP="$1";
|
|
|
|
# This works for --help too
|
|
if [ "$DESKTOP" = "" ]; then
|
|
DESKTOP="auto"; # default
|
|
|
|
elif [ "$DESKTOP" != "auto" ] && [ "$DESKTOP" != "kde" ] && \
|
|
[ "$DESKTOP" != "gnome" ] && [ "$DESKTOP" != "other" ]; then
|
|
echo "Usage: $0 [<auto|kde|gnome|other> [<${prog_name}_options>] ]";
|
|
exit 1;
|
|
fi
|
|
shift; # remove $1
|
|
|
|
|
|
# Auto-detect current desktop if auto was specified.
|
|
if [ "$DESKTOP" = "auto" ]; then
|
|
# KDE_SESSION_UID is present on kde3 and kde4.
|
|
# Note that it may be empty (but still set)
|
|
if [ "${KDE_SESSION_UID+set}" = "set" ]; then
|
|
DESKTOP="kde";
|
|
# same with gnome
|
|
elif [ "${GNOME_DESKTOP_SESSION_ID+set}" = "set" ]; then
|
|
DESKTOP="gnome";
|
|
else
|
|
DESKTOP="other";
|
|
fi
|
|
fi
|
|
|
|
# echo $DESKTOP;
|
|
|
|
|
|
# They're basically the same, only the order is different.
|
|
# sux requires xterm to ask for the password.
|
|
# xdg-su is basically like this script, except worse :)
|
|
gnome_sus="gnomesu gksu kdesu xdg-su sux";
|
|
kde_sus="kdesu gnomesu gksu xdg-su sux";
|
|
other_sus="$gnome_sus";
|
|
|
|
|
|
candidates="";
|
|
found_su=""
|
|
|
|
if [ "$DESKTOP" = "gnome" ]; then
|
|
candidates="$gnome_sus";
|
|
elif [ "$DESKTOP" = "kde" ]; then
|
|
candidates="$kde_sus";
|
|
elif [ "$DESKTOP" = "other" ]; then
|
|
candidates="$other_sus";
|
|
fi
|
|
|
|
for subin in $candidates; do
|
|
which $subin &>/dev/null
|
|
if [ $? -eq 0 ]; then
|
|
found_su="$subin";
|
|
break;
|
|
fi
|
|
done
|
|
|
|
if [ "$found_su" = "" ]; then
|
|
xmessage "Error launching ${prog_name}: No suitable su mechanism found.
|
|
Try installing kdesu, gnomesu, gksu or sux first.";
|
|
exit 1;
|
|
fi
|
|
|
|
|
|
# gnomesu and gksu (but not kdesu, not sure about others) fail to adopt
|
|
# root's PATH. Since the user's PATH may not contain /usr/sbin (with smartctl)
|
|
# on some distributions (e.g. mandriva), add it manually. We also add
|
|
# /usr/local/sbin, since that's the default location of custom-compiled smartctl.
|
|
# Add these directories _before_ existing PATH, so that the user is not
|
|
# tricked into running it from some other path (we're running as root with
|
|
# the user's env after all).
|
|
export PATH="/usr/sbin:/usr/local/sbin:$PATH"
|
|
|
|
|
|
# echo $found_su;
|
|
|
|
# Examples:
|
|
# gnomesu -c 'gsmartcontrol --no-scan'
|
|
# kdesu -c 'gsmartcontrol --no-scan'
|
|
# xterm -e sux -c 'gsmartcontrol --no-scan' # sux asks for password in a terminal
|
|
|
|
full_cmd=""
|
|
if [ "$found_su" = "sux" ]; then
|
|
full_cmd="xterm -e sux -c '$EXEC_BIN $@'"
|
|
|
|
elif [ "$found_su" = "gksu" ]; then
|
|
full_cmd="$found_su '$EXEC_BIN $@'"
|
|
|
|
else # gnomesu, kdesu, xdg-su
|
|
full_cmd="$found_su -c '$EXEC_BIN $@'"
|
|
fi
|
|
|
|
|
|
eval $full_cmd
|
|
|
|
|
|
|
|
|