diff options
Diffstat (limited to 'app-eselect')
-rw-r--r-- | app-eselect/eselect-gradle/files/gradle.eselect | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/app-eselect/eselect-gradle/files/gradle.eselect b/app-eselect/eselect-gradle/files/gradle.eselect deleted file mode 100644 index de5e0fa8..00000000 --- a/app-eselect/eselect-gradle/files/gradle.eselect +++ /dev/null @@ -1,131 +0,0 @@ -# -*-eselect-*- vim: ft=eselect -# Copyright 1999-2015 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 or later -# $Id: $ - -DESCRIPTION="Manage the /usr/bin/gradle symlink" -MAINTAINER="flo@geekplace.eu" -VERSION=0.1 - -# find a list of gradle symlink targets -find_targets() { - local f - for f in "${EROOT}"/usr/bin/gradle?(-bin)-[[:digit:]]*; do - [[ -x ${f} ]] && basename "${f}" - done -} - -remove_symlink() { - rm "${EROOT}/usr/bin/gradle" \ - || die -q "Could not remove symlink" -} - -set_symlink() { - local target=$1 - - if is_number "${target}"; then - local targets=( $(find_targets) ) - target=${targets[target-1]} - fi - - [[ -z ${target} ]] \ - && die -q "Target \"${1}\" doesn't apper to be valid!" - - [[ ! -x ${EROOT}/usr/bin/${target} ]] \ - && die -q "${EROOT}/usr/bin/${target} is not an executable" - - ln -s "${target}" "${EROOT}/usr/bin/gradle" \ - || die -q "Could not set symlink" -} - -describe_show() { - echo "Shows the current gradle symlink" -} - -do_show() { - write_list_start "Current gradle symlink:" - if [[ -L ${EROOT}/usr/bin/gradle ]]; then - local gradle=$(canonicalise "${EROOT}/usr/bin/gradle") - write_kv_list_entry "${gradle}" "" - else - write_kv_list_entry "(unset)" "" - fi -} - -describe_list() { - echo "list available gradle symlink targets" -} - -do_list() { - local i targets=( $(find_targets) ) - - write_list_start "Available gradle symlink targets:" - for (( i = 0; i < ${#targets[@]}; i++ )); do - # highligh the target where the symlink is pointing to - [[ ${targets[i]} = \ - $(basename "$(canonicalise "${EROOT}/usr/bin/gradle")") ]] \ - && targets[i]=$(highlight_marker "${targets[i]}") - done - write_numbered_list -m "(none found)" "${targets[@]}" -} - -describe_set() { - echo "Set a new gradle symlink target" -} - -describe_set_parameters() { - echo "<target>" -} - -describe_set_options() { - echo "target : Target name or number (from 'list' action)" -} - -do_set() { - [[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to" - [[ $# -gt 1 ]] && die -q "Too many parameters" - test_for_root - - if [[ -L ${EROOT}/usr/bin/gradle ]]; then - # existing symmlink - remove_symlink - set_symlink "$1" - elif [[ -e ${EROOT}/usr/bin/gradle ]]; then - # we have someting strange - die -q "${EROOT}/usr/bin/gradle exists but is not a symlink" - else - set_symlink "$1" - fi -} - -describe_update() { - echo "Automatically update the gradle symlink" -} - -describe_update_options() { - echo "ifunset: Do not override currently set version" -} - -do_update() { - [[ -z $1 || $1 == ifunset ]] || die -q "Usage error" - [[ $# -gt 1 ]] && die -q "Too many parameters" - test_for_root - - if [[ -L ${EROOT}/usr/bin/gradle ]]; then - if [[ $1 == ifunset && -e ${EROOT}/usr/bin/gradle ]]; then - return - fi - remove_symlink - elif [[ -e ${EROOT}/usr/bin/gradle ]]; then - die -q "${EROOT}/usr/bin/gradle exists but is not a symlink" - fi - - local targets=( $(find_targets) ) - if [[ ${#targets[@]} -gt 0 ]]; then - set_symlink "${targets[${#targets[@]}-1]}" - fi -} - -test_for_root() { - [[ -w ${EROOT}/usr/bin ]] || die -q "${EROOT}/usr/bin not writeable by current user. Are you root?" -} |