1 |
ulm 15/03/31 16:57:32 |
2 |
|
3 |
Added: unison.eselect-0.3 unison.eselect-0.2 |
4 |
unison.eselect-0.1 |
5 |
Log: |
6 |
Move package from app-admin to app-eselect category. |
7 |
|
8 |
(Portage version: 2.2.18/cvs/Linux x86_64, RepoMan options: --force, signed Manifest commit with key 9433907D693FB5B8!) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 app-eselect/eselect-unison/files/unison.eselect-0.3 |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-eselect/eselect-unison/files/unison.eselect-0.3?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-eselect/eselect-unison/files/unison.eselect-0.3?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: unison.eselect-0.3 |
17 |
=================================================================== |
18 |
# -*-eselect-*- vim: ft=eselect |
19 |
# Copyright 1999-2015 Gentoo Foundation |
20 |
# Distributed under the terms of the GNU General Public License v2 |
21 |
# $Header: /var/cvsroot/gentoo-x86/app-eselect/eselect-unison/files/unison.eselect-0.3,v 1.1 2015/03/31 16:57:32 ulm Exp $ |
22 |
|
23 |
DESCRIPTION="Manage /usr/bin/unison versions" |
24 |
MAINTAINER="ml@g.o" |
25 |
VERSION="0.3" |
26 |
|
27 |
# find a list of unison symlink targets, best first |
28 |
find_targets() { |
29 |
local f |
30 |
for f in "${EROOT}"/usr/bin/unison-[0-9]*; do |
31 |
if [[ -f ${f} ]] ; then |
32 |
echo "${f##*/unison-}" |
33 |
fi |
34 |
done | tac |
35 |
} |
36 |
|
37 |
# find version number of currently symlinked version |
38 |
identify_target() { |
39 |
local f |
40 |
f="$(canonicalise "${EROOT}"/usr/bin/unison)" |
41 |
echo "${f##*/unison-}" |
42 |
} |
43 |
|
44 |
# try to remove the unison symlink |
45 |
remove_symlinks() { |
46 |
rm -f "${EROOT}"/usr/bin/unison &>/dev/null |
47 |
} |
48 |
|
49 |
# set the unison symlink |
50 |
set_symlinks() { |
51 |
local target="${1}" targets |
52 |
if is_number "${target}" && [[ ${target} -ge 1 ]] ; then |
53 |
targets=( $(find_targets) ) |
54 |
target=${targets[target - 1]} |
55 |
fi |
56 |
if [[ -f "${EROOT}/usr/bin/unison-${target}" ]] ; then |
57 |
remove_symlinks |
58 |
ln -s "unison-${target}" "${EROOT}/usr/bin/unison" || \ |
59 |
die "Could not set ${target} /usr/bin/unison symlink" |
60 |
else |
61 |
die -q "Target \"${target}\" doesn't appear to be valid!" |
62 |
fi |
63 |
} |
64 |
|
65 |
### show action ### |
66 |
|
67 |
describe_show() { |
68 |
echo "Show the current unison version" |
69 |
} |
70 |
|
71 |
do_show() { |
72 |
[[ -z "${@}" ]] || die -q "Too many parameters" |
73 |
|
74 |
write_list_start "Current unison verson:" |
75 |
if [[ -L "${EROOT}/usr/bin/unison" ]] ; then |
76 |
write_kv_list_entry "$(identify_target)" "" |
77 |
elif [[ -e "${EROOT}/usr/bin/unison" ]] ; then |
78 |
write_kv_list_entry "(not a symlink)" "" |
79 |
else |
80 |
write_kv_list_entry "(unset)" "" |
81 |
fi |
82 |
} |
83 |
|
84 |
### list action ### |
85 |
|
86 |
describe_list() { |
87 |
echo "List available unison versions" |
88 |
} |
89 |
|
90 |
do_list() { |
91 |
[[ $# -eq 0 ]] || die -q "Too many parameters" |
92 |
|
93 |
local i targets current |
94 |
targets=( $(find_targets ) ) |
95 |
current=$(identify_target) |
96 |
for (( i = 0; i < ${#targets[@]}; i++ )); do |
97 |
[[ ${targets[i]} = ${current} ]] \ |
98 |
&& targets[i]=$(highlight_marker "${targets[i]}") |
99 |
done |
100 |
write_list_start "Available unison versions:" |
101 |
write_numbered_list -m "(none found)" "${targets[@]}" |
102 |
} |
103 |
|
104 |
### set action ### |
105 |
|
106 |
describe_set() { |
107 |
echo "Set a new unison version" |
108 |
} |
109 |
|
110 |
describe_set_options() { |
111 |
echo "target : Target version number or index from 'list' action" |
112 |
} |
113 |
|
114 |
describe_set_parameters() { |
115 |
echo "<target>" |
116 |
} |
117 |
|
118 |
do_set() { |
119 |
if [[ -z "${1}" ]] ; then |
120 |
die -q "You didn't give me a version number" |
121 |
|
122 |
elif [[ -n "${2}" ]] ; then |
123 |
die -q "Too many parameters" |
124 |
|
125 |
elif [[ -L "${EROOT}/usr/bin/unison" ]] ; then |
126 |
if ! remove_symlinks ; then |
127 |
die -q "Can't remove existing version symlink" |
128 |
elif ! set_symlinks "${1}" ; then |
129 |
die -q "Can't set new version" |
130 |
fi |
131 |
|
132 |
elif [[ -e "${EROOT}/usr/bin/unison" ]] ; then |
133 |
die -q "${EROOT}/usr/bin/unison seems to be from an old ebuild, please remove manually" |
134 |
|
135 |
else |
136 |
set_symlinks "${1}" || die -q "Can't set new version" |
137 |
fi |
138 |
} |
139 |
|
140 |
### update action ### |
141 |
|
142 |
describe_update() { |
143 |
echo "Automatically update the unison version number" |
144 |
} |
145 |
|
146 |
describe_update_options() { |
147 |
echo "--if-unset : Do not override currently selected version" |
148 |
} |
149 |
|
150 |
do_update() { |
151 |
[[ -z "${1}" ]] || ( [[ -z "${2}" ]] && [[ "${1}" == "--if-unset" ]] ) || \ |
152 |
die -q "Usage error" |
153 |
|
154 |
if [[ -L "${EROOT}/usr/bin/unison" ]] ; then |
155 |
[[ ${1} == "--if-unset" ]] && return |
156 |
remove_symlinks || die -q "Can't remove existing symlink" |
157 |
fi |
158 |
if [[ -e "${EROOT}/usr/bin/unison" ]] ; then |
159 |
die -q "${EROOT}/usr/bin/unison seems to be from an old ebuild, please remove manually" |
160 |
elif ! [[ -z $(find_targets ) ]] ; then |
161 |
set_symlinks 1 || die -q "Can't set a new version" |
162 |
fi |
163 |
} |
164 |
|
165 |
|
166 |
|
167 |
1.1 app-eselect/eselect-unison/files/unison.eselect-0.2 |
168 |
|
169 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-eselect/eselect-unison/files/unison.eselect-0.2?rev=1.1&view=markup |
170 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-eselect/eselect-unison/files/unison.eselect-0.2?rev=1.1&content-type=text/plain |
171 |
|
172 |
Index: unison.eselect-0.2 |
173 |
=================================================================== |
174 |
# -*-eselect-*- vim: ft=eselect |
175 |
# Copyright 1999-2015 Gentoo Foundation |
176 |
# Distributed under the terms of the GNU General Public License v2 |
177 |
# $Id: unison.eselect-0.2,v 1.1 2015/03/31 16:57:32 ulm Exp $ |
178 |
|
179 |
DESCRIPTION="Manage /usr/bin/unison versions" |
180 |
MAINTAINER="ml@g.o" |
181 |
SVN_DATE='$Date: 2015/03/31 16:57:32 $' |
182 |
VERSION=$(svn_date_to_version "${SVN_DATE}" ) |
183 |
|
184 |
# find a list of unison symlink targets, best first |
185 |
find_targets() { |
186 |
local f |
187 |
for f in "${ROOT}"/usr/bin/unison-[0-9]*; do |
188 |
if [[ -f ${f} ]] ; then |
189 |
echo "${f##*/unison-}" |
190 |
fi |
191 |
done | tac |
192 |
} |
193 |
|
194 |
# find version number of currently symlinked version |
195 |
identify_target() { |
196 |
local f |
197 |
f="$(canonicalise "${ROOT}"/usr/bin/unison)" |
198 |
echo "${f##*/unison-}" |
199 |
} |
200 |
|
201 |
# try to remove the unison symlink |
202 |
remove_symlinks() { |
203 |
rm -f "${ROOT}"/usr/bin/unison &>/dev/null |
204 |
} |
205 |
|
206 |
# set the unison symlink |
207 |
set_symlinks() { |
208 |
local target="${1}" targets |
209 |
if is_number "${target}" && [[ ${target} -ge 1 ]] ; then |
210 |
targets=( $(find_targets ) ) |
211 |
target=${targets[$(( ${target} - 1 ))]} |
212 |
fi |
213 |
if [[ -f "${ROOT}/usr/bin/unison-${target}" ]] ; then |
214 |
remove_symlinks |
215 |
ln -s "unison-${target}" "${ROOT}/usr/bin/unison" || \ |
216 |
die "Could not set ${target} /usr/bin/unison symlink" |
217 |
else |
218 |
die -q "Target \"${target}\" doesn't appear to be valid!" |
219 |
fi |
220 |
} |
221 |
|
222 |
### show action ### |
223 |
|
224 |
describe_show() { |
225 |
echo "Show the current unison version" |
226 |
} |
227 |
|
228 |
do_show() { |
229 |
[[ -z "${@}" ]] || die -q "Too many parameters" |
230 |
|
231 |
write_list_start "Current unison verson:" |
232 |
if [[ -L "${ROOT}/usr/bin/unison" ]] ; then |
233 |
write_kv_list_entry "$(identify_target)" "" |
234 |
elif [[ -e "${ROOT}/usr/bin/unison" ]] ; then |
235 |
write_kv_list_entry "(not a symlink)" "" |
236 |
else |
237 |
write_kv_list_entry "(unset)" "" |
238 |
fi |
239 |
} |
240 |
|
241 |
### list action ### |
242 |
|
243 |
describe_list() { |
244 |
echo "List available unison versions" |
245 |
} |
246 |
|
247 |
do_list() { |
248 |
[[ $# -eq 0 ]] || die -q "Too many parameters" |
249 |
|
250 |
local i targets current |
251 |
targets=( $(find_targets ) ) |
252 |
current=$(identify_target) |
253 |
for (( i = 0; i < ${#targets[@]}; i++ )); do |
254 |
[[ ${targets[i]} = ${current} ]] \ |
255 |
&& targets[i]=$(highlight_marker "${targets[i]}") |
256 |
done |
257 |
write_list_start "Available unison versions:" |
258 |
write_numbered_list -m "(none found)" "${targets[@]}" |
259 |
} |
260 |
|
261 |
### set action ### |
262 |
|
263 |
describe_set() { |
264 |
echo "Set a new unison version" |
265 |
} |
266 |
|
267 |
describe_set_options() { |
268 |
echo "target : Target version number or index from 'list' action" |
269 |
} |
270 |
|
271 |
describe_set_parameters() { |
272 |
echo "<target>" |
273 |
} |
274 |
|
275 |
do_set() { |
276 |
if [[ -z "${1}" ]] ; then |
277 |
die -q "You didn't give me a version number" |
278 |
|
279 |
elif [[ -n "${2}" ]] ; then |
280 |
die -q "Too many parameters" |
281 |
|
282 |
elif [[ -L "${ROOT}/usr/bin/unison" ]] ; then |
283 |
if ! remove_symlinks ; then |
284 |
die -q "Can't remove existing version symlink" |
285 |
elif ! set_symlinks "${1}" ; then |
286 |
die -q "Can't set new version" |
287 |
fi |
288 |
|
289 |
elif [[ -e "${ROOT}/usr/bin/unison" ]] ; then |
290 |
die -q "${ROOT}/usr/bin/unison seems to be from an old ebuild, please remove manually" |
291 |
|
292 |
else |
293 |
set_symlinks "${1}" || die -q "Can't set new version" |
294 |
fi |
295 |
} |
296 |
|
297 |
### update action ### |
298 |
|
299 |
describe_update() { |
300 |
echo "Automatically update the unison version number" |
301 |
} |
302 |
|
303 |
describe_update_options() { |
304 |
echo "--if-unset : Do not override currently selected version" |
305 |
} |
306 |
|
307 |
do_update() { |
308 |
[[ -z "${1}" ]] || ( [[ -z "${2}" ]] && [[ "${1}" == "--if-unset" ]] ) || \ |
309 |
die -q "Usage error" |
310 |
|
311 |
if [[ -L "${ROOT}/usr/bin/unison" ]] ; then |
312 |
[[ ${1} == "--if-unset" ]] && return |
313 |
remove_symlinks || die -q "Can't remove existing symlink" |
314 |
fi |
315 |
if [[ -e "${ROOT}/usr/bin/unison" ]] ; then |
316 |
die -q "${ROOT}/usr/bin/unison seems to be from an old ebuild, please remove manually" |
317 |
elif ! [[ -z $(find_targets ) ]] ; then |
318 |
set_symlinks 1 || die -q "Can't set a new version" |
319 |
fi |
320 |
} |
321 |
|
322 |
|
323 |
|
324 |
1.1 app-eselect/eselect-unison/files/unison.eselect-0.1 |
325 |
|
326 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-eselect/eselect-unison/files/unison.eselect-0.1?rev=1.1&view=markup |
327 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-eselect/eselect-unison/files/unison.eselect-0.1?rev=1.1&content-type=text/plain |
328 |
|
329 |
Index: unison.eselect-0.1 |
330 |
=================================================================== |
331 |
# Copyright 1999-2015 Gentoo Foundation |
332 |
# Distributed under the terms of the GNU General Public License v2 |
333 |
# $Id: unison.eselect-0.1,v 1.1 2015/03/31 16:57:32 ulm Exp $ |
334 |
|
335 |
DESCRIPTION="Manage /usr/bin/unison versions" |
336 |
MAINTAINER="ml@g.o" |
337 |
SVN_DATE='$Date: 2015/03/31 16:57:32 $' |
338 |
VERSION=$(svn_date_to_version "${SVN_DATE}" ) |
339 |
|
340 |
# find a list of unison symlink targets, best first |
341 |
find_targets() { |
342 |
local f |
343 |
for f in "${ROOT}"/usr/bin/unison-[0-9]*; do |
344 |
if [[ -f ${f} ]] ; then |
345 |
echo "${f##*/unison-}" |
346 |
fi |
347 |
done | tac |
348 |
} |
349 |
|
350 |
# find version number of currently symlinked version |
351 |
identify_target() { |
352 |
local f |
353 |
f="$(canonicalise "${ROOT}"/usr/bin/unison)" |
354 |
echo "${f##*/unison-}" |
355 |
} |
356 |
|
357 |
# try to remove the unison symlink |
358 |
remove_symlinks() { |
359 |
rm -f "${ROOT}"/usr/bin/unison &>/dev/null |
360 |
} |
361 |
|
362 |
# set the unison symlink |
363 |
set_symlinks() { |
364 |
local target="${1}" targets |
365 |
if is_number "${target}" && [[ ${target} -ge 1 ]] ; then |
366 |
targets=( $(find_targets ) ) |
367 |
target=${targets[$(( ${target} - 1 ))]} |
368 |
fi |
369 |
if [[ -f "${ROOT}/usr/bin/unison-${target}" ]] ; then |
370 |
remove_symlinks |
371 |
ln -s "unison-${target}" "${ROOT}/usr/bin/unison" || \ |
372 |
die "Could not set ${target} /usr/bin/unison symlink" |
373 |
else |
374 |
die -q "Target \"${target}\" doesn't appear to be valid!" |
375 |
fi |
376 |
} |
377 |
|
378 |
### show action ### |
379 |
|
380 |
describe_show() { |
381 |
echo "Show the current unison version" |
382 |
} |
383 |
|
384 |
do_show() { |
385 |
[[ -z "${@}" ]] || die -q "Too many parameters" |
386 |
|
387 |
write_list_start "Current unison verson:" |
388 |
if [[ -L "${ROOT}/usr/bin/unison" ]] ; then |
389 |
write_kv_list_entry "$(identify_target)" "" |
390 |
elif [[ -e "${ROOT}/usr/bin/unison" ]] ; then |
391 |
write_kv_list_entry "(not a symlink)" "" |
392 |
else |
393 |
write_kv_list_entry "(unset)" "" |
394 |
fi |
395 |
} |
396 |
|
397 |
### list action ### |
398 |
|
399 |
describe_list() { |
400 |
echo "List available unison versions" |
401 |
} |
402 |
|
403 |
do_list() { |
404 |
[[ -z "${@}" ]] || die -q "Too many parameters" |
405 |
|
406 |
local i targets current |
407 |
targets=( $(find_targets ) ) |
408 |
current=$(identify_target) |
409 |
if [[ -n ${targets[@]} ]] ; then |
410 |
for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do |
411 |
[[ ${targets[${i}]} == ${current} ]] && \ |
412 |
targets[${i}]="${targets[${i}]} $(highlight '*' )" |
413 |
done |
414 |
write_list_start "Available unison versions:" |
415 |
write_numbered_list "${targets[@]}" |
416 |
else |
417 |
write_kv_list_entry "(none found)" "" |
418 |
fi |
419 |
} |
420 |
|
421 |
### set action ### |
422 |
|
423 |
describe_set() { |
424 |
echo "Set a new unison version" |
425 |
} |
426 |
|
427 |
describe_set_options() { |
428 |
echo "target : Target version number or index from 'list' action" |
429 |
} |
430 |
|
431 |
describe_set_parameters() { |
432 |
echo "<target>" |
433 |
} |
434 |
|
435 |
do_set() { |
436 |
if [[ -z "${1}" ]] ; then |
437 |
die -q "You didn't give me a version number" |
438 |
|
439 |
elif [[ -n "${2}" ]] ; then |
440 |
die -q "Too many parameters" |
441 |
|
442 |
elif [[ -L "${ROOT}/usr/bin/unison" ]] ; then |
443 |
if ! remove_symlinks ; then |
444 |
die -q "Can't remove existing version symlink" |
445 |
elif ! set_symlinks "${1}" ; then |
446 |
die -q "Can't set new version" |
447 |
fi |
448 |
|
449 |
elif [[ -e "${ROOT}/usr/bin/unison" ]] ; then |
450 |
die -q "${ROOT}/usr/bin/unison seems to be from an old ebuild, please remove manually" |
451 |
|
452 |
else |
453 |
set_symlinks "${1}" || die -q "Can't set new version" |
454 |
fi |
455 |
} |
456 |
|
457 |
### update action ### |
458 |
|
459 |
describe_update() { |
460 |
echo "Automatically update the unison version number" |
461 |
} |
462 |
|
463 |
describe_update_options() { |
464 |
echo "--if-unset : Do not override currently selected version" |
465 |
} |
466 |
|
467 |
do_update() { |
468 |
[[ -z "${1}" ]] || ( [[ -z "${2}" ]] && [[ "${1}" == "--if-unset" ]] ) || \ |
469 |
die -q "Usage error" |
470 |
|
471 |
if [[ -L "${ROOT}/usr/bin/unison" ]] ; then |
472 |
[[ ${1} == "--if-unset" ]] && return |
473 |
remove_symlinks || die -q "Can't remove existing symlink" |
474 |
fi |
475 |
if [[ -e "${ROOT}/usr/bin/unison" ]] ; then |
476 |
die -q "${ROOT}/usr/bin/unison seems to be from an old ebuild, please remove manually" |
477 |
elif ! [[ -z $(find_targets ) ]] ; then |
478 |
set_symlinks 1 || die -q "Can't set a new version" |
479 |
fi |
480 |
} |
481 |
|
482 |
# vim: set ft=eselect : |