1 |
Author: ulm |
2 |
Date: 2009-04-22 22:39:23 +0000 (Wed, 22 Apr 2009) |
3 |
New Revision: 495 |
4 |
|
5 |
Modified: |
6 |
trunk/libs/editor-variable.bash.in |
7 |
trunk/libs/manip.bash.in |
8 |
trunk/libs/multilib.bash.in |
9 |
trunk/libs/package-manager.bash.in |
10 |
Log: |
11 |
Whitespace. |
12 |
|
13 |
Modified: trunk/libs/editor-variable.bash.in |
14 |
=================================================================== |
15 |
--- trunk/libs/editor-variable.bash.in 2009-04-22 22:23:39 UTC (rev 494) |
16 |
+++ trunk/libs/editor-variable.bash.in 2009-04-22 22:39:23 UTC (rev 495) |
17 |
@@ -31,139 +31,139 @@ |
18 |
|
19 |
# find a list of valid targets |
20 |
find_targets() { |
21 |
- local cur targets i |
22 |
- targets=${EDITOR_LIST} |
23 |
- cur=$(read_env_value) |
24 |
+ local cur targets i |
25 |
+ targets=${EDITOR_LIST} |
26 |
+ cur=$(read_env_value) |
27 |
|
28 |
- # also include the current value if it's not already in our list |
29 |
- [[ -n ${cur} ]] && ! has "${cur}" ${targets} \ |
30 |
- && targets="${targets} ${cur}" |
31 |
+ # also include the current value if it's not already in our list |
32 |
+ [[ -n ${cur} ]] && ! has "${cur}" ${targets} \ |
33 |
+ && targets="${targets} ${cur}" |
34 |
|
35 |
- for i in ${targets}; do |
36 |
- [[ -f ${ROOT}${i} ]] && echo "${i}" |
37 |
- done |
38 |
+ for i in ${targets}; do |
39 |
+ [[ -f ${ROOT}${i} ]] && echo "${i}" |
40 |
+ done |
41 |
} |
42 |
|
43 |
# read variable value from config file |
44 |
read_env_value() { |
45 |
- load_config "${ROOT}${EDITOR_ENVFILE}" "${EDITOR_VAR}" |
46 |
+ load_config "${ROOT}${EDITOR_ENVFILE}" "${EDITOR_VAR}" |
47 |
} |
48 |
|
49 |
# write variable to config file |
50 |
write_env_value() { |
51 |
- [[ -w ${ROOT}${EDITOR_ENVFILE%/*} ]] \ |
52 |
- || die -q "You need root privileges!" |
53 |
- store_config "${ROOT}${EDITOR_ENVFILE}" "${EDITOR_VAR}" "$1" |
54 |
+ [[ -w ${ROOT}${EDITOR_ENVFILE%/*} ]] \ |
55 |
+ || die -q "You need root privileges!" |
56 |
+ store_config "${ROOT}${EDITOR_ENVFILE}" "${EDITOR_VAR}" "$1" |
57 |
} |
58 |
|
59 |
### show action ### |
60 |
|
61 |
describe_show() { |
62 |
- echo "Show value of the ${EDITOR_VAR} variable in profile" |
63 |
+ echo "Show value of the ${EDITOR_VAR} variable in profile" |
64 |
} |
65 |
|
66 |
do_show() { |
67 |
- [[ $# -gt 0 ]] && die -q "Too many parameters" |
68 |
+ [[ $# -gt 0 ]] && die -q "Too many parameters" |
69 |
|
70 |
- local cur=$(read_env_value) |
71 |
- write_list_start "${EDITOR_VAR} variable in profile:" |
72 |
- write_kv_list_entry "${cur:-(none)}" |
73 |
+ local cur=$(read_env_value) |
74 |
+ write_list_start "${EDITOR_VAR} variable in profile:" |
75 |
+ write_kv_list_entry "${cur:-(none)}" |
76 |
} |
77 |
|
78 |
### list action ### |
79 |
|
80 |
describe_list() { |
81 |
- echo "List available targets for the ${EDITOR_VAR} variable" |
82 |
+ echo "List available targets for the ${EDITOR_VAR} variable" |
83 |
} |
84 |
|
85 |
do_list() { |
86 |
- [[ $# -gt 0 ]] && die -q "Too many parameters" |
87 |
+ [[ $# -gt 0 ]] && die -q "Too many parameters" |
88 |
|
89 |
- local cur targets i |
90 |
- cur=$(read_env_value) |
91 |
- targets=( $(find_targets) ) |
92 |
+ local cur targets i |
93 |
+ cur=$(read_env_value) |
94 |
+ targets=( $(find_targets) ) |
95 |
|
96 |
- write_list_start "Available targets for the ${EDITOR_VAR} variable:" |
97 |
- if [[ -n ${targets[@]} ]]; then |
98 |
- for (( i = 0; i < ${#targets[@]}; i = i + 1 )); do |
99 |
- # Display a star to indicate the currently chosen version |
100 |
- [[ ${targets[i]} = ${cur} ]] \ |
101 |
- && targets[i]="${targets[i]} $(highlight '*')" |
102 |
- done |
103 |
- write_numbered_list "${targets[@]}" |
104 |
- fi |
105 |
- write_numbered_list_entry " " "(free form)" |
106 |
+ write_list_start "Available targets for the ${EDITOR_VAR} variable:" |
107 |
+ if [[ -n ${targets[@]} ]]; then |
108 |
+ for (( i = 0; i < ${#targets[@]}; i = i + 1 )); do |
109 |
+ # Display a star to indicate the currently chosen version |
110 |
+ [[ ${targets[i]} = ${cur} ]] \ |
111 |
+ && targets[i]="${targets[i]} $(highlight '*')" |
112 |
+ done |
113 |
+ write_numbered_list "${targets[@]}" |
114 |
+ fi |
115 |
+ write_numbered_list_entry " " "(free form)" |
116 |
} |
117 |
|
118 |
### set action ### |
119 |
|
120 |
describe_set() { |
121 |
- echo "Set the ${EDITOR_VAR} variable in profile" |
122 |
+ echo "Set the ${EDITOR_VAR} variable in profile" |
123 |
} |
124 |
|
125 |
describe_set_options() { |
126 |
- echo "target : Target name or number (from 'list' action)" |
127 |
+ echo "target : Target name or number (from 'list' action)" |
128 |
} |
129 |
|
130 |
describe_set_parameters() { |
131 |
- echo "<target>" |
132 |
+ echo "<target>" |
133 |
} |
134 |
|
135 |
do_set() { |
136 |
- [[ -z $1 ]] && die -q "You didn't tell me what to set the variable to" |
137 |
- [[ $# -gt 1 ]] && die -q "Too many parameters" |
138 |
+ [[ -z $1 ]] && die -q "You didn't tell me what to set the variable to" |
139 |
+ [[ $# -gt 1 ]] && die -q "Too many parameters" |
140 |
|
141 |
- local target=$1 targets dir ifs_save=${IFS-$' \t\n'} |
142 |
+ local target=$1 targets dir ifs_save=${IFS-$' \t\n'} |
143 |
|
144 |
- # target may be specified by its name or its index |
145 |
- if is_number "${target}"; then |
146 |
- targets=( $(find_targets) ) |
147 |
- [[ ${target} -ge 1 && ${target} -le ${#targets[@]} ]] \ |
148 |
- || die -q "Number out of range: $1" |
149 |
- target=${targets[target-1]} |
150 |
- fi |
151 |
+ # target may be specified by its name or its index |
152 |
+ if is_number "${target}"; then |
153 |
+ targets=( $(find_targets) ) |
154 |
+ [[ ${target} -ge 1 && ${target} -le ${#targets[@]} ]] \ |
155 |
+ || die -q "Number out of range: $1" |
156 |
+ target=${targets[target-1]} |
157 |
+ fi |
158 |
|
159 |
- # is the target an absolute path? if not, try to find it |
160 |
- if [[ -n ${target##/*} ]]; then |
161 |
- IFS=: |
162 |
- for dir in ${EDITOR_PATH-/bin:/usr/bin}; do |
163 |
- [[ -f ${ROOT}${dir}/${target} ]] || continue |
164 |
- target=${dir}/${target} |
165 |
- break |
166 |
- done |
167 |
- IFS=${ifs_save} |
168 |
- fi |
169 |
+ # is the target an absolute path? if not, try to find it |
170 |
+ if [[ -n ${target##/*} ]]; then |
171 |
+ IFS=: |
172 |
+ for dir in ${EDITOR_PATH-/bin:/usr/bin}; do |
173 |
+ [[ -f ${ROOT}${dir}/${target} ]] || continue |
174 |
+ target=${dir}/${target} |
175 |
+ break |
176 |
+ done |
177 |
+ IFS=${ifs_save} |
178 |
+ fi |
179 |
|
180 |
- # we should now have a path to an existing binary |
181 |
- [[ -z ${target##/*} && -f ${ROOT}${target} ]] \ |
182 |
- || die -q "Target \"${target}\" doesn't appear to be valid!" |
183 |
+ # we should now have a path to an existing binary |
184 |
+ [[ -z ${target##/*} && -f ${ROOT}${target} ]] \ |
185 |
+ || die -q "Target \"${target}\" doesn't appear to be valid!" |
186 |
|
187 |
- echo "Setting ${EDITOR_VAR} to ${target} ..." |
188 |
- write_env_value "${target}" |
189 |
+ echo "Setting ${EDITOR_VAR} to ${target} ..." |
190 |
+ write_env_value "${target}" |
191 |
|
192 |
- # update profile |
193 |
- do_action env update noldconfig |
194 |
+ # update profile |
195 |
+ do_action env update noldconfig |
196 |
} |
197 |
|
198 |
### update action ### |
199 |
|
200 |
describe_update() { |
201 |
- echo "Update the ${EDITOR_VAR} variable if it is unset or invalid" |
202 |
+ echo "Update the ${EDITOR_VAR} variable if it is unset or invalid" |
203 |
} |
204 |
|
205 |
do_update() { |
206 |
- [[ $# -gt 0 ]] && die -q "Too many parameters" |
207 |
+ [[ $# -gt 0 ]] && die -q "Too many parameters" |
208 |
|
209 |
- local cur targets |
210 |
- cur=$(read_env_value) |
211 |
- [[ -n ${cur} && -f ${ROOT}${cur} ]] && return |
212 |
+ local cur targets |
213 |
+ cur=$(read_env_value) |
214 |
+ [[ -n ${cur} && -f ${ROOT}${cur} ]] && return |
215 |
|
216 |
- targets=( $(find_targets) ) |
217 |
- [[ ${#targets[@]} -gt 0 ]] \ |
218 |
- || die -q "No valid target for ${EDITOR_VAR} found" |
219 |
+ targets=( $(find_targets) ) |
220 |
+ [[ ${#targets[@]} -gt 0 ]] \ |
221 |
+ || die -q "No valid target for ${EDITOR_VAR} found" |
222 |
|
223 |
- echo "Setting ${EDITOR_VAR} to ${targets[0]} ..." |
224 |
- write_env_value "${targets[0]}" |
225 |
+ echo "Setting ${EDITOR_VAR} to ${targets[0]} ..." |
226 |
+ write_env_value "${targets[0]}" |
227 |
|
228 |
- do_action env update noldconfig |
229 |
+ do_action env update noldconfig |
230 |
} |
231 |
|
232 |
Modified: trunk/libs/manip.bash.in |
233 |
=================================================================== |
234 |
--- trunk/libs/manip.bash.in 2009-04-22 22:23:39 UTC (rev 494) |
235 |
+++ trunk/libs/manip.bash.in 2009-04-22 22:39:23 UTC (rev 495) |
236 |
@@ -29,5 +29,3 @@ |
237 |
} |
238 |
|
239 |
# vim: set sw=4 et sts=4 tw=80 : |
240 |
- |
241 |
- |
242 |
|
243 |
Modified: trunk/libs/multilib.bash.in |
244 |
=================================================================== |
245 |
--- trunk/libs/multilib.bash.in 2009-04-22 22:23:39 UTC (rev 494) |
246 |
+++ trunk/libs/multilib.bash.in 2009-04-22 22:39:23 UTC (rev 495) |
247 |
@@ -29,9 +29,9 @@ |
248 |
fi |
249 |
done |
250 |
if [[ -z ${libdirs[@]} ]] ; then |
251 |
- # Broken or non-existing ld.so.conf |
252 |
- libdirs=( ${ROOT}/lib* ) |
253 |
- libdirs=( ${libdirs[@]/\/lib/lib} ) |
254 |
+ # Broken or non-existing ld.so.conf |
255 |
+ libdirs=( ${ROOT}/lib* ) |
256 |
+ libdirs=( ${libdirs[@]/\/lib/lib} ) |
257 |
fi |
258 |
echo "${libdirs[@]}" |
259 |
} |
260 |
|
261 |
Modified: trunk/libs/package-manager.bash.in |
262 |
=================================================================== |
263 |
--- trunk/libs/package-manager.bash.in 2009-04-22 22:23:39 UTC (rev 494) |
264 |
+++ trunk/libs/package-manager.bash.in 2009-04-22 22:39:23 UTC (rev 495) |
265 |
@@ -172,4 +172,5 @@ |
266 |
echo ${manager} |
267 |
export ESELECT_PACKAGE_MANAGER_CACHE=${manager} |
268 |
} |
269 |
+ |
270 |
# vim: set sw=4 et sts=4 tw=80 : |