1 |
commit: bf609c9da1041c05189728470477a4b602213241 |
2 |
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Apr 1 11:41:36 2011 +0000 |
4 |
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 1 11:41:36 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=bf609c9d |
7 |
|
8 |
Path quoting complete, and remove the path quoting inside [[ ]]. |
9 |
[[ ]] used instead of [ ] everywhere. |
10 |
|
11 |
--- |
12 |
postgresql.eselect | 44 +++++++++++++++++++++++--------------------- |
13 |
1 files changed, 23 insertions(+), 21 deletions(-) |
14 |
|
15 |
diff --git a/postgresql.eselect b/postgresql.eselect |
16 |
index 36fedb8..84e1167 100644 |
17 |
--- a/postgresql.eselect |
18 |
+++ b/postgresql.eselect |
19 |
@@ -15,7 +15,7 @@ E_PATH="${EROOT%/}/etc/eselect/postgresql" |
20 |
ENV_FILE="${EROOT%/}/etc/env.d/50postgresql" |
21 |
|
22 |
active_slot() { |
23 |
- if [[ -r "${E_PATH}"/active && -n "${E_PATH}"/active ]] ; then |
24 |
+ if [[ -r ${E_PATH}/active && -n ${E_PATH}/active ]] ; then |
25 |
echo $( <"${E_PATH}"/active ) |
26 |
else |
27 |
echo "(none)" |
28 |
@@ -25,10 +25,10 @@ active_slot() { |
29 |
lib_dir() { |
30 |
local lib_list=$(list_libdirs) |
31 |
if [[ ${lib_list} =~ .*lib64.* && \ |
32 |
- "$(ls -d ${B_PATH}/lib64/postgresql-*/lib)" != "" ]] ; then |
33 |
+ $(ls -d ${B_PATH}/lib64/postgresql-*/lib) != "" ]] ; then |
34 |
echo "lib64" |
35 |
elif [[ ${lib_list} =~ .*lib32.* && \ |
36 |
- "$(ls -d ${B_PATH}/lib32/postgresql-*/lib)" != "" ]] ; then |
37 |
+ $(ls -d ${B_PATH}/lib32/postgresql-*/lib) != "" ]] ; then |
38 |
echo "lib32" |
39 |
else |
40 |
echo "lib" |
41 |
@@ -52,8 +52,8 @@ linker() { |
42 |
local link_target="${target_dir%/}/$(basename ${link_source})${suffix}" |
43 |
|
44 |
# For good measure, remove target before creating the symlink |
45 |
- [[ -h "${link_target}" ]] && rm -f "${link_target}" |
46 |
- [[ -e "${link_target}" ]] && \ |
47 |
+ [[ -h ${link_target} ]] && rm -f "${link_target}" |
48 |
+ [[ -e ${link_target} ]] && \ |
49 |
die -q "The target '${link_target}' still exists and could not be removed!" |
50 |
|
51 |
ln -s "${link_source}" "${link_target}" || die -q "Unable to create link!" |
52 |
@@ -66,11 +66,11 @@ linker() { |
53 |
# - Full path to active links file (e.g. /etc/eselect/postgresql/active.links) |
54 |
unlinker() { |
55 |
local active_link_file=$1 |
56 |
- if [ -r "${active_link_file}" ] ; then |
57 |
+ if [[ -r ${active_link_file} ]] ; then |
58 |
local active_links=($(<"${active_link_file}")) |
59 |
for (( i=0; $i < ${#active_links[@]}; i++ )) ; do |
60 |
- [ -h "${active_links[$i]}" ] && rm -f "${active_links[$i]}" |
61 |
- [ -e "${active_links[$i]}" ] && \ |
62 |
+ [[ -h ${active_links[$i]} ]] && rm -f "${active_links[$i]}" |
63 |
+ [[ -e ${active_links[$i]} ]] && \ |
64 |
die -q "The target '${active_links[$i]}' still exists and could not be removed!" |
65 |
done |
66 |
|
67 |
@@ -102,7 +102,7 @@ do_list() { |
68 |
local postgres_ebuilds="" |
69 |
local src |
70 |
for src in "${E_PATH}"/slots/${slot}/{server,service,base,docs} ; do |
71 |
- [ -r "${src}" ] && source "${src}" |
72 |
+ [[ -r ${src} ]] && source "${src}" |
73 |
done |
74 |
|
75 |
case "${slot}" in |
76 |
@@ -113,7 +113,7 @@ do_list() { |
77 |
esac |
78 |
done |
79 |
|
80 |
- [ -z "${postgres_ebuilds}" ] && write_warning_msg "No slots available." |
81 |
+ [[ -z "${postgres_ebuilds}" ]] && write_warning_msg "No slots available." |
82 |
fi |
83 |
} |
84 |
|
85 |
@@ -143,7 +143,7 @@ describe_set() { |
86 |
|
87 |
do_set() { |
88 |
local SLOT=$1 |
89 |
- if [ ! -d "${B_PATH}"/$(lib_dir)/postgresql-${SLOT} ] ; then |
90 |
+ if [[ ! -d ${B_PATH}/$(lib_dir)/postgresql-${SLOT} ]] ; then |
91 |
die -q "Not a valid slot." |
92 |
fi |
93 |
|
94 |
@@ -174,10 +174,10 @@ do_set() { |
95 |
local i |
96 |
for (( i=0; $i < ${#sources[@]}; i++ )) ; do |
97 |
# Remove target before creating the symlink |
98 |
- [[ -h "${targets[$i]}" ]] && rm -f "${targets[$i]}" |
99 |
+ [[ -h ${targets[$i]} ]] && rm -f "${targets[$i]}" |
100 |
|
101 |
# Check if link_target still exists |
102 |
- [[ -e "${targets[$i]}" ]] && \ |
103 |
+ [[ -e ${targets[$i]} ]] && \ |
104 |
die -q "The target '${targets[$i]}' exists and could not be removed!" |
105 |
|
106 |
ln -s "${sources[$i]}" "${targets[$i]}" || die -q "Unable to create link!" |
107 |
@@ -187,7 +187,7 @@ do_set() { |
108 |
# Link modules to /usr/lib{,lib32,lib64}/ |
109 |
local x |
110 |
for x in $(list_libdirs) ; do |
111 |
- if [[ -d "${B_PATH}/${x}/postgresql-${SLOT}/${x}" ]] ; then |
112 |
+ if [[ -d ${B_PATH}/${x}/postgresql-${SLOT}/${x} ]] ; then |
113 |
# 'linker' function doesn't work for linking directories. |
114 |
# Default lib path |
115 |
ln -s "${B_PATH}/${x}/postgresql-${SLOT}/${x}" "${B_PATH}/${x}/postgresql" |
116 |
@@ -218,7 +218,7 @@ describe_unset() { |
117 |
|
118 |
do_unset() { |
119 |
local SLOT=$1 |
120 |
- if [[ "${SLOT}" = "$(active_slot)" ]] ; then |
121 |
+ if [[ ${SLOT} = $(active_slot) ]] ; then |
122 |
echo -n "Unsetting ${SLOT} as the default installation..." |
123 |
unlinker "${E_PATH}/active.links" |
124 |
rm -f "${E_PATH}/active" |
125 |
@@ -235,7 +235,7 @@ describe_reset() { |
126 |
|
127 |
do_reset() { |
128 |
local SLOT=$(active_slot) |
129 |
- [[ "${SLOT}" = "(none)" ]] && die -q "No active slot to reset." |
130 |
+ [[ ${SLOT} = "(none)" ]] && die -q "No active slot to reset." |
131 |
do_unset ${SLOT} |
132 |
do_set ${SLOT} |
133 |
} |
134 |
@@ -248,10 +248,12 @@ describe_update() { |
135 |
do_update() { |
136 |
local slot=$(active_slot) |
137 |
# Check for files managed by postgresql.eselect before 1.0 |
138 |
- [[ -h "${E_PATH}active" ]] && \ |
139 |
- slot="$(basename $(canonicalise ${E_PATH/active))" |
140 |
+ if [[ -h ${E_PATH}/active ]] ; then |
141 |
+ slot="$(basename $(canonicalise ${E_PATH}/active)))" |
142 |
+ rm -f "${E_PATH}/active" |
143 |
+ fi |
144 |
# Remove service file outright. |
145 |
- [[ -h "${E_PATH}/service" ]] && rm -f "${E_PATH}/service" |
146 |
+ [[ -h ${E_PATH}/service ]] && rm -f "${E_PATH}/service" |
147 |
|
148 |
local slots=($(get_slots)) |
149 |
local index=${#slots[@]} |
150 |
@@ -296,7 +298,7 @@ do_update() { |
151 |
local ldpath |
152 |
local x |
153 |
for x in $(list_libdirs) ; do |
154 |
- [[ -h "${B_PATH}"/${x}/postgresql ]] && \ |
155 |
+ [[ -h ${B_PATH}/${x}/postgresql ]] && \ |
156 |
ldpath+="${B_PATH}/${x}/postgresql:" |
157 |
done |
158 |
ldpath="${ldpath%:}" |
159 |
@@ -305,7 +307,7 @@ do_update() { |
160 |
local curslot="${slots[$index]}" |
161 |
echo -n "Refreshing symbolic links for ${curslot} applications (like " |
162 |
echo -n "/usr/bin/psql${curslot//.})..." |
163 |
- for x in ${LIB_LIST} ; do |
164 |
+ for x in $(list_libdirs) ; do |
165 |
local lib_path="${B_PATH}/${x}/postgresql-${curslot}/${x}/" |
166 |
[[ -d ${lib_path} ]] && ldpath+=":${lib_path}" |
167 |
done |