| 1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.50 2004/01/04 14:35:12 coredumb Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.52 2004/09/28 06:18:06 fafhrd Exp $ |
| 4 | |
4 | |
| 5 | # Current Maintainer: Tal Peer <coredumb@gentoo.org> |
5 | # Current Maintainer: Tal Peer <coredumb@gentoo.org> |
| 6 | # Original Author: Dan Armak <danarmak@gentoo.org> |
6 | # Original Author: Dan Armak <danarmak@gentoo.org> |
| 7 | |
7 | |
| 8 | # SSH auth code by Danny <danny.milo@gmx.net> |
8 | # SSH auth code by Danny <danny.milo@gmx.net> |
| … | |
… | |
| 108 | # |
108 | # |
| 109 | # Possible values are "pserver" and "ext". If `ext' authentication is |
109 | # Possible values are "pserver" and "ext". If `ext' authentication is |
| 110 | # used, the remote shell to use can be specified in CVS_RSH (SSH is |
110 | # used, the remote shell to use can be specified in CVS_RSH (SSH is |
| 111 | # used by default). Currently, the only supported remote shell for |
111 | # used by default). Currently, the only supported remote shell for |
| 112 | # `ext' authentication is SSH. |
112 | # `ext' authentication is SSH. |
|
|
113 | # |
|
|
114 | # Armando Di Cianno <fafhrd@gentoo.org> 2004/09/27 |
|
|
115 | # - Added "no" as a server type, which uses no AUTH method, nor |
|
|
116 | # does it login |
|
|
117 | # e.g. |
|
|
118 | # "cvs -danoncvs@savannah.gnu.org:/cvsroot/backbone co System" |
|
|
119 | # ( from gnustep-apps/textedit ) |
| 113 | [ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" |
120 | [ -z "$ECVS_AUTH" ] && ECVS_AUTH="pserver" |
| 114 | |
121 | |
| 115 | # ECVS_USER -- Username to use for authentication on the remote server |
122 | # ECVS_USER -- Username to use for authentication on the remote server |
| 116 | [ -z "$ECVS_USER" ] && ECVS_USER="anonymous" |
123 | [ -z "$ECVS_USER" ] && ECVS_USER="anonymous" |
| 117 | |
124 | |
| … | |
… | |
| 268 | fi |
275 | fi |
| 269 | |
276 | |
| 270 | |
277 | |
| 271 | # Our server string (i.e. CVSROOT) without the password so it can |
278 | # Our server string (i.e. CVSROOT) without the password so it can |
| 272 | # be put in Root |
279 | # be put in Root |
|
|
280 | if [ "$ECVS_AUTH" == "no" ] |
|
|
281 | then |
|
|
282 | local server="${ECVS_USER}@${ECVS_SERVER}" |
|
|
283 | else |
| 273 | local server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" |
284 | local server=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" |
|
|
285 | fi |
| 274 | |
286 | |
| 275 | # Switch servers automagically if needed |
287 | # Switch servers automagically if needed |
| 276 | if [ "$mode" == "update" ]; then |
288 | if [ "$mode" == "update" ]; then |
| 277 | cd /$ECVS_TOP_DIR/$ECVS_LOCALNAME |
289 | cd /$ECVS_TOP_DIR/$ECVS_LOCALNAME |
| 278 | local oldserver="`$run cat CVS/Root`" |
290 | local oldserver="`$run cat CVS/Root`" |
| … | |
… | |
| 306 | # The server string with the password in it, for login |
318 | # The server string with the password in it, for login |
| 307 | cvsroot_pass=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}" |
319 | cvsroot_pass=":${ECVS_AUTH}:${ECVS_USER}:${ECVS_PASS}@${ECVS_SERVER}" |
| 308 | |
320 | |
| 309 | # Ditto without the password, for checkout/update after login, so |
321 | # Ditto without the password, for checkout/update after login, so |
| 310 | # that the CVS/Root files don't contain the password in plaintext |
322 | # that the CVS/Root files don't contain the password in plaintext |
|
|
323 | if [ "$ECVS_AUTH" == "no" ] |
|
|
324 | then |
|
|
325 | cvsroot_nopass="${ECVS_USER}@${ECVS_SERVER}" |
|
|
326 | else |
| 311 | cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" |
327 | cvsroot_nopass=":${ECVS_AUTH}:${ECVS_USER}@${ECVS_SERVER}" |
|
|
328 | fi |
| 312 | |
329 | |
| 313 | # Commands to run |
330 | # Commands to run |
| 314 | cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login" |
331 | cmdlogin="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_pass}\" login" |
| 315 | cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}" |
332 | cmdupdate="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" update ${ECVS_UP_OPTS} ${ECVS_LOCALNAME}" |
| 316 | cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}" |
333 | cmdcheckout="${run} ${ECVS_CVS_COMMAND} -d \"${cvsroot_nopass}\" checkout ${ECVS_CO_OPTS} ${ECVS_MODULE}" |
| … | |
… | |
| 432 | if [ "${CVS_ECLASS_ORIG_DISPLAY+set}" == "set" ]; then |
449 | if [ "${CVS_ECLASS_ORIG_DISPLAY+set}" == "set" ]; then |
| 433 | export DISPLAY="${CVS_ECLASS_ORIG_DISPLAY}" |
450 | export DISPLAY="${CVS_ECLASS_ORIG_DISPLAY}" |
| 434 | else |
451 | else |
| 435 | unset DISPLAY |
452 | unset DISPLAY |
| 436 | fi |
453 | fi |
|
|
454 | elif [ "${ECVS_AUTH}" == "no" ]; then |
|
|
455 | if [ "${mode}" == "update" ]; then |
|
|
456 | einfo "Running $cmdupdate" |
|
|
457 | eval $cmdupdate || die "cvs update command failed" |
|
|
458 | elif [ "${mode}" == "checkout" ]; then |
|
|
459 | einfo "Running $cmdcheckout" |
|
|
460 | eval $cmdcheckout|| die "cvs checkout command failed" |
|
|
461 | fi |
| 437 | fi |
462 | fi |
| 438 | |
463 | |
| 439 | # Restore ownership. Not sure why this is needed, but someone |
464 | # Restore ownership. Not sure why this is needed, but someone |
| 440 | # added it in the orig ECVS_RUNAS stuff. |
465 | # added it in the orig ECVS_RUNAS stuff. |
| 441 | if [ -n "$ECVS_RUNAS" ]; then |
466 | if [ -n "$ECVS_RUNAS" ]; then |