From 398c5f76701183eafd65f6be40cc85af03a3c74e Mon Sep 17 00:00:00 2001 From: Jiri Skala Date: Jul 31 2009 08:43:58 +0000 Subject: - bltk.conf can be located in ~/.bltk --- diff --git a/bltk-1.0.9-bltk_paths.patch b/bltk-1.0.9-bltk_paths.patch index f978b3c..00dff31 100644 --- a/bltk-1.0.9-bltk_paths.patch +++ b/bltk-1.0.9-bltk_paths.patch @@ -43,7 +43,7 @@ + then + RETCODE=2 + else -+ [ -f /etc/bltk.conf ] && . /etc/bltk.conf ++ [ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + + [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk + @@ -102,7 +102,7 @@ + then + RETCODE=2 + else -+ [ -f /etc/bltk.conf ] && . /etc/bltk.conf ++ [ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + + [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk + @@ -166,7 +166,7 @@ + then + RETCODE=2 + else -+ [ -f /etc/bltk.conf ] && . /etc/bltk.conf ++ [ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + + [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk + @@ -235,7 +235,7 @@ + then + RETCODE=2 + else -+ [ -f /etc/bltk.conf ] && . /etc/bltk.conf ++ [ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + + [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk + @@ -302,7 +302,7 @@ + then + RETCODE=2 + else -+ [ -f /etc/bltk.conf ] && . /etc/bltk.conf ++ [ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + + [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk + @@ -366,7 +366,7 @@ + then + RETCODE=2 + else -+ [ -f /etc/bltk.conf ] && . /etc/bltk.conf ++ [ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + + [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk + @@ -451,7 +451,7 @@ + then + RETCODE=2 + else -+ [ -f /etc/bltk.conf ] && . /etc/bltk.conf ++ [ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + + [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk + diff --git a/bltk-1.0.9-cond_install.patch b/bltk-1.0.9-cond_install.patch index 10d49b2..920b687 100644 --- a/bltk-1.0.9-cond_install.patch +++ b/bltk-1.0.9-cond_install.patch @@ -5,7 +5,7 @@ diff -up bltk-1.0.9/wl_developer/bltk_wl_developer_install.sh.cond_install bltk- # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + source `dirname $0`/../../bin/bltk_wl_common [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; } @@ -37,7 +37,7 @@ diff -up bltk-1.0.9/wl_office/bltk_wl_office_install.sh.cond_install bltk-1.0.9/ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" source `dirname $0`/../../bin/bltk_wl_common [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; } @@ -95,7 +95,7 @@ diff -up bltk-1.0.9/wl_player/bltk_wl_player_install.sh.cond_install bltk-1.0.9/ PLAYER_INSTALL_FLAGS=" --disable-ivtv" -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + source `dirname $0`/../../bin/bltk_wl_common [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; } diff --git a/bltk-1.0.9-conf_home.patch b/bltk-1.0.9-conf_home.patch new file mode 100644 index 0000000..d8fd3bf --- /dev/null +++ b/bltk-1.0.9-conf_home.patch @@ -0,0 +1,48 @@ +diff -up bltk-1.0.9/tools/bltk/parseconf.c.conf_home bltk-1.0.9/tools/bltk/parseconf.c +--- bltk-1.0.9/tools/bltk/parseconf.c.conf_home 2009-07-31 10:11:51.812041537 +0200 ++++ bltk-1.0.9/tools/bltk/parseconf.c 2009-07-31 10:14:00.747294693 +0200 +@@ -47,7 +47,8 @@ + + #include "bltk.h" + +-#define BLTK_CONF "/etc/bltk.conf" ++#define BLTK_CONF "bltk.conf" ++#define BLTK_HOME ".bltk" + + typedef struct para_item_str_t + { +@@ -221,12 +222,24 @@ void + param_load_conf() + { + char str[STR_LEN]; ++ char conf_file[STR_LEN]; + char name[STR_LEN], val[STR_LEN]; + int index, len; + FILE *f; + +- if ((f = fopen(BLTK_CONF, "rt")) != NULL) ++ ++ sprintf(conf_file, "%s/%s/%s", getenv("HOME"), BLTK_HOME, BLTK_CONF); ++ if ((f = fopen(conf_file, "rt")) == NULL) + { ++ sprintf(conf_file, "/etc/%s", BLTK_CONF); ++ f = fopen(conf_file, "rt"); ++ } ++ ++ if (f != NULL) ++ { ++ sprintf(str, "BLTK_CONF=%s", conf_file); ++ putenv(strdup(str)); ++ + while (fgets(str, STR_LEN, f) != NULL) + { + if ((len = strlen(str)) > 0 && str[len-1] == '\n') +@@ -264,7 +277,7 @@ param_load_defaults() + + if (bltk_home == NULL) + { +- sprintf(str, "%s/.bltk", getenv("HOME")); ++ sprintf(str, "%s/%s", getenv("HOME"), BLTK_HOME); + bltk_home = strdup(str); + } else if (bltk_home[0] == '~') { + sprintf(str, "%s%s", getenv("HOME"), bltk_home+1); diff --git a/bltk-1.0.9-installed.patch b/bltk-1.0.9-installed.patch index c244253..d9d6d34 100644 --- a/bltk-1.0.9-installed.patch +++ b/bltk-1.0.9-installed.patch @@ -4,7 +4,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" source `dirname $0`/bltk_wl_common [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; } diff --git a/bltk-1.0.9-opt_developer.patch b/bltk-1.0.9-opt_developer.patch index beac21b..4ad1652 100644 --- a/bltk-1.0.9-opt_developer.patch +++ b/bltk-1.0.9-opt_developer.patch @@ -4,7 +4,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + source `dirname $0`/../../bin/bltk_wl_common [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; } diff --git a/bltk-1.0.9-opt_game.patch b/bltk-1.0.9-opt_game.patch index 67763f9..b434088 100644 --- a/bltk-1.0.9-opt_game.patch +++ b/bltk-1.0.9-opt_game.patch @@ -27,7 +27,7 @@ set -x -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + source `dirname $0`/../../bin/bltk_wl_common [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; } diff --git a/bltk-1.0.9-opt_office.patch b/bltk-1.0.9-opt_office.patch index 4e48015..391f240 100644 --- a/bltk-1.0.9-opt_office.patch +++ b/bltk-1.0.9-opt_office.patch @@ -4,7 +4,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" unalias -a @@ -22,7 +22,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" + source `dirname $0`/../../bin/bltk_wl_common [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; } @@ -156,7 +156,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" unalias -a diff --git a/bltk-1.0.9-opt_player.patch b/bltk-1.0.9-opt_player.patch index 42ac394..901ce53 100644 --- a/bltk-1.0.9-opt_player.patch +++ b/bltk-1.0.9-opt_player.patch @@ -28,7 +28,7 @@ +BLTK_PLAYER_PROG_FLG= + -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" source `dirname $0`/../../bin/bltk_wl_common [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; } diff --git a/bltk-1.0.9-opt_reader.patch b/bltk-1.0.9-opt_reader.patch index 883bf03..ebe7013 100644 --- a/bltk-1.0.9-opt_reader.patch +++ b/bltk-1.0.9-opt_reader.patch @@ -4,7 +4,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -+. /etc/bltk.conf ++[ -f "$BLTK_CONF" ] && . "$BLTK_CONF" source `dirname $0`/../../bin/bltk_wl_common [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; } diff --git a/bltk.spec b/bltk.spec index 4ea1bd5..1f622ec 100644 --- a/bltk.spec +++ b/bltk.spec @@ -1,6 +1,6 @@ Name: bltk Version: 1.0.9 -Release: 4%{?dist} +Release: 5%{?dist} Summary: The BLTK measures notebook battery life under any workload Group: Applications/System @@ -28,6 +28,7 @@ Patch12: bltk-1.0.9-opt_reader.patch Patch13: bltk-1.0.9-installed.patch Patch14: bltk-1.0.9-sudo.patch Patch15: bltk-1.0.9-xse.patch +Patch16: bltk-1.0.9-conf_home.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -67,6 +68,7 @@ The following workloads are currently implemented: %patch13 -p1 -b .installed %patch14 -p1 -b .sudo %patch15 -p1 -b .xse +%patch16 -p1 -b .conf_home %build export CFLAGS="$RPM_OPT_FLAGS" @@ -231,6 +233,9 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/bltk/wl_reader/war_and_peace.html %changelog +* Fri Jul 31 2009 Jiri Skala 1.0.9-5 +- bltk.conf can be located in ~/.bltk + * Tue Jul 28 2009 Jiri Skala 1.0.9-4 - added man mages - splitted patch to more files