/
ipdc
executable file
·91 lines (83 loc) · 3.11 KB
/
ipdc
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
#!/bin/sh
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#########################################################
######## ########
# ipdc: Intermedio entre PseudoD y la consola #
######## ########
# Copyright 2016-2018 Alejandro Linarez Rangel
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#########################################################
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Las variables de entorno para PseudoD son:
#
# * `PSEUDODPATH` (pdhelpextracter): Igual que RUTA_PSEUDOD
# * `RUTA_PSEUDOD`: Ruta a la BEPD
# * `RUTA_PSEUDOD_LIB`: Ruta al NEA (libpseudod.so)
# * `RUTA_PSEUDOD_INSTALACION`: Ruta donde se instaló PseudoD
# * `RUTA_PSEUDOD_DEV_LIB`: Ruta a las librerias de desarrollo (si hay)
# * `RUTA_PSEUDOD_BIN`: Ruta al binario de PseudoD (PseudoD)
#
# Los archivos donde podemos escribir estas variales son:
#
# * `$HOME/.bash_profile` (user-only)
# * `$HOME/.profile` (user-only)
# * `/etc/profile`
# Uso:
# ipdc <archivo>
# ipdc <archivo> <opciones-de-pseudod>
# Existe la variable RUTA_PSEUDOD?
if [ -z ${RUTA_PSEUDOD+x} ]; then
# No existe, pero existe el directorio $HOME/.pseudod/bepd/?
if [ -d "$HOME/.pseudod/bepd/" ]; then
# Si existe, usa la instalación local
export RUTA_PSEUDOD="$HOME/.pseudod/bepd/"
else
# No existe, usa la instalación global
export RUTA_PSEUDOD="/opt/pseudod/bepd/"
fi
fi
# Existe la variable RUTA_PSEUDOD_BIN?
if [ -z ${RUTA_PSEUDOD_BIN+x} ]; then
# No existe, pero existe el directorio $HOME/.pseudod/bin/?
if [ -d "$HOME/.pseudod/bin/" ]; then
# Si existe, usa la instalación local
export RUTA_PSEUDOD_BIN="$HOME/.pseudod/bin/pseudod"
else
# No existe, usa la instalación global
export RUTA_PSEUDOD_BIN="/opt/pseudod/bin/pseudod"
fi
fi
# Existe la variable RUTA_PSEUDOD_LIB?
if [ -z ${RUTA_PSEUDOD_LIB+x} ]; then
# No existe, pero existe el archivo $HOME/.pseudod/lib/libpseudod.so?
if [ -e "$HOME/.pseudod/lib/libpseudod.so" ]; then
# Si existe, usa la instalación local
export RUTA_PSEUDOD_LIB="$HOME/.pseudod/lib/libpseudod.so"
else
# No existe, usa la instalación global
export RUTA_PSEUDOD_LIB="/opt/pseudod/lib/libpseudod.so"
fi
fi
# Existe la variable RUTA_PSEUDOD_INSTALACION
if [ -z ${RUTA_PSEUDOD_INSTALACION+x} ]; then
# No existe, pero existe el directorio $HOME/.pseudod/?
if [ -d "$HOME/.pseudod/" ]; then
# Si existe, usa la instalación local
export RUTA_PSEUDOD_INSTALACION="$HOME/.pseudod/"
else
# No existe, usa la instalación global
export RUTA_PSEUDOD_INSTALACION="/opt/pseudod/"
fi
fi
"$RUTA_PSEUDOD_BIN" "$@"