/usr/share/rheolef/check-shlibpath_var.sh is in librheolef1 6.7-6.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | #!/bin/sh
#
# This file is part of Rheolef.
#
# Copyright (C) 2000-2009 Pierre Saramito
#
# Rheolef is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Rheolef is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rheolef; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -------------------------------------------------------------------------
# -------------------------------------------------------------------
# check environment variables in an installed Rheolef
#
# author: Pierre.Saramito@imag.fr
#
# date: 6 january 2003
# -------------------------------------------------------------------
# TODO:
# - check MANPATH for good version and no mistakes
# -------------------------------------------------------------------
#set -x
if test $# -lt 3; then
echo "usage: $0 <shlibpath_var> <libdir> <bindir>" >&2; exit 1
fi
shlibpath_var=$1
libdir=$2
bindir=$3
# -------------------------------------------------------------------
# get basics from environment
# -------------------------------------------------------------------
if test -x /bin/pwd; then
# solve symlinks
BINPWD=/bin/pwd
else
# built-in pwd
BINPWD=pwd
fi
# -------------------------------------------------------------------
# check PATH
# -------------------------------------------------------------------
if test x$PATH = x,; then
echo " *** INCREDIBLE ***"
echo " Your PATH environment variable is not set !"
echo $LINE; exit 1
fi
path_list=`echo $PATH | sed -e 's/:/ /g'`
new_path_list=""
for d in $path_list; do
#echo "DIR $d"
if test -d $d && cd $d 2>/dev/null; then
d_solved=`$BINPWD 2>/dev/null`
cd $here
new_path_list="${new_path_list} ${d_solved}"
fi
done
path_list=${new_path_list}
# -------------------------------------------------------------------
# check ypcat
# -------------------------------------------------------------------
ypcat=""
for d in $path_list; do
if test -x $d/ypcat; then
ypcat=$d/ypcat
break
fi
done
# -------------------------------------------------------------------
# check SHELL
# -------------------------------------------------------------------
if test "$USER" != "" -a "$ypcat" != ""; then
USER_SHELL=`$ypcat passwd 2>/dev/null | grep "$USER" | awk -F ":" '{print $7}'`
elif test "$USER" != "" -a -r /etc/passwd; then
USER_SHELL=`grep "$USER" /etc/passwd | awk -F ":" '{print $7}'`
fi
case "$USER_SHELL" in
*/csh | */tcsh)
shell_path=path
shell_style=c
shell_rc='~/.cshrc'
;;
*/bash)
shell_path=PATH
shell_style=b
shell_rc='~/.bashrc'
;;
*/sh)
shell_path=PATH
shell_style=b
shell_rc='$HOME/.profile'
;;
*)
# unknown shell ???
shell_style=b
shell_rc='~/.profile'
;;
esac
here=`$BINPWD`
if test -d $libdir && cd $libdir 2>/dev/null; then
libdir_solved=`$BINPWD 2>/dev/null`
else
libdir_solved=$libdir;
fi
cd $here
if test -d $bindir && cd $bindir 2>/dev/null; then
bindir_solved=`$BINPWD 2>/dev/null`
else
bindir_solved=$bindir
fi
cd $here
LINE='================================================================================'
echo $LINE
# -------------------------------------------------------------------
# check if installed
# -------------------------------------------------------------------
if test ! -x $bindir/rheolef-config; then
echo " WARNING: The file $bindir/rheolef-config is not present."
echo " HINT: Enter 'make install'."
echo $LINE; exit 1
fi
if test ! -f $libdir/librheolef.la; then
echo " WARNING: The file $libdir/librheolef.la is not present."
echo " HINT: Enter 'make install'."
echo $LINE; exit 1
fi
VERSION=`$bindir/rheolef-config --version`
# -------------------------------------------------------------------
# check PATH
# -------------------------------------------------------------------
#echo "bindir_solved $bindir_solved"
n=0
list=""
registered=false
# d1 = fisrt dir containing rheolef-config in PATH
d1=""
d1_solved=""
for d in $path_list; do
d_solved=$d
#echo "d_solved $d_solved"
#echo "DIR_SOLVED $d_solved"
#echo "BINDIR_SOLVED $bindir_solved"
if test "$d_solved" = "$bindir_solved"; then
registered=true
#echo FOUNDED_HERE
fi
if test -x $d/rheolef-config; then
if test "$d1" = ""; then
d1=$d
d1_solved=$d_solved
fi
list="$list $d"
n=`expr $n + 1`
fi
done
#echo N $n
#echo LIST $list
#echo FOUNDED $registered
if test "$registered" = false; then
echo
echo " WARNING:"
echo " The directory $bindir may be"
echo " added to the PATH environment variable."
echo
echo " HINT: Add at the end of your $shell_rc file:"
echo
if test $shell_style = c; then
echo " set path = ($bindir \$path)"
else
echo " export PATH=\"$bindir:\$PATH\""
fi
echo
echo " and then enter:"
echo
echo " source $shell_rc"
echo
echo $LINE; exit 1
fi
# here, bindir is in PATH
# -----------------------
if test $n -eq 0; then
echo " WARNING:"
echo " Rheolef is not yet installed"
echo " HINT: Run 'make install'"
echo
echo $LINE; exit 1
elif test $n -ne 1; then
# d1 = fisrt dir containing rheolef-config in PATH
if test "$d1_solved" != "$bindir_solved"; then
d1_version=`$d1/rheolef-config --version`
echo
echo " WARNING:"
echo " Installed Rheolef commands"
echo " $bindir/rheolef-config (version $VERSION)"
echo " is hidden by another installation:"
echo " $d1/rheolef-config (version $d1_version)"
echo
echo " HINT: Edit $shell_rc and then"
echo " swap $bindir and $d1 in"
echo " the $shell_path environment variable. Then enter:"
echo
echo " source $shell_rc"
echo
echo $LINE; exit 1
fi
fi
# -------------------------------------------------------------------
# check SHLIBPATH variable
# -------------------------------------------------------------------
if test $shlibpath_var = xunsupported,; then
# shlib not supported
echo $LINE; exit 0
fi
cmd1="echo \\\$\$shlibpath_var"
cmd2=`eval $cmd1`
shlibpath=`eval "echo $cmd2"`
libdir_list=`echo $shlibpath | sed -e 's/:/ /g'`
if test -f /etc/ld.so.conf; then
libdir_list="$libdir_list `cat /etc/ld.so.conf`"
fi
libdir_list="$libdir_list /lib /usr/lib"
registered=false
n=0
list=""
# d1 = fisrt dir containing librheolef.la in SHLIBPATH
d1=""
d1_solved=""
#echo shlibpath $shlibpath
for d in $libdir_list; do
if test -d $d && cd $d 2>/dev/null; then
d_solved=`$BINPWD 2>/dev/null`
cd $here
else
cd $here
continue
fi
#echo DIR $d
#echo LIBDIR $libdir
if test "$d_solved" = "$libdir_solved"; then
registered=true
fi
if test -f $d/librheolef.la; then
list="$list $d"
if test "$d1" = ""; then
d1=$d
d1_solved=$d_solved
fi
n=`expr $n + 1`
fi
done
def_libdir='`rheolef-config --libdir`'
# here, there is some librheolef.la in shlibpath ($n -ge 1)
# ---------------------------------------------------------
# 1) $n -eq 0 => add libdir
# 2) test $registered = true -a $n -ge 2 => possible conflict (depend on order)
# 3) test $registered = false -a $n -ge 1 => add libdir before
# 4) test $registered = true -a $n -eq 1 => ok
#
if test $n -eq 0 || \
test $registered = true -a $n -ge 2 -a "$d1_solved" != "$libdir_solved" || \
test $registered = false; then
if test $n -eq 0; then
echo
echo " WARNING:"
echo " The directory $libdir may be"
echo " added to the ${shlibpath_var} environment variable."
elif test $registered -a $n -ge 2 -a "$d1_solved" != "$libdir_solved"; then
# libdir is not the first in shlibpath
d1_version=`grep current $d1/librheolef.la | sed -e 's/current=//'`
version=`grep current $libdir/librheolef.la | sed -e 's/current=//'`
echo
echo " WARNING:"
echo " Installed Rheolef library"
echo
echo " $libdir/librheolef.la (version $version)"
echo
echo " is hidden by another installation:"
echo
echo " $d1/librheolef.la (version $d1_version)"
else
# test $registered = false -a $n -ge 1
d1_version=`grep current $d1/librheolef.la | sed -e 's/current=//'`
version=`grep current $libdir/librheolef.la | sed -e 's/current=//'`
echo
echo " WARNING:"
echo " Current Rheolef library in"
echo
echo " $libdir/librheolef.la (version $version)"
echo
echo " is not registered. Instead, another Rheolef library is actually registered:"
echo
echo " $d1/librheolef.la (version $d1_version)"
fi
echo
if test x"$shlibpath" = x""; then
echo " The variable $shlibpath_var is not set."
echo
echo " HINT: Edit $shell_rc and insert:"
echo
if test $shell_style = c; then
echo " setenv $shlibpath_var $def_libdir"
else
echo " export $shlibpath_var=$def_libdir"
fi
else
echo
echo " HINT: Edit $shell_rc and insert:"
echo
if test $shell_style = c; then
echo " setenv $shlibpath_var \"$def_libdir:\${$shlibpath_var}\""
else
echo " export $shlibpath_var=\"$def_libdir:\${$shlibpath_var}\""
fi
fi
echo
echo " and then enter:"
echo
echo " source $shell_rc"
echo
echo $LINE; exit 1
fi
echo " Rheolef $VERSION successfully installed."
echo " Have fun with Rheolef !"
echo $LINE; exit 0
|