Blob Blame History Raw
--- orig-1.0.9/tools/bltk/main.c	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/bltk/main.c	2009-07-13 15:39:08.302608302 +0200
@@ -57,6 +57,7 @@
 #include <ctype.h>
 
 #include "bltk.h"
+#include "parseconf.h"
 
 #define	OUTPUT_CONSOLE		10
 #define	OUTPUT_FILE		20
@@ -206,6 +207,7 @@
 
 char *bltk_dirname = NULL;
 char bltk_root[STR_LEN];
+//char bltk_home[STR_LEN];
 char bltk_extern[STR_LEN];
 char *workload = NULL;
 
@@ -328,6 +330,7 @@
 static void get_info(int no);
 
 static int sig_abort_flg = 0;
+static int sig_hup_flg = 0;
 static int help_cnt = 0;
 static int version_flg = 0;
 
@@ -539,7 +542,16 @@
 	turn_off_stat_memory();
 
 	if (sig == SIGHUP) {
-		set_signal(SIGHUP);
+		create_stop_file();
+/*		if (!stat_log_proc_flg) {
+			create_stop_file();
+			save_sys_info_2();
+			sig_hup_flg = 1;
+			sync();
+			if (pid_stat_log != EMPTY_VALUE)
+				(void)kill(pid_stat_log, SIGHUP);
+		}
+		prog_exit(0);*/
 		return;
 	}
 
@@ -960,12 +972,13 @@
 	char str[STR_LEN];
 	int ret, i;
 
-	(void)unlink(LAST_RESULTS);
-	ret = symlink(results, LAST_RESULTS);
+	sprintf(str, "%s/%s", bltk_home, LAST_RESULTS);
+	(void)unlink(str);
+	ret = symlink(results, str);
 	if (ret != 0) {
 		(void)sprintf(prt_str, "symlink(%s, %s) failed, "
 			      "errno %d (%s)\n",
-			      results, LAST_RESULTS, errno, strerror(errno));
+			      results, str, errno, strerror(errno));
 		write_to_err_log(prt_str);
 		prog_exit(1);
 	}
@@ -987,6 +1000,7 @@
 	(void)sprintf(fail_fname, "%s/fail", results);
 	(void)sprintf(pass_fname, "%s/pass", results);
 	prog_putenv("BLTK_FAIL_FNAME", fail_fname);
+	prog_putenv("BLTK_STOP_FNAME", stop_fname);
 	prog_putenv("BLTK_PASS_FNAME", pass_fname);
 
 	(void)sprintf(err_log_fname, "%s/err.log", results);
@@ -1041,10 +1055,12 @@
 	}
 	(void)strcat(cmdline, "'");
 
-	(void)sprintf(cmd, "%s >>history", cmdline);
+	sprintf(str, "%s/%s", bltk_home, HISTORY);
+	(void)sprintf(cmd, "%s >>%s", cmdline, str);
 	(void)prog_system(cmd);
 
-	(void)sprintf(cmd, "%s >last_cmd", cmdline);
+	sprintf(str, "%s/%s", bltk_home, LAST_CMD);
+	(void)sprintf(cmd, "%s >%s", cmdline, str);
 	(void)prog_system(cmd);
 
 	(void)sprintf(cmd, "%s >%s/cmd", cmdline, results);
@@ -1078,7 +1094,7 @@
 	set_signal(SIGUSR2);
 	set_signal(SIGHUP);
 
-	(void)sprintf(cmd, "mkdir -p -m 0777 %s/tmp", bltk_root);
+	(void)sprintf(cmd, "mkdir -p -m 0777 %s/tmp", bltk_home);
 	ret = prog_system(cmd);
 	if (ret != 0) {
 		(void)sprintf(prt_str, "%s failed\n", cmd);
@@ -1608,6 +1624,28 @@
 	return (wp1);
 }
 
+static char *get_bltk_root_by_proc()
+{
+	char str[256], *path, *ret=NULL;
+
+	snprintf(str, sizeof str, "/proc/%d/exe", getpid());
+	if (readlink(str, str, sizeof str) > -1)
+	{
+		if ((path = dirname(str)))
+		{
+			// take one folder higher
+			ret = strrchr(path, '/');
+			if (ret != NULL)
+			{
+				*ret = 0;
+				ret = path;
+			}
+		}
+	}
+
+	return ret ? strdup(ret) : ret;
+}
+
 static char *get_bltk_root_by_path(char *argv0)
 {
 	char *path, *dpath, *res;
@@ -1648,7 +1686,8 @@
 	int ret;
 	char cwd[STR_LEN];
 
-	wp1 = check_bltk_root(".");
+	//wp1 = check_bltk_root(".");
+	wp1 = get_bltk_root_by_proc();
 	if (wp1 == NULL) {
 		wp1 = get_bltk_root_by_argv0(argv0);
 	}
@@ -1792,6 +1831,12 @@
 	(void)umask(0);
 	(void)set_path(0);
 
+  param_init();
+
+  prog_putenv("BLTK_HOME", bltk_home);
+  prog_putenv("WL_OFFICE_WORKING_DIR", wl_office_working_dir);
+  prog_putenv("WL_READER_WORKING_DIR", wl_office_working_dir);
+
 	time_start = time_prev = prog_time();
 
 	(void)prog_system("xset dpms 0 0 0 >/dev/null 2>&1");
@@ -2125,7 +2170,7 @@
 			    ("getcwd() failed, cannot continue the test\n");
 			prog_exit(1);
 		}
-		(void)sprintf(results_str, "%s/%s", results_parent, results);
+		(void)sprintf(results_str, "%s/%s", bltk_home, results);
 		results = results_str;
 	}
 
--- orig-1.0.9/tools/bltk/parseconf.c	1970-01-01 01:00:00.000000000 +0100
+++ curr-1.0.9/tools/bltk/parseconf.c	2009-07-13 10:04:45.480608150 +0200
@@ -0,0 +1,299 @@
+/*
+ *  Copyright (c) 2009 Red Hat Inc.
+ *  Copyright (c) 2009 Jiri Skala <jskala@redhat.com>
+ *  All rights reserved.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ *    Neither the name of Intel Corporation nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ *  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ *  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ *  DAMAGE.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "bltk.h"
+
+#define BLTK_CONF                   "/etc/bltk.conf"
+
+typedef struct para_item_str_t
+{
+	const char *name;
+	char **val;
+	size_t len;
+} para_item_str;
+
+typedef struct para_item_int_t
+{
+	const char *name;
+	int *val;
+} para_item_int;
+
+typedef struct para_item_bool_t
+{
+	const char *name;
+	int *val;
+} para_item_bool;
+
+char *bltk_home;
+char *soffice_prog;
+char *wl_office_working_dir;
+char *bltk_player_prog;
+char *bltk_player_file;
+char *bltk_reader_prog;
+char *bltk_reader_file;
+
+int wl_developer_enabled;
+int wl_developer_extern;
+int wl_game_enabled;
+int wl_game_extern;
+int wl_office_enabled;
+int wl_office_extern;
+int wl_player_enabled;
+int wl_player_extern;
+int wl_reader_enabled;
+int wl_reader_extern;
+
+static para_item_str params_str[] =
+{
+	{ "BLTK_HOME", &bltk_home, 0 },
+	{ "SOFFICE_PROG", &soffice_prog, 0 },
+	{ "WL_OFFICE_WORKING_DIR", &wl_office_working_dir, 0 },
+	{ "BLTK_PLAYER_PROG", &bltk_player_prog, 0 },
+	{ "BLTK_PLAYER_FILE", &bltk_player_file, 0 },
+	{ "BLTK_READER_PROG", &bltk_reader_prog, 0 },
+	{ "BLTK_READER_FILE", &bltk_reader_file, 0 },
+  { NULL, NULL, 0 }
+};
+
+static para_item_int params_int[] =
+{
+  { NULL, 0 }
+};
+
+static para_item_bool params_bool[] =
+{
+	{ "WL_DEVELOPER_ENABLED", &wl_developer_enabled },
+	{ "WL_DEVELOPER_EXTERN", &wl_developer_extern },
+	{ "WL_GAME_ENABLED", &wl_game_enabled },
+	{ "WL_GAME_EXTERN", &wl_game_extern },
+	{ "WL_OFFICE_ENABLED", &wl_office_enabled },
+	{ "WL_OFFICE_EXTERN", &wl_office_extern },
+	{ "WL_PLAYER_ENABLED", &wl_player_enabled },
+	{ "WL_PLAYER_EXTERN", &wl_player_extern },
+	{ "WL_READER_ENABLED", &wl_reader_enabled },
+	{ "WL_READER_EXTERN", &wl_reader_extern },
+  { NULL, 0 }
+};
+
+
+char *
+strupper(char *str)
+{
+  int i;
+  for (i=0; i < strlen(str); i++)
+    str[i] = (char)toupper(str[i]);
+  return str;
+}
+
+int
+param_find_str(const char *name)
+{
+  int i;
+  for (i=0;
+    params_str[i].name != NULL && strcmp(name, params_str[i].name) != 0;
+    i++) ;
+  return params_str[i].name == NULL ? -1 : i;
+}
+
+int
+param_find_int(const char *name)
+{
+  int i;
+  for (i=0;
+    params_int[i].name != NULL && strcmp(name, params_int[i].name) != 0;
+    i++) ;
+  return params_int[i].name == NULL ? -1 : i;
+}
+
+int
+param_find_bool(const char *name)
+{
+  int i;
+  for (i=0;
+    params_bool[i].name != NULL && strcmp(name, params_bool[i].name) != 0;
+    i++) ;
+  return params_bool[i].name == NULL ? -1 : i;
+}
+
+int
+line_empty_or_spaces(const char *line)
+{
+  int i;
+  for (i=0; line[i] > 0 && line[i] <= ' ' && i < strlen(line); i++) ;
+  return line[i] == 0;
+}
+
+int
+line_commented(const char *line)
+{
+  int i;
+  for (i=0; line[i] > 0 && line[i] <= ' ' && i < strlen(line); i++) ;
+  return line[i] == '#';
+}
+
+int
+param_parse_line(const char *line, char *name, char *val)
+{
+  char *str, *str1;
+  int ret=-1;
+
+  str = strdup(line);
+  if ((str1 = strchr(str, '=')) != NULL)
+  {
+    *str1 = 0;
+    str1++;
+    strcpy(val, str1);
+    strcpy(name, str);
+    ret = 0;
+  }
+  else
+  {
+    fprintf(stderr, "Incorrect line in the %s\n", BLTK_CONF);
+  } 
+  free (str);
+  return ret;
+}
+
+void
+param_export_value(const char *name)
+{
+	char expval[STR_LEN];
+  int index;
+
+  if ((index = param_find_str(name)) > -1)
+	  snprintf(expval, STR_LEN, "%s=%s", name, *(params_str[index].val));
+  else if ((index = param_find_int(name)) > -1)
+	  snprintf(expval, STR_LEN, "%s=%d", name, *(params_int[index].val));
+  else if ((index = param_find_bool(name)) > -1)
+	  snprintf(expval, STR_LEN, "%s=%s", name, *(params_bool[index].val) ? "YES": "NO");
+
+  if (index > -1)
+    putenv(strdup(expval));
+  else
+    fprintf(stderr, "Undefined parameter (%s)\n", name);
+}
+
+void
+param_load_conf()
+{
+  char str[STR_LEN];
+  char name[STR_LEN], val[STR_LEN];
+  int index, len;
+	FILE *f;
+
+  if ((f = fopen(BLTK_CONF, "rt")) != NULL)
+  {
+    while (fgets(str, STR_LEN, f) != NULL)
+    {
+      if ((len = strlen(str)) > 0 && str[len-1] == '\n')
+        str[len-1] = 0;
+      if (line_empty_or_spaces(str) || line_commented(str))
+        continue;
+
+      param_parse_line(str, name, val);
+
+      if ((index = param_find_str(name)) > -1)
+        *(params_str[index].val) = strdup(val);
+      else if ((index = param_find_int(name)) > -1)
+        *(params_int[index].val) = atoi(val);
+      else if ((index = param_find_bool(name)) > -1)
+      {
+        if (!strcmp(strupper(val), "YES") ||
+            !strcmp(strupper(val), "TRUE") ||
+            val[0] == '1')
+          *(params_bool[index].val) = 1;
+        else if (!strcmp(strupper(val), "NO") ||
+            !strcmp(strupper(val), "FALSE") ||
+            val[0] == '0')
+          *(params_bool[index].val) = 0;
+      }
+    }
+
+    fclose(f);
+  }
+}
+
+void
+param_load_defaults()
+{
+  char str[STR_LEN];
+
+  if (bltk_home == NULL)
+  {
+    sprintf(str, "%s/.bltk", getenv("HOME"));
+    bltk_home = strdup(str);
+  } else if (bltk_home[0] == '~') {
+    sprintf(str, "%s%s", getenv("HOME"), bltk_home+1);
+    free(bltk_home);
+    bltk_home = strdup(str);
+  }
+
+  if (access(bltk_home, 0) != 0)
+    mkdir(bltk_home, 0700);
+
+  if (wl_office_working_dir == NULL)
+    wl_office_working_dir = strdup(bltk_home);
+
+  if (access(wl_office_working_dir, 0) != 0)
+  {
+    if (wl_office_working_dir[0] == '~')
+    {
+      sprintf(str, "%s%s", getenv("HOME"), wl_office_working_dir+1);
+      free(wl_office_working_dir);
+      wl_office_working_dir = strdup(str);
+    }
+    mkdir(wl_office_working_dir, 0700);
+  }
+}
+
+void
+param_init()
+{
+  param_load_conf();
+  param_load_defaults();
+}
+
--- orig-1.0.9/tools/xse/xse.c	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/xse/xse.c	2009-07-13 10:04:45.490608952 +0200
@@ -52,16 +52,20 @@
 #include <time.h>
 #include <sys/wait.h>
 #include <signal.h>
+#include <sys/prctl.h>
 
 #include <xse.h>
 
 char *progname = "xse";
 char *xchg_buf = NULL;
 char *scen_file = NULL;
+char *stop_name = "NULL";
 int default_release_flg = 0;
 int check_delay_time_flg = 0;
 int correct_delay_time_flg = 0;
 
+char winid_tmp[STR_LEN];
+
 long double user_delay = 0;
 
 static Display *display = NULL;
@@ -412,8 +416,10 @@
 	char string[STR_LEN];
 
 	if (fname == 0) {
-		fname = DELAY_FILE;
+		snprintf(string, STR_LEN, "%s/%s", getenv("BLTK_HOME"), DELAY_FILE);
+		fname = strdup(string);
 	}
+	fprintf(stderr, "user delay file: %s\n", fname);
 
 	fd = open(fname, O_RDWR | O_TRUNC | O_CREAT, 0666);
 	if (fd < 0) {
@@ -504,8 +510,8 @@
 	int ret = 0;
 	char cmd[STR_LEN];
 
-	(void)sprintf(cmd, "bltk_winid -S -t %d -s %d \"%s\" >./winid.tmp",
-		      wait_time, sleep_time, title);
+	(void)sprintf(cmd, "bltk_winid -S -t %d -s %d \"%s\" > %s",
+		      wait_time, sleep_time, title, winid_tmp);
 	ret = system(cmd);
 	if (ret != 0) {
 		(void)fprintf(stderr, "%s failed\n", cmd);
@@ -519,7 +525,7 @@
 	int ret = 0;
 	char cmd[STR_LEN];
 
-	(void)sprintf(cmd, "bltk_winid -S \"%s\" >./winid.tmp", title);
+	(void)sprintf(cmd, "%s/bin/bltk_winid -S \"%s\" > %s", getenv("BLTK_ROOT"), title, winid_tmp);
 	ret = system(cmd);
 	if (ret != 0) {
 		(void)fprintf(stderr, "%s failed\n", cmd);
@@ -549,7 +555,7 @@
 	int ret = 0;
 	char cmd[STR_LEN];
 
-	(void)sprintf(cmd, "bltk_winid -F \"%s\"", title);
+	(void)sprintf(cmd, "%s/bin/bltk_winid -F \"%s\"", getenv("BLTK_ROOT"), title);
 	ret = system(cmd);
 	if (ret != 0) {
 		(void)fprintf(stderr, "%s failed\n", cmd);
@@ -562,6 +568,18 @@
 static pid_t pid_array[1024];
 static int pid_cnt = 0;
 
+void chk_stop_file()
+{
+	int i;
+
+	if (access(stop_name, F_OK) == 0) {
+		for (i = 0; i < pid_cnt; i++) {
+			(void)kill(pid_array[i], SIGTERM);
+		}
+		xse_exit(0);
+	}
+}
+
 static int runcmd_action(char *name, int wait_time, int state)
 {
 	int ret = 0;
@@ -1096,7 +1114,7 @@
 			} else {
 				get_winid_action(string);
 			}
-			readf_action("./winid.tmp", count, delay_time);
+			readf_action(winid_tmp, count, delay_time);
 			setwinid_action(string, xchg_buf, delay_time);
 			delay_time = 0;
 			break;
@@ -1189,11 +1207,24 @@
 		if (break_flg) {
 			break;
 		}
+		chk_stop_file();
 	}
 }
 
 void init_xse()
 {
+	if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0) != 0)
+	{
+		xse_exit(2);
+	}
+	if (prctl(PR_SET_PDEATHSIG, SIGTERM, 0, 0, 0) != 0)
+	{
+		xse_exit(2);
+	}
+
+	stop_name = getenv("BLTK_STOP_FNAME");
+	
+	snprintf(winid_tmp, sizeof winid_tmp, "%s/%s", getenv("BLTK_HOME"), WINID_FILE);
 	display = XOpenDisplay(NULL);
 	if (display == NULL) {
 		(void)fprintf(stderr, "%s: Cannot open Display\n", progname);
--- orig-1.0.9/include/parseconf.h	1970-01-01 01:00:00.000000000 +0100
+++ curr-1.0.9/include/parseconf.h	2009-07-13 10:04:45.505607012 +0200
@@ -0,0 +1,61 @@
+/*
+ *  Copyright (c) 2009 Red Hat Inc.
+ *  Copyright (c) 2009 Jiri Skala <jskala@redhat.com>
+ *  All rights reserved.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ *    Neither the name of Intel Corporation nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ *  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ *  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ *  DAMAGE.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#ifndef __PARSECONF_H__
+#define __PARSECONF_H__
+
+extern char *bltk_home;
+extern char *soffice_prog;
+extern char *wl_office_working_dir;
+extern char *bltk_player_prog;
+extern char *bltk_player_file;
+extern char *bltk_reader_prog;
+
+extern int wl_developer_enabled;
+extern int wl_developer_extern;
+extern int wl_game_enabled;
+extern int wl_game_extern;
+extern int wl_office_enabled;
+extern int wl_office_extern;
+extern int wl_player_enabled;
+extern int wl_player_extern;
+extern int wl_reader_enabled;
+extern int wl_reader_extern;
+
+#endif
+
--- orig-1.0.9/include/xse.h	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/include/xse.h	2009-07-13 10:04:45.506607930 +0200
@@ -87,7 +87,8 @@
 #define	DELAY_1_MIN	(1 * 60 * 1000)
 #define	DELAY_2_MIN	(2 * 60 * 1000)
 #define	WINDOWID	"WINDOWID"
-#define	DELAY_FILE	"./user_delay.tmp"
+#define	DELAY_FILE	"user_delay.tmp"
+#define WINID_FILE	"winid.tmp"
 #define	VI_CMD		"vi"
 #define	CSCOPE_CMD	"cscope"
 #define	F4		"F4"
--- orig-1.0.9/wl_reader/bltk_wl_reader_xse.c	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_reader/bltk_wl_reader_xse.c	2009-07-13 10:04:45.508608021 +0200
@@ -108,7 +108,7 @@
 		}
 	}
 
-	env = getenv("BLTK_WL_PROG");
+	env = getenv("BLTK_READER_PROG");
 	if (env && strcmp(env, "konqueror") == 0) {
 		scen[LINE_QUIT].string = "Q";
 	}
--- orig-1.0.9/tools/bltk/bltk_get_lspci.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/bltk/bltk_get_lspci.sh	2009-07-13 10:04:45.468889841 +0200
@@ -56,7 +56,7 @@
 	echo "$PROG: Warning: $*" >&2
 }
 
-TMP_FILE=$BLTK_ROOT/tmp/lspci
+TMP_FILE=$BLTK_HOME/tmp/lspci
 
 if [[ -z $LSPCI ]]
 then
--- orig-1.0.9/tools/bltk/bltk_get_hdparm.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/bltk/bltk_get_hdparm.sh	2009-07-13 10:04:45.469891458 +0200
@@ -56,13 +56,10 @@
 
 PARTITIONS=$1
 
-TMP_FILE=$BLTK_ROOT/tmp/hdparm
-
-#str=`df -lk / | grep -v ^Filesystem`
-str=`df -lk / | grep ^/dev/`
-DF_DEV_NAME=${str%% *}
-DF_NAME=${DF_DEV_NAME#/dev/}
+TMP_FILE=$BLTK_HOME/tmp/hdparm
 
+str=`ls -d /sys/block/sd* | sed 's/^.*sd/sd/'`
+DF_NAME=${str%% *}
 HD_NAME=${DF_NAME%%[0-9]*}
 
 grep -w "$HD_NAME" "$PARTITIONS" >/dev/null 2>&1
--- orig-1.0.9/tools/bltk/bltk_get_dmidecode.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/bltk/bltk_get_dmidecode.sh	2009-07-13 10:04:45.469891458 +0200
@@ -76,7 +76,7 @@
 	shift $((OPTIND-1))
 
 	DMIDECODE=$*
-	TMP_FILE=$BLTK_ROOT/tmp/dmidecode
+	TMP_FILE=$BLTK_HOME/tmp/dmidecode
 
 	if [[ -z $DMIDECODE ]]
 	then
--- orig-1.0.9/tools/bltk/bltk_wl_common.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/bltk/bltk_wl_common.sh	2009-07-13 10:04:45.469891458 +0200
@@ -38,6 +38,7 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
 
 unalias -a
 
@@ -130,7 +131,7 @@
 
 	export BLTK_BIN=$BLTK_ROOT/bin
 	export BLTK_LIB=$BLTK_ROOT/lib
-	export BLTK_TMP=$BLTK_ROOT/tmp
+	export BLTK_TMP=$HOME/.bltk/tmp
 
 	[[ -z $BLTK_SUDO_CMD ]] && export BLTK_SUDO_CMD=$BLTK_BIN/bltk_sudo
 	[[ -z $BLTK_CALC_CMD ]] && export BLTK_CALC_CMD=$BLTK_BIN/bltk_calc
@@ -180,7 +181,7 @@
 
 	export BLTK_BIN=$BLTK_ROOT/bin
 	export BLTK_LIB=$BLTK_ROOT/lib
-	export BLTK_TMP=$BLTK_ROOT/tmp
+	export BLTK_TMP=$HOME/.bltk/tmp
 
 	export BLTK_EXTERN_SRC=$BLTK_ROOT/extern
 #	export BLTK_EXTERN_TGT=$BLTK_ROOT/extern
@@ -228,7 +229,7 @@
 		wl_error_msg "cd $BLTK_WL_ROOT failed"
 		return 1
 	fi
-	rm -f fail
+	rm -f $BLTK_FAIL_NAME
 
 	RES_SCORE=$BLTK_RESULTS/score
 	[[ -a $RES_SCORE ]] && rm $RES_SCORE
@@ -374,7 +375,7 @@
 {
 	typeset wl=$1
 
-	if [[ ! -a $BLTK_WL_INSTALL_FILE ]]
+	if [[ $CHK_INSTALLED = "YES" && ! -a $BLTK_WL_INSTALL_FILE ]]
 	then
 		wl_error_msg "Installation is not completed, perform 'make install-$wl'"
 		return 1
@@ -626,3 +627,20 @@
 	return 0
 }
 
+wl_install_file()
+{
+  typeset access=$1
+	typeset	file1=$2
+	typeset	file2=$3
+
+	CMD="install -m $access $file1 $file2"
+	$CMD
+	if [[ $? != 0 ]]
+	then
+		wl_error_msg "$CMD failed"
+		wl_error_msg "Cannot copy $file1 to $file2"
+		return 1
+	fi
+	return 0
+}
+
--- orig-1.0.9/tools/bltk/bltk_check.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/bltk/bltk_check.sh	2009-07-13 10:04:45.479608418 +0200
@@ -38,6 +38,7 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
 
 source `dirname $0`/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
@@ -120,7 +121,7 @@
 	wl=${WLA[wl_cnt]}
 	WL_RES=$RES/$wl.results
 	echo "=== Workload '$wl'"
-	if [[ ! -f $BLTK_ROOT/wl_$wl/.installed && $wl != idle && $wl != reader ]]
+	if [[ $CHK_INSTALLED = "YES" && ! -f $BLTK_ROOT/wl_$wl/.installed && $wl != idle && $wl != reader ]]
 	then
 		echo "not installed";
 		WLR[wl_cnt]="not installed"
--- orig-1.0.9/tools/bltk/bltk_get_xdpyinfo.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/bltk/bltk_get_xdpyinfo.sh	2009-07-13 10:04:45.479608418 +0200
@@ -42,7 +42,7 @@
 unalias -a
 
 XDPYINFO=$1
-TMP_FILE=$BLTK_ROOT/tmp/xdpyinfo
+TMP_FILE=$BLTK_HOME/tmp/xdpyinfo
 
 if [[ -z $XDPYINFO ]]
 then
--- orig-1.0.9/tools/bltk/bltk_get_user_field.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/bltk/bltk_get_user_field.sh	2009-07-13 10:04:45.480608150 +0200
@@ -57,7 +57,7 @@
 FIELD_NO=$1
 DELIM=$1
 
-TMP_FILE=$BLTK_ROOT/tmp/hdparm
+TMP_FILE=$BLTK_HOME/tmp/hdparm
 
 #str=`df -lk / | grep -v ^Filesystem`
 str=`df -lk / | grep ^/dev/`
--- orig-1.0.9/tools/analyzer/bltk_report_compress.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/analyzer/bltk_report_compress.sh	2009-07-13 10:04:45.484609239 +0200
@@ -41,27 +41,44 @@
 
 unalias -a
 
-set_bltk_root()
+set_bltk_paths()
 {
-	PROG=`basename $0`
+  WHICH_BLTK=`which bltk`
+  RETCODE=$?
 
-	BLTK_ROOT=`dirname $0`
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
-	then
-		BLTK_ROOT=`dirname $BLTK_ROOT`
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
-		then
-			echo "Cannot determine bltk root, bltk tree corrupted."
-			exit 2
-		fi
-	fi
-	export BLTK_ROOT
-	export BLTK_BIN=$BLTK_ROOT/bin
-	export BLTK_TMP=$BLTK_ROOT/tmp
-	export BLTK_GET_REALPATH=$BLTK_BIN/bltk_get_realpath
+  if [[ $RETCODE = 0 ]]
+  then
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
+    TMPCODE=$?
+    if [[ $TMPCODE = 0 ]]
+    then
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
+    else
+      BLTK_MAIN=$WHICH_BLTK
+    fi
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
+
+    root_len=`echo $BLTK_ROOT | wc -c`
+    main_len=`echo $BLTK_MAIN | wc -c`
+    
+    if [[ $root_len = $main_len ]]
+    then
+      RETCODE=2
+    else
+      [ -f /etc/bltk.conf ] && . /etc/bltk.conf
+
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
+
+      export BLTK_ROOT
+      export BLTK_BIN=$BLTK_ROOT/bin
+      export BLTK_TMP=$BLTK_HOME/tmp
+    fi
+  fi
+
+  return $RETCODE
 }
 
-set_bltk_root
+set_bltk_paths
 
 CWD=$PWD
 
--- orig-1.0.9/tools/analyzer/bltk_report.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/analyzer/bltk_report.sh	2009-07-13 10:04:45.485608830 +0200
@@ -38,29 +38,51 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
-
 unalias -a
 
-set_bltk_root()
+set_bltk_paths()
 {
-	PROG=`basename $0`
-
-	BLTK_ROOT=`dirname $0`
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
-	then
-		BLTK_ROOT=`dirname $BLTK_ROOT`
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
-		then
-			echo "Cannot determine bltk root, bltk tree corrupted."
-			exit 2
-		fi
-	fi
-	export BLTK_ROOT
-	export BLTK_BIN=$BLTK_ROOT/bin
-	export BLTK_TMP=$BLTK_ROOT/tmp
-}
+  WHICH_BLTK=`which bltk`
+  RETCODE=$?
 
-set_bltk_root
+  if [[ $RETCODE = 0 ]]
+  then
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
+    TMPCODE=$?
+    if [[ $TMPCODE = 0 ]]
+    then
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
+    else
+      BLTK_MAIN=$WHICH_BLTK
+    fi
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
+
+    root_len=`echo $BLTK_ROOT | wc -c`
+    main_len=`echo $BLTK_MAIN | wc -c`
+    
+    if [[ $root_len = $main_len ]]
+    then
+      RETCODE=2
+    else
+      [ -f /etc/bltk.conf ] && . /etc/bltk.conf
+
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
+
+      export BLTK_ROOT
+      export BLTK_BIN=$BLTK_ROOT/bin
+      export BLTK_TMP=$BLTK_HOME/tmp
+    fi
+  fi
+
+  return $RETCODE
+}
+
+set_bltk_paths
+
+if [ ! $? = 0 ]; then
+  echo "ERROR in setting environmental paths" >&2
+  exit 1
+fi
 
 BLTK_GET_STAT_CMD="$BLTK_BIN/bltk_get_stat $stat_ign_lines_arg"
 BLTK_CALC_CMD=$BLTK_BIN/bltk_calc
--- orig-1.0.9/tools/analyzer/bltk_plot.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/analyzer/bltk_plot.sh	2009-07-13 10:04:45.485608830 +0200
@@ -41,23 +41,41 @@
 
 unalias -a
 
-set_bltk_root()
+set_bltk_paths()
 {
-	PROG=`basename $0`
+  WHICH_BLTK=`which bltk`
+  RETCODE=$?
 
-	BLTK_ROOT=`dirname $0`
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
-	then
-		BLTK_ROOT=`dirname $BLTK_ROOT`
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
-		then
-			echo "Cannot determine bltk root, bltk tree corrupted."
-			exit 2
-		fi
-	fi
-	export BLTK_ROOT
-	export BLTK_BIN=$BLTK_ROOT/bin
-	export BLTK_TMP=$BLTK_ROOT/tmp
+  if [[ $RETCODE = 0 ]]
+  then
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
+    TMPCODE=$?
+    if [[ $TMPCODE = 0 ]]
+    then
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
+    else
+      BLTK_MAIN=$WHICH_BLTK
+    fi
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
+
+    root_len=`echo $BLTK_ROOT | wc -c`
+    main_len=`echo $BLTK_MAIN | wc -c`
+    
+    if [[ $root_len = $main_len ]]
+    then
+      RETCODE=2
+    else
+      [ -f /etc/bltk.conf ] && . /etc/bltk.conf
+
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
+
+      export BLTK_ROOT
+      export BLTK_BIN=$BLTK_ROOT/bin
+      export BLTK_TMP=$BLTK_HOME/tmp
+    fi
+  fi
+
+  return $RETCODE
 }
 
 set_bltk_root
--- orig-1.0.9/tools/analyzer/bltk_report_table.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/analyzer/bltk_report_table.sh	2009-07-13 10:04:45.485608830 +0200
@@ -41,26 +41,44 @@
 
 unalias -a
 
-set_bltk_root()
+set_bltk_paths()
 {
-	PROG=`basename $0`
+  WHICH_BLTK=`which bltk`
+  RETCODE=$?
 
-	BLTK_ROOT=`dirname $0`
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
-	then
-		BLTK_ROOT=`dirname $BLTK_ROOT`
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
-		then
-			echo "Cannot determine bltk root, bltk tree corrupted."
-			exit 2
-		fi
-	fi
-	export BLTK_ROOT
-	export BLTK_BIN=$BLTK_ROOT/bin
-	export BLTK_TMP=$BLTK_ROOT/tmp
+  if [[ $RETCODE = 0 ]]
+  then
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
+    TMPCODE=$?
+    if [[ $TMPCODE = 0 ]]
+    then
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
+    else
+      BLTK_MAIN=$WHICH_BLTK
+    fi
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
+
+    root_len=`echo $BLTK_ROOT | wc -c`
+    main_len=`echo $BLTK_MAIN | wc -c`
+    
+    if [[ $root_len = $main_len ]]
+    then
+      RETCODE=2
+    else
+      [ -f /etc/bltk.conf ] && . /etc/bltk.conf
+
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
+
+      export BLTK_ROOT
+      export BLTK_BIN=$BLTK_ROOT/bin
+      export BLTK_TMP=$BLTK_HOME/tmp
+    fi
+  fi
+
+  return $RETCODE
 }
 
-set_bltk_root
+set_bltk_paths
 
 BLTK_REPORT=$BLTK_BIN/bltk_report
 
--- orig-1.0.9/tools/analyzer/bltk_report_check.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/analyzer/bltk_report_check.sh	2009-07-13 10:04:45.485608830 +0200
@@ -41,26 +41,44 @@
 
 unalias -a
 
-set_bltk_root()
+set_bltk_paths()
 {
-	PROG=`basename $0`
+  WHICH_BLTK=`which bltk`
+  RETCODE=$?
 
-	BLTK_ROOT=`dirname $0`
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
-	then
-		BLTK_ROOT=`dirname $BLTK_ROOT`
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
-		then
-			echo "Cannot determine bltk root, bltk tree corrupted."
-			exit 2
-		fi
-	fi
-	export BLTK_ROOT
-	export BLTK_BIN=$BLTK_ROOT/bin
-	export BLTK_TMP=$BLTK_ROOT/tmp
+  if [[ $RETCODE = 0 ]]
+  then
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
+    TMPCODE=$?
+    if [[ $TMPCODE = 0 ]]
+    then
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
+    else
+      BLTK_MAIN=$WHICH_BLTK
+    fi
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
+
+    root_len=`echo $BLTK_ROOT | wc -c`
+    main_len=`echo $BLTK_MAIN | wc -c`
+    
+    if [[ $root_len = $main_len ]]
+    then
+      RETCODE=2
+    else
+      [ -f /etc/bltk.conf ] && . /etc/bltk.conf
+
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
+
+      export BLTK_ROOT
+      export BLTK_BIN=$BLTK_ROOT/bin
+      export BLTK_TMP=$BLTK_HOME/tmp
+    fi
+  fi
+
+  return $RETCODE
 }
 
-set_bltk_root
+set_bltk_paths
 
 Failed="Failed !!!"
 
--- orig-1.0.9/tools/analyzer/bltk_func.sh	1970-01-01 01:00:00.000000000 +0100
+++ curr-1.0.9/tools/analyzer/bltk_func.sh	2009-07-13 10:04:45.487610317 +0200
@@ -0,0 +1,77 @@
+#!/bin/bash
+#
+# Copyright (c) 2009 Red Hat Inc.
+# Copyright (c) 2009 Jiri Skala <jskala@redhat.com>
+# All rights reserved.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   Redistributions of source code must retain the above copyright notice,
+#   this list of conditions and the following disclaimer.
+#
+#   Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#
+#   Neither the name of Intel Corporation nor the names of its contributors
+#   may be used to endorse or promote products derived from this software
+#   without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+#
+# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+# DAMAGE.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+set_bltk_paths()
+{
+  WHICH_BLTK=`which bltk`
+  RETCODE=$?
+
+  if [[ $RETCODE = 0 ]]
+  then
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
+    TMPCODE=$?
+    if [[ $TMPCODE = 0 ]]
+    then
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
+    else
+      BLTK_MAIN=$WHICH_BLTK
+    fi
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
+
+    root_len=`echo $BLTK_ROOT | wc -c`
+    main_len=`echo $BLTK_MAIN | wc -c`
+    
+    if [[ $root_len = $main_len ]]
+    then
+      RETCODE=2
+    else
+      [ -f /etc/bltk.conf ] && . /etc/bltk.conf
+
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
+
+      export BLTK_ROOT
+      export BLTK_BIN=$BLTK_ROOT/bin
+      export BLTK_TMP=$BLTK_HOME/tmp
+    fi
+  fi
+
+  return $RETCODE
+}
+
--- orig-1.0.9/tools/analyzer/bltk_report_uncompress.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/analyzer/bltk_report_uncompress.sh	2009-07-13 10:04:45.488609629 +0200
@@ -41,27 +41,44 @@
 
 unalias -a
 
-set_bltk_root()
+set_bltk_paths()
 {
-	PROG=`basename $0`
+  WHICH_BLTK=`which bltk`
+  RETCODE=$?
 
-	BLTK_ROOT=`dirname $0`
-	if [[ ! -a $BLTK_ROOT/.bltk ]]
-	then
-		BLTK_ROOT=`dirname $BLTK_ROOT`
-		if [[ ! -a $BLTK_ROOT/.bltk ]]
-		then
-			echo "Cannot determine bltk root, bltk tree corrupted."
-			exit 2
-		fi
-	fi
-	export BLTK_ROOT
-	export BLTK_BIN=$BLTK_ROOT/bin
-	export BLTK_TMP=$BLTK_ROOT/tmp
-	export BLTK_GET_REALPATH=$BLTK_BIN/bltk_get_realpath
+  if [[ $RETCODE = 0 ]]
+  then
+    file -b $WHICH_BLTK | grep symbolic > /dev/null
+    TMPCODE=$?
+    if [[ $TMPCODE = 0 ]]
+    then
+      BLTK_MAIN=`readlink -f $WHICH_BLTK`
+    else
+      BLTK_MAIN=$WHICH_BLTK
+    fi
+    BLTK_ROOT=`echo $BLTK_MAIN | sed 's|/bin/.*$||'`
+
+    root_len=`echo $BLTK_ROOT | wc -c`
+    main_len=`echo $BLTK_MAIN | wc -c`
+    
+    if [[ $root_len = $main_len ]]
+    then
+      RETCODE=2
+    else
+      [ -f /etc/bltk.conf ] && . /etc/bltk.conf
+
+      [ -z $BLTK_HOME ] && BLTK_HOME=~/.bltk
+
+      export BLTK_ROOT
+      export BLTK_BIN=$BLTK_ROOT/bin
+      export BLTK_TMP=$BLTK_HOME/tmp
+    fi
+  fi
+
+  return $RETCODE
 }
 
-set_bltk_root
+set_bltk_paths
 
 CWD=$PWD
 
--- orig-1.0.9/wl_developer/bltk_wl_developer_install.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_developer/bltk_wl_developer_install.sh	2009-07-14 10:23:58.340615097 +0200
@@ -38,6 +38,7 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
 
 source `dirname $0`/../../bin/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
@@ -142,9 +143,14 @@
 	exit 1
 fi
 
-{
-startup
-$work
-cleanup 0
-}  2>&1 | tee -i $work.log
+if [[ "$WL_DEVELOPER_ENABLED" = "YES" && "$WL_DEVELOPER_EXTERN" = "YES" ]]
+then
+	{
+	startup
+	$work
+	cleanup 0
+	}  2>&1 | tee -i $work.log
+else
+	exit 0
+fi
 
--- orig-1.0.9/wl_developer/bltk_wl_developer.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_developer/bltk_wl_developer.sh	2009-07-13 10:04:45.491608682 +0200
@@ -38,10 +38,13 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
 
 source `dirname $0`/../../bin/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
 
+export USER_DELAY_TMP=$BLTK_HOME/user_delay.tmp
+
 startup()
 {
 	trap 'cleanup 1; exit 1' 1 2 3 15
@@ -173,18 +176,18 @@
 {
 	ST_TIME=`$BLTK_TIME_CMD`
 
-	rm -f ./user_delay.tmp
+	rm -f $USER_DELAY_TMP
 	if [[ $BLTK_WL_FILE != DEBUG && $BLTK_WL_FILE != DEBUG1 ]]
 	then
 		run_cscope_vi
 		wl_check_error $?
 	else
 		sleep 1
-		echo 1.11 >./user_delay.tmp
-		wl_check_error $? "echo 0.11 >./user_delay.tmp failed"
+		echo 1.11 > $USER_DELAY_TMP
+		wl_check_error $? "echo 0.11 > $USER_DELAY_TMP failed"
 	fi
 
-	CMD="cat ./user_delay.tmp"
+	CMD="cat $USER_DELAY_TMP"
 	DELAY_TIME=`$CMD`
 	wl_check_error $? "$CMD failed"
 
@@ -280,7 +283,15 @@
 	exit $1
 }
 
-startup
-run
-cleanup 0
+if [ $WL_DEVELOPER_ENABLED = "YES" ]
+then
+	startup
+	run
+	cleanup 0
+else
+  TTY=`tty`
+  echo "WARNING!!!" > $TTY 2>&1
+  echo "The developer workload is disabled. See manual and use external package." > $TTY 2>&1
+	exit 0
+fi
 
--- orig-1.0.9/wl_game/bltk_wl_game.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_game/bltk_wl_game.sh	2009-07-14 10:29:08.896828960 +0200
@@ -22,16 +22,16 @@
 #    may be used to endorse or promote products derived from this software
 #    without specific prior written permission.
 #
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBGMORS
-#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BGM NOT
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 #  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 #  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#  OWNER OR CONTRIBGMORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BGM NOT LIMITED
-#  TO, PROCUREMENT OF SUBSTITGME GOODS OR SERVICES;
+#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+#  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 #  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 #  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-#  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OGM OF
+#  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
 #  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 #  DAMAGE.
 #
@@ -40,8 +40,11 @@
 
 set -x 
 
+. /etc/bltk.conf
+
 source `dirname $0`/../../bin/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
+
 startup()
 {
 	trap 'cleanup 1; exit 1' 1 2 3 15
@@ -186,7 +189,15 @@
 	exit $1
 }
 
-startup
-run
-cleanup 0
+if [ $WL_GAME_ENABLED = "YES" ]
+then
+	startup
+	run
+	cleanup 0
+else
+  TTY=`tty`
+  echo "WARNING!!!" > $TTY 2>&1
+  echo "The game workload is disabled. Read manual and use external package." > $TTY 2>&1
+	exit 0
+fi
 
--- orig-1.0.9/wl_game/bltk_wl_game_install.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_game/bltk_wl_game_install.sh	2009-07-14 10:34:47.116828423 +0200
@@ -38,6 +38,7 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
 
 source `dirname $0`/../../bin/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
@@ -84,8 +85,6 @@
 }
 make_game_src()
 {
-        
-
         wl_check_file $GAME_SRC_FILE
         wl_check_warning $?
         [[ $? != 0 ]] && return 1
@@ -136,7 +135,7 @@
 
 install()
 {
-	uninstall	
+	uninstall
 	wl_check_error $?
 
 #        make_game_src
@@ -171,9 +170,14 @@
 	exit 1
 fi
 
-{
-startup
-$work
-cleanup 0
-}  2>&1 | tee -i $work.log
+if [[ "$WL_GAME_ENABLED" = "YES" && "$WL_GAME_EXTERN" = "YES" ]]
+then
+	{
+	startup
+	$work
+	cleanup 0
+	}  2>&1 | tee -i $work.log
+else
+	exit 0
+fi
 
--- orig-1.0.9/wl_office/bltk_wl_office_run_app.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_office/bltk_wl_office_run_app.sh	2009-07-13 10:04:45.497608395 +0200
@@ -38,12 +38,14 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
 
 unalias -a
 
 SOFFICE_FLG="-minimized -invisible -norestore -quickstart -nologo -nolockcheck -nodefault"
+WL_OFFICE_WORKING_DIR=${WL_OFFICE_WORKING_DIR:-"~/.bltk"}
 
-$SOFFICE_PROG $SOFFICE_FLG $1 &
+$SOFFICE_PROG $SOFFICE_FLG $WL_OFFICE_WORKING_DIR/$1 &
 
 exit $?
 
--- orig-1.0.9/wl_office/bltk_wl_office_install.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_office/bltk_wl_office_install.sh	2009-07-14 11:25:31.533579648 +0200
@@ -38,6 +38,7 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
 
 source `dirname $0`/../../bin/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
@@ -80,7 +81,6 @@
 
 install_ooo()
 {
-
 	wl_remove_file ${HOME}/.sversionrc
 	wl_check_error $?
 
@@ -91,7 +91,7 @@
 	wl_change_dir $OFFICE_SRC_TMP_DIR
 	wl_check_error $?
 
-	mkdir $OFFICE_TGT_DIR -m 0777 
+	mkdir $OFFICE_TGT_DIR -m 0777
 
 	CMD="$OFFICE_SRC_TMP_DIR/install_linux -l RPMS $OFFICE_TGT_DIR"
 	$CMD
@@ -159,23 +159,27 @@
 
 	wl_remove_dir $OFFICE_TGT_DIR
 	wl_check_error $?
-
 }
 
-if [[ $# = 0 || $1 = i || $1 = install ]]
-then
-	work=install
-elif [[ $1 = u || $1 = uninstall ]]
+if [[ "$WL_OFFICE_ENABLED" = "YES" && "$WL_OFFICE_EXTERN" = "YES" ]]
 then
-	work=uninstall
+	if [[ $# = 0 || $1 = i || $1 = install ]]
+	then
+		work=install
+	elif [[ $1 = u || $1 = uninstall ]]
+	then
+		work=uninstall
+	else
+		echo "Invalid parameter"
+		exit 1
+	fi
+
+	{
+		startup
+		$work
+		cleanup 0
+	}  2>&1 | tee -i $work.log
 else
-	echo "Invalid parameter"
-	exit 1
+	exit 0
 fi
 
-{
-startup
-$work
-cleanup 0
-}  2>&1 | tee -i $work.log
-
--- orig-1.0.9/wl_office/bltk_wl_office.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_office/bltk_wl_office.sh	2009-07-13 16:35:21.801609104 +0200
@@ -38,11 +38,21 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
+
 source `dirname $0`/../../bin/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
 
 XSE_PROG="bltk_wl_office_xse"
 
+WL_OFFICE_WORKING_DIR=${WL_OFFICE_WORKING_DIR:-"~/.bltk"}
+cd $WL_OFFICE_WORKING_DIR
+WL_OFFICE_WORKING_DIR=`pwd`
+cd $OLDPWD
+
+export USER_DELAY_TMP=$BLTK_HOME/user_delay.tmp
+
+
 startup()
 {
 	trap 'cleanup 1; exit 1' 1 2 3 15
@@ -55,7 +65,14 @@
 	wl_check_install office
 	wl_check_error $?
 
-	export SOFFICE_PROG=$HOME/soffice
+	wl_install_file 0644 text1 $WL_OFFICE_WORKING_DIR/text1
+	wl_check_error $?
+	wl_install_file 0644 text2 $WL_OFFICE_WORKING_DIR/text2
+	wl_check_error $?
+	wl_install_file 0644 text3 $WL_OFFICE_WORKING_DIR/text3
+	wl_check_error $?
+
+	export SOFFICE_PROG=${SOFFICE_PROG:-"$HOME/soffice"}
 
 	BLTK_WL_OFFICE_SCEN=$BLTK_WL_FILE
 
@@ -82,39 +99,44 @@
 {
 	ST_TIME=`$BLTK_TIME_CMD`
 
-	wl_remove_file OOWRITER_FILE.odt
+	wl_remove_file $WL_OFFICE_WORKING_DIR/OOWRITER_FILE.odt
 	wl_check_error $?
-	wl_copy_file OOWRITER_FILE_SAMPLE.odt OOWRITER_FILE.odt
+	wl_install_file 0644 OOWRITER_FILE_SAMPLE.odt $WL_OFFICE_WORKING_DIR/OOWRITER_FILE.odt
 	wl_check_error $?
 
-	wl_remove_file OOCALC_FILE.ods
+	wl_remove_file O$WL_OFFICE_WORKING_DIR/OCALC_FILE.ods
 	wl_check_error $?
-	wl_copy_file OOCALC_FILE_SAMPLE.ods OOCALC_FILE.ods
+	wl_install_file 0644 OOCALC_FILE_SAMPLE.ods $WL_OFFICE_WORKING_DIR/OOCALC_FILE.ods
 	wl_check_error $?
 
-	wl_remove_file OODRAW_FILE.odg
+	wl_remove_file $WL_OFFICE_WORKING_DIR/OODRAW_FILE.odg
 	wl_check_error $?
-	wl_copy_file OODRAW_FILE_SAMPLE.odg OODRAW_FILE.odg
+	wl_install_file 0644 OODRAW_FILE_SAMPLE.odg $WL_OFFICE_WORKING_DIR/OODRAW_FILE.odg
 	wl_check_error $?
 
-	wl_remove_file ./user_delay.tmp
+	wl_remove_file $USER_DELAY_TMP
 	wl_check_error $?
 
 	if [[ $BLTK_WL_OFFICE_SCEN = DEBUG ]]
 	then
 		sleep 1
-		echo 0.11 > ./user_delay.tmp
-		wl_check_error $? "echo 1.11 >./user_delay.tmp failed"
+		echo 0.11 > $USER_DELAY_TMP
+		wl_check_error $? "echo 1.11 > $USER_DELAY_TMP failed"
 	elif [[ -f "$BLTK_WL_OFFICE_SCEN" ]]
 	then
 		CMD="$BLTK_WL_BIN/$XSE_PROG $BLTK_WL_OFFICE_SCEN"
 #####		\time -p $CMD >./XSE.times 2>&1
 		$CMD
+		if [ -f $BLTK_STOP_FILE ]
+		then
+			ps -eopid,cmd | grep $WL_OFFICE_WORKING_DIR | sed 's/^ *//' | sed 's/ .*$//' | xargs kill -s SIGKILL
+			exit 0
+		fi
 	else
 		wl_check_error 1 "Cannot access $BLTK_WL_OFFICE_SCEN"
 	fi
 
-	CMD="cat ./user_delay.tmp"
+	CMD="cat $USER_DELAY_TMP"
 	DELAY_TIME=`$CMD`
 	wl_check_error $? "$CMD failed"
 
@@ -159,6 +181,14 @@
 	echo "$CNT: Score $score" >$TTY 2>&1
 }
 
+killchildproc()
+{
+	officeproc = ps -eopid,cmd | grep $WL_OFFICE_WORKING_DIR | sed 's/ .*$//'
+	for i in $officeproc; do
+           sudo kill -s SIFKILL $i
+	done
+}
+
 run()
 {
 	CNT=1
@@ -167,6 +197,7 @@
 		run1
 		if [[ $BLTK_SHOW_DEMO = TRUE && $CNT = $BLTK_SHOW_DEMO_NUM ]]
 		then
+			killchildproc
 			break
 		fi
 		(( CNT++ ))
@@ -179,7 +210,12 @@
 	exit $1
 }
 
-startup
-run
-cleanup 0
+if [ "$WL_OFFICE_ENABLED" = "YES" ]
+then
+	startup
+	run
+	cleanup 0
+else
+	exit 0
+fi
 
--- orig-1.0.9/wl_reader/bltk_wl_reader.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_reader/bltk_wl_reader.sh	2009-07-13 10:04:45.506607930 +0200
@@ -38,6 +38,7 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
 
 source `dirname $0`/../../bin/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
@@ -48,6 +49,13 @@
 
 XSE_PROG="bltk_wl_reader_xse"
 
+WL_READER_WORKING_DIR=${WL_READER_WORKING_DIR:-"~/.bltk"}
+cd $WL_READER_WORKING_DIR
+WL_READER_WORKING_DIR=`pwd`
+cd $OLDPWD
+
+export USER_DELAY_TMP=$BLTK_HOME/user_delay.tmp
+
 startup()
 {
 	trap 'cleanup 1; exit 1' 1 2 3 15
@@ -58,35 +66,35 @@
 ###	wl_check_install reader
 ###	wl_check_error $?
 
-	if [[ -z $BLTK_WL_PROG ]]
+	if [[ -z $BLTK_READER_PROG ]]
 	then
-		export BLTK_WL_PROG=$DEF_BROWSER
-		export BLTK_WL_PROG_FLG=
+		export BLTK_READER_PROG=$DEF_BROWSER
+		export BLTK_READER_PROG_FLG=
 	fi
 
-	wl_check_prog $BLTK_WL_PROG
+	wl_check_prog $BLTK_READER_PROG
 	wl_check_error $?
 
-	wl_check_run_prog $BLTK_WL_PROG
+	wl_check_run_prog $BLTK_READER_PROG
 	wl_check_error $?
 
-	echo "Browser	$BLTK_WL_PROG"
+	echo "Browser	$BLTK_READER_PROG"
 
-	wl_check_all_run_prog $BLTK_WL_PROG
+	wl_check_all_run_prog $BLTK_READER_PROG
 	wl_check_error $?
 
 	tmp_reader_file=/tmp/$DEF_FILE
 
-	if [[ $BLTK_WL_FILE = DEBUG ]]
+	if [[ $BLTK_READER_FILE = DEBUG ]]
 	then
-		BLTK_WL_FILE=
+		BLTK_READER_FILE=
 	fi
 
-	if [[ ! -z $BLTK_WL_FILE ]]
+	if [[ ! -z $BLTK_READER_FILE ]]
 	then
-		reader_file=$BLTK_WL_FILE
+		reader_file=$BLTK_READER_FILE
 		title="$BLTK_WL_TITLE"
-		flags="$BLTK_WL_PROG_FLG"
+		flags="$BLTK_READER_PROG_FLG"
 	else
 		default_flg=TRUE
 		reader_file=$DEF_FILE
@@ -139,13 +147,13 @@
 {
 	ST_TIME=`$BLTK_TIME_CMD`
 
-	rm -f ./user_delay.tmp
+	rm -f $USER_DELAY_TMP
 
-	CMD="$BLTK_WL_PROG $BLTK_WL_PROG_FLG $reader_file"
+	CMD="$BLTK_READER_PROG $BLTK_WL_PROG_FLG $reader_file"
 	$CMD &
 	wl_check_error $? "$CMD failed"
 
-	BLTK_WL_ALL_PROC_NAME="$BLTK_WL_ALL_PROC_NAME $BLTK_WL_PROG"
+	BLTK_WL_ALL_PROC_NAME="$BLTK_WL_ALL_PROC_NAME $BLTK_READER_PROG"
 
 	windowid=`bltk_winid -S "$title"`
 	wl_check_error $? "Cannot get windowid of $BLTK_WL_PRO"
@@ -157,11 +165,17 @@
 
 	CMD="$BLTK_WL_BIN/$XSE_PROG"
 	$CMD
+	if [ -f $BLTK_STOP_FILE ]
+	then
+		ps -eopid,cmd | grep $BLTK_READER_PROG | sed 's/^ *//' | sed 's/ .*$//' | xargs kill -s SIGKILL
+		exit 0
+	fi
+
 	wl_check_error $? "$CMD failed"
 
 	BLTK_WL_PROC_NAME="$BLTK_WL_PROC_NAME $XSE_PROG"
 
-	CMD="cat ./user_delay.tmp"
+	CMD="cat $USER_DELAY_TMP"
 	DELAY_TIME=`$CMD`
 	wl_check_error $? "$CMD failed"
 
@@ -200,7 +214,12 @@
 	exit $1
 }
 
-startup
-run
-cleanup 0
+if [ "$WL_READER_ENABLED" = "YES" ]
+then
+	startup
+	run
+	cleanup 0
+else
+	exit 0
+fi
 
--- orig-1.0.9/wl_reader/bltk_wl_reader_install.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_reader/bltk_wl_reader_install.sh	2009-07-13 10:04:45.516606637 +0200
@@ -38,6 +38,7 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
 
 source `dirname $0`/../../bin/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
@@ -92,9 +93,14 @@
 	exit 1
 fi
 
-{
-startup
-$work
-cleanup 0
-}  2>&1 | tee -i $work.log
+if [[ "$WL_READER_ENABLED" = "YES" && "$WL_READER_EXTERN" = "YES" ]]
+then
+	{
+	startup
+	$work
+	cleanup 0
+	}  2>&1 | tee -i $work.log
+else
+	exit 0
+fi
 
--- orig-1.0.9/wl_player/bltk_wl_player_make_binary.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_player/bltk_wl_player_make_binary.sh	2009-07-13 10:04:45.516606637 +0200
@@ -108,9 +108,13 @@
 	return 0
 }
 
-{
-startup
-make_mplayer_bin
-cleanup 0
-}
-
+if [[ "$WL_PLAYER_ENABLED" = "YES" && "$WL_PLAYER_EXTERN" = "YES" ]]
+then
+	{
+	startup
+	make_mplayer_bin
+	cleanup 0
+	}
+else
+	exit 0
+fi
--- orig-1.0.9/wl_player/bltk_wl_player.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_player/bltk_wl_player.sh	2009-07-13 21:40:36.851413991 +0200
@@ -38,6 +38,9 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+BLTK_PLAYER_PROG_FLG=
+
+. /etc/bltk.conf
 
 source `dirname $0`/../../bin/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
@@ -54,27 +57,22 @@
 	wl_check_install player
 	wl_check_error $?
 
-	if [[ $BLTK_WL_FILE = DEBUG ]]
+	if [[ $BLTK_PLAYER_FILE = DEBUG ]]
 	then
-		BLTK_WL_FILE=
+		BLTK_PLAYER_FILE=
 	fi
-	if [ $PLAY_MD != "dvd://" -a $PLAY_MD != "vcd://" ]
+	if [[ -z $BLTK_PLAYER_FILE ]]
 	then
-		BLTK_WL_FILE=$BLTK_EXTERN_SRC_WL_PLAYER/$PLAY_MD
-	else 
-		set_dvd_config
-		BLTK_WL_FILE=$PLAY_MD
+		BLTK_PLAYER_FILE="dvd://"
 	fi
 
-echo ALEX DEBUG BLTK_WL_FILE is $BLTK_WL_FILE 
-
-	if [[ -z $BLTK_WL_PROG ]]
-	then
-		BLTK_WL_PROG=$BLTK_EXTERN_TGT_WL_PLAYER/mplayer/bin/mplayer
-	fi
-	if [[ -z $BLTK_WL_PROG_FLG ]]
+	if [[ -z $BLTK_PLAYER_PROG ]]
 	then
-		BLTK_WL_PROG_FLG="-fs -quiet"
+		BLTK_PLAYER_PROG=$BLTK_EXTERN_TGT_WL_PLAYER/mplayer/bin/mplayer
+		if [[ -z $BLTK_PLAYER_PROG_FLG ]]
+		then
+			BLTK_PLAYER_PROG_FLG="-fs -quiet"
+		fi
 	fi
 
 	if [[ -z $BLTK_SHOW_DEMO_NUM ]]
@@ -86,13 +84,13 @@
 		export BLTK_SHOW_DEMO_TIME=60
 	fi
 
-	wl_check_prog $BLTK_WL_PROG
+	wl_check_prog $BLTK_PLAYER_PROG
 	wl_check_error $?
 
-	wl_check_run_prog $BLTK_WL_PROG
+	wl_check_run_prog $BLTK_PLAYER_PROG
 	wl_check_error $?
 
-	wl_check_all_run_prog $BLTK_WL_PROG
+	wl_check_all_run_prog $BLTK_PLAYER_PROG
 	wl_check_error $?
 ###	env | sort >env.log
 }
@@ -122,14 +120,14 @@
 {
 	ST_TIME=`$BLTK_TIME_CMD`
 
-	CMD="$BLTK_WL_PROG $BLTK_WL_PROG_FLG $BLTK_WL_FILE"
+	CMD="$BLTK_PLAYER_PROG $BLTK_WL_PROG_FLG $BLTK_PLAYER_FILE"
 	if [[ $BLTK_SHOW_DEMO = TRUE && $BLTK_SHOW_DEMO_TIME != 0 ]]
 	then
 		$CMD &
 		wl_check_error $? "CMD failed"
 		pid=$!
 		sleep $BLTK_SHOW_DEMO_TIME
-		prog=`basename $BLTK_WL_PROG`
+		prog=`basename $BLTK_PLAYER_PROG`
 		pgrep $prog
 		wl_check_error $? "$prog is not running"
 		/bin/kill -QUIT $pid >/dev/null 2>&1
@@ -180,7 +178,12 @@
 	exit $1
 }
 
-startup
-run
-cleanup 0
+if [ "$WL_PLAYER_ENABLED" = "YES" ]
+then
+	startup
+	run
+	cleanup 0
+else
+	exit 0
+fi
 
--- orig-1.0.9/wl_player/bltk_wl_player_install.sh	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_player/bltk_wl_player_install.sh	2009-07-13 10:04:45.517607555 +0200
@@ -38,6 +38,7 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 
+. /etc/bltk.conf
 
 source `dirname $0`/../../bin/bltk_wl_common
 [[ $? != 0 ]] && { echo "bltk tree corrupted"; exit 2; }
@@ -284,9 +285,14 @@
 	exit 1
 fi
 
-{
-startup
-$work
-cleanup 0
-}  2>&1 | tee -i $work.log
+if [[ "$WL_PLAYER_ENABLED" = "YES" && "$WL_PLAYER_EXTERN" = "YES" ]]
+then
+	{
+	startup
+	$work
+	cleanup 0
+	}  2>&1 | tee -i $work.log
+else
+	exit 0
+fi
 
--- orig-1.0.9/tools/sudo/Makefile	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/sudo/Makefile	2009-07-13 10:04:45.466889192 +0200
@@ -34,8 +34,10 @@
 
 
 install : FORCE
+ifndef PACKAGE_BUILD
 	@echo Root password is required
 	@su root -c "chown root:root $(TARGETS); chmod +s $(TARGETS)"
+endif
 
 clean :
 	@$(RM) $(TARGETS) *.o $(SHTARGETS) *~
--- orig-1.0.9/tools/bltk/Makefile	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/bltk/Makefile	2009-07-13 10:04:45.478608338 +0200
@@ -4,12 +4,12 @@
 
 BIN		= ../../bin
 
-FILES		= main init file stat
+FILES		= main init file stat parseconf
 
 OFILES		= ${FILES:=.o}
 CFILES		= ${FILES:=.c}
 
-HIDERS		= ../../include/bltk.h
+HIDERS		= ../../include/bltk.h ../../include/parseconf.h
 
 TARGETS		= $(BIN)/bltk
 
@@ -38,6 +38,7 @@
 init.o : $(HIDERS) init.c
 file.o : $(HIDERS) file.c
 stat.o : $(HIDERS) stat.c
+parseconf.o : $(HIDERS) parseconf.c
 
 $(SHTARGETS) : $(SHFILES_SH)
 	cp $(@:$(BIN)/%=%.sh) $@
--- orig-1.0.9/tools/analyzer/Makefile	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/analyzer/Makefile	2009-07-13 10:04:45.488609629 +0200
@@ -15,7 +15,7 @@
 
 SHFILES		= bltk_get_stat bltk_report bltk_report_table bltk_report_check \
 			bltk_plot bltk_get_hd_rpm \
-			bltk_report_compress bltk_report_uncompress
+			bltk_report_compress bltk_report_uncompress bltk_func
 SHFILES_SH	= ${SHFILES:=.sh}
 SHTARGETS	= $(SHFILES:%=$(BIN)/%)
 
--- orig-1.0.9/tools/xse/Makefile	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/tools/xse/Makefile	2009-07-13 10:04:45.490608952 +0200
@@ -1,10 +1,10 @@
 
 CFLAGS		= -Wall -pedantic -std=c99 -g -O2 -I ../../include -fPIC
-LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11
+LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 -Wl,-soname -Wl,libxse.so.0
 
 LIB		= ../../lib
 
-LIBNAME		= libxse.so
+LIBNAME		= libxse.so.0
 TARGET		= $(LIB)/$(LIBNAME)
 FILES		= xse
 OFILES		= ${FILES:=.o}
--- orig-1.0.9/wl_developer/Makefile	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_developer/Makefile	2009-07-13 10:04:45.492608344 +0200
@@ -1,6 +1,6 @@
 
 CFLAGS		= -Wall -pedantic -std=c99 -g -O2 -I../include
-LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 -lxse -L../lib
+LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 ../lib/libxse.so.0 -Wl,-rpath,/usr/lib/bltk
 
 BIN		= bin
 
@@ -15,7 +15,7 @@
 SHFILES_SH	= ${SHFILES:=.sh}
 SHTARGETS	= $(SHFILES:%=$(BIN)/%)
 
-EXTERN_DEPS	=  $(HIDERS) ../lib/libxse.so
+EXTERN_DEPS	=  $(HIDERS) ../lib/libxse.so.0
 
 
 all : $(BIN) $(SUBDIRS) $(TARGET) $(SHTARGETS) FORCE
--- orig-1.0.9/wl_game/Makefile	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_game/Makefile	2009-07-13 10:04:45.496609014 +0200
@@ -1,6 +1,6 @@
 
 CFLAGS		= -Wall -pedantic -std=c99 -g -O2 -I../include
-LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 -lxse -L../lib
+LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 ../lib/libxse.so.0 -Wl,-rpath,/usr/lib/bltk
 
 BIN		= bin
 
@@ -18,7 +18,7 @@
 DATAFILES	=
 DATATARGETS	= $(DATAFILES:%=$(BIN)/%)
 
-EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so
+EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so.0
 
 
 all : $(BIN) $(SUBDIRS) $(TARGET) $(TARGET1) $(TARGET2) $(SHTARGETS) $(DATATARGETS)
--- orig-1.0.9/wl_office/Makefile	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_office/Makefile	2009-07-13 21:42:35.715350673 +0200
@@ -1,6 +1,6 @@
 
 CFLAGS		= -Wall -pedantic -std=c99 -g -O2 -I../include
-LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 -lxse -L../lib
+LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 ../lib/libxse.so.0 -Wl,-rpath,/usr/lib/bltk
 
 BIN		= bin
 
@@ -15,10 +15,10 @@
 SHFILES_SH	= ${SHFILES:=.sh}
 SHTARGETS	= $(SHFILES:%=$(BIN)/%)
 
-DATAFILES	= scen_install 
+DATAFILES	= scen_install
 DATATARGETS	= $(DATAFILES:%=$(BIN)/%)
 
-EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so
+EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so.0
 
 
 all : $(BIN) $(SUBDIRS) $(TARGET) $(TARGET1) $(TARGET2) $(SHTARGETS) $(DATATARGETS)
--- orig-1.0.9/wl_reader/Makefile	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_reader/Makefile	2009-07-13 10:04:45.516606637 +0200
@@ -1,6 +1,6 @@
 
 CFLAGS		= -Wall -pedantic -std=c99 -g -O2 -I../include
-LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 -lxse -L ../lib
+LDFLAGS		= -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11 ../lib/libxse.so.0 -Wl,-rpath,/usr/lib/bltk
 
 BIN		= bin
 
@@ -17,7 +17,7 @@
 SHFILES_SH	= ${SHFILES:=.sh}
 SHTARGETS	= $(SHFILES:%=$(BIN)/%)
 
-EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so
+EXTERN_DEPS	= $(HIDERS) ../lib/libxse.so.0
 
 
 all : $(BIN) $(SUBDIRS) $(TARGETS) $(SHTARGETS) FORCE
--- orig-1.0.9/wl_office/scen	2009-04-10 09:14:20.000000000 +0200
+++ curr-1.0.9/wl_office/scen	2009-07-13 10:04:45.497608395 +0200
@@ -20,9 +20,8 @@
 PRESSKEY	0	2	3000	Return
 DELAY		0	0	3000	0
 
-#PRESSKEY	A	0	1000	e
-#PRESSKEY	0	11	150	Down
-PRESSKEY	C	0	1000	f
+PRESSKEY	A	0	1000	e
+PRESSKEY	0	0	150	f
 DELAY		0	0	2000	0
 PRESSKEY	0	0	2000	Return
 
@@ -35,7 +34,7 @@
 DELAY		0	0	2000	0
 PRESSKEY	A	0	3000	l
 
-SETWINDOW	0	0	0	\"OpenOffice.org 3.0 \":
+SETWINDOW	0	0	0	\"OpenOffice.org .* \":
 
 FOCUSIN		0	0	150	0
 DELAY		0	0	3000	0
@@ -43,7 +42,7 @@
 RELEASEKEY	0	0	1000	Return
 DELAY		0	0	2000	0
 
-ENDWINDOW	0	0	0	\"OpenOffice.org 3.0 \":
+ENDWINDOW	0	0	0	\"OpenOffice.org .* \":
 
 SETWINDOW	0	0	0	Find & Replace
 
@@ -63,14 +62,12 @@
 PRESSKEY	0	2	3000	Return
 DELAY		0	0	3000	0
 
-#PRESSKEY	A	0	1000	f
-#PRESSKEY	0	4	150	Down
-PRESSKEY	C	0	1000	s
+PRESSKEY	A	0	1000	f
+PRESSKEY	0	0	150	s
 DELAY		0	0	2000	0
 PRESSKEY	A	0	1000	f
-PRESSKEY	0	18	150	Down
+PRESSKEY	0	0	150	x
 DELAY		0	0	3000	0
-PRESSKEY	0	0	6000	Return
 
 ENDWINDOW	0	0	0	OOWRITER_FILE.odt
 
@@ -156,14 +153,13 @@
 TYPETEXT	0	0	150	Total Pays
 
 DELAY		0	0	3000	0
-#PRESSKEY	A	0	1000	f
-#PRESSKEY	0	4	150	Down
-PRESSKEY	C	0	1000	s
+PRESSKEY	A	0	1000	f
+PRESSKEY	0	0	150	s
 DELAY		0	0	2000	0
+DELAY		0	0	3000	0
 PRESSKEY	A	0	1000	f
-PRESSKEY	0	18	150	Down
+PRESSKEY	0	0	150	x
 DELAY		0	0	3000	0
-PRESSKEY	0	0	5000	Return
 
 ENDWINDOW	0	0	0	OOCALC_FILE.ods
 
@@ -187,7 +183,7 @@
 PRESSKEY	0	0	1000	Tab
 
 PRESSKEY	A	0	1000	e
-PRESSKEY	0	5	150	Down
+PRESSKEY	0	0	150	e
 DELAY		0	0	1000	0
 PRESSKEY	0	0	500	Return
 
@@ -224,116 +220,27 @@
 DELAY		0	0	3000	0
 
 PRESSKEY	A	0	1000	v
-DELAY		0	0	2000	0
-PRESSKEY	0	0	1000	z
-PRESSKEY	0	0	500	Return
+PRESSKEY	0	0	500	z
 
-SETWINDOW	0	0	0	Zoom & View Layout
+SETWINDOW	0	0	0	Zoom
 
 FOCUSIN		0	0	150	0
 DELAY		0	0	1000	0
 PRESSKEY	S	5	150	Right
-TYPETEXT	0	0	150	150
+TYPETEXT	0	0	150	100
 PRESSKEY	0	0	500	Return
-RELEASEKEY	0	0	1000	Return
+RELEASEKEY	0	0	500	Return
 
-ENDWINDOW	0	0	0	Zoom & View Layout
+ENDWINDOW	0	0	0	Zoom
 
 SETWINDOW	0	0	0	OODRAW_FILE.odg
 
 FOCUSIN		0	0	150	0
 DELAY		0	0	2000	0
-PRESSKEY	A	0	1000	i
-PRESSKEY	0	0	150	o
-DELAY		0	0	1000	0
-PRESSKEY	0	0	150	o
-DELAY		0	0	1000	0
-PRESSKEY	0	1	500	Return
-
-SETWINDOW	0	0	0	Insert OLE Object
-
-FOCUSIN		0	0	150	0
-PRESSKEY	0	0	500	Return
-RELEASEKEY	0	0	1000	Return
-
-ENDWINDOW	0	0	0	Insert OLE Object
-
-SETWINDOW	0	0	0	OODRAW_FILE.odg
-
-FOCUSIN		0	0	150	0
-TYPETEXT	0	0	150	Name
-PRESSKEY	0	0	1000	Right
-TYPETEXT	0	0	150	Workdays
-PRESSKEY	0	0	1000	Right
-TYPETEXT	0	0	150	Pay Rate
-PRESSKEY	0	0	1000	Right
-TYPETEXT	0	0	150	Salary
-PRESSKEY	0	0	1000	Down
-PRESSKEY	0	3	500	Left
-
-DELAY		0	0	3000	0
-TYPETEXT	0	0	150	John
-PRESSKEY	0	0	1000	Down
-TYPETEXT	0	0	150	Jane
-PRESSKEY	0	0	1000	Down
-TYPETEXT	0	0	150	Sam
-PRESSKEY	0	0	1000	Down
-TYPETEXT	0	0	150	Sarah
-PRESSKEY	0	0	1000	Right
-PRESSKEY	0	3	500	Up
-
-DELAY		0	0	3000	0
-TYPETEXT	0	0	150	12
-PRESSKEY	0	0	1000	Down
-TYPETEXT	0	0	150	20
-PRESSKEY	0	0	1000	Down
-TYPETEXT	0	0	150	15
-PRESSKEY	0	0	1000	Down
-TYPETEXT	0	0	150	10
-PRESSKEY	0	0	1000	Right
-PRESSKEY	0	3	500	Up
-
-DELAY		0	0	3000	0
-TYPETEXT	0	0	150	25
-PRESSKEY	0	0	1000	Down
-TYPETEXT	0	0	150	20
-PRESSKEY	0	0	1000	Down
-TYPETEXT	0	0	150	25
-PRESSKEY	0	0	1000	Down
-TYPETEXT	0	0	150	40
-PRESSKEY	0	0	1000	Right
-PRESSKEY	0	3	500	Up
-
-DELAY		0	0	3000	0
-TYPETEXT	0	0	300	=b2*c2
-DELAY		0	0	1000	0
-PRESSKEY	0	0	1000	Return
-PRESSKEY	0	0	1000	Up
-PRESSKEY	C	0	1000	c
-PRESSKEY	0	0	200	Down
-PRESSKEY	S	2	500	Down
-PRESSKEY	C	0	1000	v
-
-DELAY		0	0	3000	0
-PRESSKEY	0	0	1000	Down
-TYPETEXT	0	0	300	=sum(
-PRESSKEY	0	0	500	Up
-PRESSKEY	S	3	500	Up
-TYPETEXT	0	0	500	)
-DELAY		0	0	1000	0
-PRESSKEY	0	0	1000	Return
-
-DELAY		0	0	3000	0
-PRESSKEY	0	0	1000	Left
-PRESSKEY	0	0	1000	Up
-TYPETEXT	0	0	150	Total Pays
-
-DELAY		0	0	3000	0
-PRESSKEY	0	3	3000	Esc
 
 PRESSKEY	A	0	1000	f
 PRESSKEY	0	0	150	s
-DELAY		0	0	3000	0
+DELAY		0	0	2000	0
 
 PRESSKEY	A	0	1000	f
 PRESSKEY	0	0	150	x