From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Si7hQ-0003SU-HD for garchives@archives.gentoo.org; Fri, 22 Jun 2012 17:31:12 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 81C50E0866; Fri, 22 Jun 2012 17:29:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 44F2DE07FE for ; Fri, 22 Jun 2012 17:29:25 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D971D1B401D for ; Fri, 22 Jun 2012 17:29:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 0BA61E542E for ; Fri, 22 Jun 2012 17:29:22 +0000 (UTC) From: "Ulrich Mueller" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Mueller" Message-ID: <1181063309.8a68ceeb005bd83efada18e686fc10640b849297.ulm@gentoo> Subject: [gentoo-commits] proj/emacs-tools:eselect-emacs-1.1 commit in: / X-VCS-Repository: proj/emacs-tools X-VCS-Files: emacs.eselect X-VCS-Directories: / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Mueller X-VCS-Revision: 8a68ceeb005bd83efada18e686fc10640b849297 X-VCS-Branch: eselect-emacs-1.1 Date: Fri, 22 Jun 2012 17:29:22 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: f26afd78-ade3-42f8-8217-f252a8fb3efc X-Archives-Hash: 3d1b4a8f9495dc07d38fde23cc0a62f3 commit: 8a68ceeb005bd83efada18e686fc10640b849297 Author: Christian Faulhammer gentoo org> AuthorDate: Tue Jun 5 17:08:29 2007 +0000 Commit: Ulrich Mueller gentoo org> CommitDate: Tue Jun 5 17:08:29 2007 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/emacs-tools.g= it;a=3Dcommit;h=3D8a68ceeb * added an additional die for remove_symlinks() in set_symlinks() * rephrased output in do_set() and do_update() * rewrote parts do_set() in such a way that an invalid target does not cause an undefined state. An invalid target was checked after the symlinks were deleted and then not setting a new target svn path=3D/emacs-extra/eselect-emacs/; revision=3D367 --- emacs.eselect | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/emacs.eselect b/emacs.eselect index 335c2c8..4c0ac9d 100644 --- a/emacs.eselect +++ b/emacs.eselect @@ -67,7 +67,7 @@ set_bin_symlinks() { # set symlink only if target binary actually exists if [[ -f "${ROOT}/usr/bin/${f}-${target}" ]]; then ln -s "${f}-${target}" "${ROOT}/usr/bin/${f}" || - die "Couldn't set ${f}-${target} /usr/bin/${f} symlink" + die "Couldn't set ${f}-${target} ${ROOT}/usr/bin/${f} symlink" fi done } @@ -104,12 +104,12 @@ set_symlinks() { || die -q "Target \"${1}\" doesn't appear to be valid!" =20 echo "Switching to ${target} ..." - remove_symlinks + remove_symlinks || die -q "Couldn't remove existing symlink" # the main /usr/bin/emacs symlink is only set for Emacs binaries # (but not for other providers of auxiliary programs, e.g., XEmacs) if [[ ${target} =3D=3D emacs-* ]]; then ln -s "${target}" "${ROOT}/usr/bin/emacs" \ - || die "Couldn't set ${target} /usr/bin/emacs symlink" + || die "Couldn't set ${target} ${ROOT}/usr/bin/emacs symlink" fi set_bin_symlinks "${target}" set_man_symlinks "${target}" @@ -205,10 +205,8 @@ do_set() { [[ -n "${2}" ]] && die -q "Too many parameters" test_for_root =20 - if [[ -L "${ROOT}/usr/bin/emacs" ]]; then - remove_symlinks || die -q "Couldn't remove existing symlink" - elif [[ -e "${ROOT}/usr/bin/emacs" ]]; then - die -q "Sorry, ${ROOT}/usr/bin/emacs exists and is not a symlink" + if [[ -e "${ROOT}/usr/bin/emacs" ]] && ! [[ -L "${ROOT}/usr/bin/emacs" = ]]; then + die -q "Sorry, ${ROOT}/usr/bin/emacs exists but is not a symlink" fi =20 set_symlinks "${1}" || die -q "Couldn't set a new symlink" @@ -234,7 +232,7 @@ do_update() { && -e "$(canonicalise ${ROOT}/usr/bin/emacs)" ]] && return remove_symlinks || die -q "Couldn't remove existing symlink" elif [[ -e "${ROOT}/usr/bin/emacs" ]]; then - die -q "Sorry, ${ROOT}/usr/bin/emacs exists and is not a symlink" + die -q "Sorry, ${ROOT}/usr/bin/emacs exists but is not a symlink" fi =20 local targets=3D( $(find_targets) )