File pgaccess.patch of Package pgaccess

--- Makefile
+++ Makefile
@@ -7,20 +7,21 @@
 #
 #-------------------------------------------------------------------------
 
-bindir = /usr/bin/X11
+bindir = /usr/bin
 libdir = /usr/lib
 wish = /usr/bin/wish
+DESTDIR=
 
 pgaccess: 
 	chmod a+x pgaccess.tcl
-	mkdir -p $(libdir)/pgaccess
-	cp -R * $(libdir)/pgaccess
-	ln -sf $(libdir)/pgaccess.tcl $(bindir)/pgaccess
+	mkdir -p $(DESTDIR)$(libdir)/pgaccess $(DESTDIR)$(bindir)
+	cp -R * $(DESTDIR)$(libdir)/pgaccess
+	ln -sf $(libdir)/pgaccess/pgaccess.tcl $(DESTDIR)$(bindir)/pgaccess
 
 all: pgaccess
 
 install: pgaccess
 
 clean:
-	rm -rf $(libdir)/pgaccess
-	rm -rf $(bindir)/pgaccess
+	rm -rf $(DESTDIR)$(libdir)/pgaccess
+	rm -rf $(DESTDIR)$(bindir)/pgaccess
--- lib/connections.tcl
+++ lib/connections.tcl
@@ -634,7 +634,7 @@
             return 0
         }
     }
-puts "RES: $pgres"
+#puts "RES: $pgres"
     catch {pg_result $pgres -clear}
 
     return 1
--- pgaccess.tcl
+++ pgaccess.tcl
@@ -76,7 +76,7 @@
 
 proc set_defaults {} {
 global PgAcVar CurrentDB
-	puts "\nSetting the default values:"
+	#puts "\nSetting the default values:"
 
 	array set def_vars {
 		PgAcVar(currentdb,host) ""
@@ -104,13 +104,22 @@
 	foreach i [array names def_vars] {
 		if {![info exists $i]} {
 			set $i $def_vars($i)
-			puts "\t$i: $def_vars($i)"
+			#puts "\t$i: $def_vars($i)"
 		}
 	}
 
 	# the script's home dir
 	if {![info exists PgAcVar(PGACCESS_HOME)]} {
-		set home [file dirname [info script]]
+		set script [info script]
+		while {[file type $script] eq "link"} {
+		    set s [file readlink $script]
+		    if {[file pathtype $s] eq "relative"} {
+			set script [file normalize [file join [file dirname $script] $s]]
+		    } else {
+			set script $s
+		    }
+		}
+		set home [file dirname $script]
 		switch [file pathtype $home] {
 			absolute {set PgAcVar(PGACCESS_HOME) $home}
 			relative {set PgAcVar(PGACCESS_HOME) [file join [pwd] $home]}
@@ -121,7 +130,7 @@
 				cd $curdir
 			}
 		}
-		puts "\tPGACCESS_HOME: $PgAcVar(PGACCESS_HOME)"
+		#puts "\tPGACCESS_HOME: $PgAcVar(PGACCESS_HOME)"
 	}
 	
 	# The path to the libpgtcl shared object lib.
@@ -156,13 +165,13 @@
 				set PgAcVar(PGLIB) ""
 			}
 		}
-		puts "\tPGLIB: $PgAcVar(PGLIB)"
+		#puts "\tPGLIB: $PgAcVar(PGLIB)"
 	}
 }
 
 proc load_conf_file {filename} {
 global PgAcVar
-	puts "\nLoading the $filename config file:"
+	#puts "\nLoading the $filename config file:"
 	if {![file exists $filename]} {
 		return 0
 	}
@@ -197,7 +206,7 @@
 
 proc load_env_vars {} {
 global PgAcVar env
-	puts "\nLoading the enviroment variables:"
+	#puts "\nLoading the enviroment variables:"
 	set var_list {PGACCESS_HOME PGLIB PGPORT}
 
 	foreach i $var_list {
@@ -212,7 +221,7 @@
 
 proc parse_cmd_line {} {
 global PgAcVar argv
-    puts "Parsing the command line parameters:"
+    #puts "Parsing the command line parameters:"
     if {[catch {package require cmdline} msg]} {
         puts "\tCouldn't find cmdline package elsewhere on your machine."
         puts "\tNow trying to load the cmdline package from PgAccess."
@@ -441,75 +450,58 @@
 
     # only load PGLIB if PGINTCL not specified on command line
     if {![info exists PgAcVar(PGINTCL)]} {
-		set shlib [file join $PgAcVar(PGLIB) libpgtcl][info sharedlibextension]
-		if {![file exists $shlib]} {
-			puts "\nError: Shared library file: '$shlib' does not exist. \n\
-				Check this file, or check PGLIB variable (in pgaccess.cfg)\n"
-			#exit
-            puts "====> Using pgin.tcl instead\n"
-            set PgAcVar(PGINTCL) 1
-		}
-
-		if {[catch {load $shlib} err]} {
-			puts "Error: can not load $shlib shared library."
-			puts "You need to make sure that the library exists and"
-			puts "the environment variable PGLIB points to the directory"
-			puts "where it is located.\n"
-			puts "If you use Windows, be sure that the needed libpgtcl.dll"
-			puts "and libpq.dll files are copied in the Windows/System"
-			puts "directory"
-			puts "\nERROR MESSAGE: $err\n"
-			#exit
+	if {[catch {package require Pgtcl} err]} {
+	    puts "Error: can not load package Pgtcl."
             puts "====> Using pgin.tcl instead\n"
             set PgAcVar(PGINTCL) 1
-		}
+	}
     }
 
 	# Loading all defined namespaces
-	puts -nonewline "\nLoading namespaces:"
+	#puts -nonewline "\nLoading namespaces:"
 	foreach module {mainlib stack syntax database debug tables queries visualqb forms views functions reports scripts usergroups sequences diagrams help preferences printer importexport connections graphs pgackages images} {
-		puts -nonewline " $module"
-		flush stdout
+		#puts -nonewline " $module"
+		#flush stdout
 		if {[catch {source [file join $PgAcVar(PGACCESS_HOME) lib $module.tcl]} msg]} {
 			puts "\nERROR: $msg"
 			puts "Please check your installation or set the PGACCESS_HOME ($PgAcVar(PGACCESS_HOME)) variable properly!" 
 			exit -1
 		}
 	}
-	puts ""
+	#puts ""
 
 	##  Loadin plugins
-	puts -nonewline "\nLoading plugins:"
+	#puts -nonewline "\nLoading plugins:"
 	foreach plugin [glob -nocomplain [file join $PgAcVar(PGACCESS_HOME) lib plugins *.tcl]] {
         # special check for pgin.tcl
         if {[string match "pgin" [file rootname [file tail $plugin]]] && ![info exists PgAcVar(PGINTCL)]} {
-            puts -nonewline " [file rootname [file tail $plugin]]-(NOT LOADED)"
-            flush stdout
+            #puts -nonewline " [file rootname [file tail $plugin]]-(NOT LOADED)"
+            #flush stdout
         } else {
-            puts -nonewline " [file rootname [file tail $plugin]]"
-            flush stdout
+            #puts -nonewline " [file rootname [file tail $plugin]]"
+            #flush stdout
             source $plugin
         }
 	}
-	puts ""
+	#puts ""
 
 	Preferences::load
 
 	Connections::load
 
 	#  Loading the required packages
-	puts "\nLoading the required packages:"
+	#puts "\nLoading the required packages:"
 	lappend ::auto_path [file join $PgAcVar(PGACCESS_HOME) lib] [file join $PgAcVar(PGACCESS_HOME) lib widgets]
-	if {[catch [
-		puts "\ttablelist: [package require tablelist 2.7]"
-		puts "\tBWidget: [package require BWidget]"
-		puts "\ticons: [package require icons]"
-		puts "\tbase64: [package require base64]"
-		puts "\tcsv: [package require csv]"
-		puts "\tfileutil: [package require fileutil]"
-		puts "\ttkwizard: [package require tkwizard]"
-	] msg]} {
-		puts $msg
+	if {[catch {
+		package require tablelist 2.7
+		package require BWidget
+		package require icons
+		package require base64
+		package require csv
+		package require fileutil
+		package require tkwizard
+	} msg]} {
+		puts $::errorInfo
 		puts "\n[intlmsg {Please install the required packages:}]\n"
 		puts "\ttablelist: http:://www.nemethi.de"
 		puts "\ttcllib: http:://www.sourceforge.net/projects/tcllib"
@@ -517,7 +509,7 @@
         puts "\ttkwizard: http://www2.clearlight.com/~oakley/tcl/tkwizard/"
 	}
 
-    puts ""
+	#puts ""
 
 	# Creating icons
 	::icons::icons create \
openSUSE Build Service is sponsored by