martin f krafft a écrit :
Argh! sylpheed_claws and galeon weren't supposed to be included. But
are you using them? I am uneasy including them since it's too far
off hibernate's real job, but if people use them, why not?
To be honest I am not using them but the sylpheed_claws scriplet
inspired me for solving a problem I had with conky. Therefore I am using
the get_env_var_of_process function...
Maybe such scriplets could be located in a
/usr/share/doc/hibernate/contrib or /usr/share/doc/hibernate/examples
section?
Or in the sylpheed-claws and galeon packages themselves ?
Would you prepare a patch for me?
Sorry I should have started with it, please forgive my rudeness.
get_env_var_of_process has been moved to the "Helper functions" section
in the attached patch.
Best regards.
Pascal D.
diff -Naur hibernate-1.96~pre-svn.r1136/hibernate.sh hibernate-1.96~pre-svn.r1136.new/hibernate.sh
--- hibernate-1.96~pre-svn.r1136/hibernate.sh 2007-07-04 19:41:43.000000000 +0200
+++ hibernate-1.96~pre-svn.r1136.new/hibernate.sh 2007-07-14 20:12:06.000000000 +0200
@@ -810,6 +810,14 @@
SUSPEND_ABORT=1
}
+# Gets the value of the environment variable with the given name of the process with the given PID.
+get_env_var_of_process()
+{
+ local pid="$1" envvar="$2"
+
+ tr '\0' '\n' </proc/$pid/environ | sed -ne 's/^'"$envvar"'=\(.*\)$/\1/p'
+}
+
############################### MAIN #########################################
# Some starting values:
diff -Naur hibernate-1.96~pre-svn.r1136/scriptlets.d/gaim hibernate-1.96~pre-svn.r1136.new/scriptlets.d/gaim
--- hibernate-1.96~pre-svn.r1136/scriptlets.d/gaim 2007-07-09 22:44:07.000000000 +0200
+++ hibernate-1.96~pre-svn.r1136.new/scriptlets.d/gaim 2007-07-14 20:13:05.000000000 +0200
@@ -11,14 +11,6 @@
AddConfigHelp "GaimLogoutMessage <string>" "Status message to set when logging out Gaim."
AddConfigHelp "GaimLoginMessage <string>" "Status message to set when logging in Gaim."
-# Gets the value of the environment variable with the given name of the process with the given PID.
-get_env_var_of_process()
-{
- local pid="$1" envvar="$2"
-
- tr '\0' '\n' </proc/$pid/environ | sed -ne 's/^'"$envvar"'=\(.*\)$/\1/p'
-}
-
LogoutGaim()
{
[ x"$LOGOUT_GAIM" != "x1" ] && return 0
diff -Naur hibernate-1.96~pre-svn.r1136/scriptlets.d/galeon hibernate-1.96~pre-svn.r1136.new/scriptlets.d/galeon
--- hibernate-1.96~pre-svn.r1136/scriptlets.d/galeon 2007-07-14 20:03:32.000000000 +0200
+++ hibernate-1.96~pre-svn.r1136.new/scriptlets.d/galeon 2007-07-14 20:12:50.000000000 +0200
@@ -10,14 +10,6 @@
AddConfigHelp "GaleonOffline <boolean>" "Changes all locally running Galeon's status to offline before suspending, and (optionally) change it back to the original state after resuming."
AddConfigHelp "GaleonRestoreStatus <boolean>" "Change status of Galeon back to the original state after resuming."
-# Gets the value of the environment variable with the given name of the process with the given PID.
-get_env_var_of_process()
-{
- local pid="$1" envvar="$2"
-
- tr '\0' '\n' </proc/$pid/environ | sed -ne 's/^'"$envvar"'=\(.*\)$/\1/p'
-}
-
GaleonOffline()
{
[ x"$GALEON_OFFLINE" != "x1" ] && return 0
diff -Naur hibernate-1.96~pre-svn.r1136/scriptlets.d/sylpheed_claws hibernate-1.96~pre-svn.r1136.new/scriptlets.d/sylpheed_claws
--- hibernate-1.96~pre-svn.r1136/scriptlets.d/sylpheed_claws 2007-07-14 20:03:32.000000000 +0200
+++ hibernate-1.96~pre-svn.r1136.new/scriptlets.d/sylpheed_claws 2007-07-14 20:12:25.000000000 +0200
@@ -9,14 +9,6 @@
AddConfigHelp "SylpheedClawsOffline <boolean>" "Changes status of all locally running Sylpheed Claws to offline before suspending, and (optionally) change it to online after resuming."
AddConfigHelp "SylpheedClawsOnline <boolean>" "Changes status of all locally running Sylpheed Claws to online after resuming."
-# Gets the value of the environment variable with the given name of the process with the given PID.
-get_env_var_of_process()
-{
- local pid="$1" envvar="$2"
-
- tr '\0' '\n' </proc/$pid/environ | sed -ne 's/^'"$envvar"'=\(.*\)$/\1/p'
-}
-
SylpheedClawsOffline()
{
[ x"$SYLPHEEDCLAWS_OFFLINE" != "x1" ] && return 0