File: mysql-query-browser

package info (click to toggle)
mysql-gui-tools 5.0r14%2BopenSUSE-2.1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 116,956 kB
  • ctags: 48,715
  • sloc: sql: 341,918; pascal: 276,698; ansic: 91,020; cpp: 90,451; objc: 33,236; sh: 29,481; yacc: 10,756; xml: 10,589; java: 10,079; php: 2,806; python: 2,092; makefile: 1,783; perl: 4
file content (106 lines) | stat: -rw-r--r-- 3,205 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh

PRG="$0"

# need this for relative symlinks
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done

DIRNAME=`dirname $PRG`

tmp_DIRNAME1=`cd $DIRNAME/..; pwd`
tmp_DIRNAME2=`cd $DIRNAME; pwd`

if [ -d "$tmp_DIRNAME1/share" ]; then
    # installed to /
    DIRNAME="$tmp_DIRNAME1"
    LIBPREFIX="$DIRNAME/lib/mysql-gui"
elif [ -d "$tmp_DIRNAME2/share" ]; then
    # installed to /opt or something similar
    DIRNAME="$tmp_DIRNAME2"
    LIBPREFIX="$DIRNAME"
else
    echo "Data files not found. Please check your installation."
    exit 1
fi

if [ -f "$LIBPREFIX/lib/pango.modules" ]; then
    bundled_deps=1
else
    bundled_deps=0
fi

export MQB_DIR="$DIRNAME"
export LD_LIBRARY_PATH="$LIBPREFIX/lib:$LD_LIBRARY_PATH"

### begin stuff needed for bundled gtk libraries
pangorc_path=$LIBPREFIX/lib/pangorc
gdkpixbuf_path=$LIBPREFIX/lib/gdk-pixbuf.loaders
pangomodules_path=$LIBPREFIX/lib/pango.modules
desktopfile_path=$DIRNAME/MySQLQueryBrowser.desktop

if [ $bundled_deps -ne 0 ]; then
    args=""
    for arg in $*; do
        if test $arg = "--update-paths"; then
            echo "Updating `basename $0` installation paths..."
            old_prefix=$(grep ModuleFiles $pangorc_path|sed -e 's#.*=.\?\(/.*\)/lib/pango.modules#\1#')
            new_prefix=$LIBPREFIX

            # replace paths in our custom configuration files
            for f in $pangorc_path $gdkpixbuf_path $pangomodules_path $desktopfile_path; do
                sed -e "s:$old_prefix:$new_prefix:g" $f > $f.bak
                if [ $? -ne 0 ]; then
                    echo "Error updating files for new installation path."
                    echo "Please make sure `basename $0` is installed correctly and you have"
                    echo "proper write permissions in the installation directory."
                    exit 1
                fi
                mv $f.bak $f
                if [ $? -ne 0 ]; then
                    echo "Error updating files for new installation path."
                    echo "Please make sure `basename $0` is installed correctly and you have"
                    echo "proper write permissions in the installation directory."
                    exit 1
                fi
            done
            echo "Done."
            exit
        else
            args="$args \"$arg\""
        fi
    done


    # if we're in a bundle, make sure the paths in the pango and gdk-pixbuf
    # loaders are correct
    export GDK_PIXBUF_MODULE_FILE="$gdkpixbuf_path"
    export PANGO_RC_FILE="$pangorc_path"
    export GTK_EXE_PREFIX="$LIBPREFIX"

    prefix=$(grep ModuleFiles $pangorc_path|sed -e 's#.*=.\?\(/.*\)/lib/pango.modules#\1#')
        
    if ! [ -f "$prefix/lib/pango.modules" ]; then
        cat <<EOF
Error starting $0.
The actual installation path of `basename $0` is different from the
expected one. Please run $0 --update-paths (as the root
user, if needed) to have the installation directory updated.
EOF
        exit 1
    fi
else
    args="$@"
fi
### end stuff needed for bundled gtk libraries


$PRG-bin $args