aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRalph Sennhauser <sera@gentoo.org>2012-06-10 12:33:10 +0000
committerRalph Sennhauser <sera@gentoo.org>2012-06-10 12:33:10 +0000
commiteef9d142998cb22d7960b54292b3ae7aa5fe865d (patch)
tree54a6b121405c39a6858c2dd3cca86fbc98b39d85 /src
downloadeselect-java-eef9d142998cb22d7960b54292b3ae7aa5fe865d.tar.gz
eselect-java-eef9d142998cb22d7960b54292b3ae7aa5fe865d.tar.bz2
eselect-java-eef9d142998cb22d7960b54292b3ae7aa5fe865d.zip
New project eselect-java, new home of all java releated eselect modules.
Write build system and auxilary files. Import eselect modules "java-vm" and "java-nsplugin" from java-config-2.1.12. Import eselect module "maven" from eselect-maven-0.2 import eselect module "ecj" from eselect-ecj-0.7 svn path=/projects/eselect-java/trunk/; revision=9067
Diffstat (limited to 'src')
-rw-r--r--src/modules/Makefile.am19
-rw-r--r--src/modules/ecj.eselect.in151
-rw-r--r--src/modules/java-nsplugin.eselect.in208
-rw-r--r--src/modules/java-vm.eselect.in163
-rw-r--r--src/modules/maven.eselect.in175
5 files changed, 716 insertions, 0 deletions
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
new file mode 100644
index 0000000..9e7ee74
--- /dev/null
+++ b/src/modules/Makefile.am
@@ -0,0 +1,19 @@
+modulesdir=$(datadir)/eselect/modules/
+
+modules_DATA = \
+ ecj.eselect \
+ java-nsplugin.eselect \
+ java-vm.eselect \
+ maven.eselect
+
+EXTRA_DIST = \
+ ecj.eselect.in \
+ java-nsplugin.eselect.in \
+ java-vm.eselect.in \
+ maven.eselect.in
+
+CLEANFILES = $(modules_DATA)
+MAINTAINERCLEANFILES = Makefile.in
+
+%.eselect : %.eselect.in
+ $(SED) "s|\@VERSION\@|@PACKAGE_VERSION@|g" $< >$@
diff --git a/src/modules/ecj.eselect.in b/src/modules/ecj.eselect.in
new file mode 100644
index 0000000..3250b97
--- /dev/null
+++ b/src/modules/ecj.eselect.in
@@ -0,0 +1,151 @@
+# -*-eselect-*- vim: ft=eselect
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: ecj-0.7.eselect,v 1.1 2011/12/18 08:44:56 sera Exp $
+
+DESCRIPTION="Manage ECJ targets"
+MAINTAINER="java@gentoo.org"
+VERSION="0.7"
+
+ECJ="${EROOT}/usr/bin/ecj"
+ECJ_JAR="${EROOT}/usr/share/eclipse-ecj/ecj.jar"
+
+# find a list of ecj symlink targets, best first.
+find_targets() {
+ for f in $(ls -r "${ECJ}"-[0-9]* "${ECJ}"-gcj-[0-9]* 2> /dev/null) ; do
+ if [[ -f "${f}" ]] ; then
+ echo $(basename "${f}")
+ fi
+ done
+}
+
+# get a named or numbered target.
+find_target() {
+ local target=${1}
+
+ if is_number "${target}" && [[ ${target} -ge 1 ]] ; then
+ targets=( $(find_targets ) )
+ [[ -z "${targets}" ]] && die -q "No targets found!"
+ target=${targets[target-1]}
+ fi
+
+ if [[ "${target}" = ecj-[0-9]* || "${target}" = ecj-gcj-[0-9]* ]] \
+ && [[ -f "${EROOT}/usr/bin/${target}" ]] ; then
+ echo ${target}
+ else
+ die -q "Target \"${1}\" doesn't appear to be valid!"
+ fi
+}
+
+# determine the current target.
+get_target() {
+ local canonicalised=$(canonicalise "${ECJ}")
+ echo $(basename "${canonicalised}")
+}
+
+### show action ###
+
+describe_show() {
+ echo "Show current ECJ target"
+}
+
+do_show() {
+ if [[ ${#} -gt 0 ]]; then
+ die -q "No parameters allowed."
+ fi
+
+ if [[ -L "${ECJ}" ]] ; then
+ get_target
+ return 0
+ elif [[ -e "${ECJ}" ]] ; then
+ echo "(not a symlink)" >&2
+ return 1
+ else
+ echo "(unset)" >&2
+ return 1
+ fi
+}
+
+### list action ###
+
+describe_list() {
+ echo "List available ECJ targets"
+}
+
+do_list() {
+ if [[ ${#} -gt 0 ]]; then
+ die -q "Usage error: no parameters allowed."
+ fi
+
+ local i targets
+ targets=( $(find_targets) )
+
+ for (( i = 0; i < ${#targets[@]}; i++ )); do
+ [[ ${targets[i]} = $(basename "$(canonicalise "${ECJ}")") ]] \
+ && targets[i]=$(highlight_marker "${targets[i]}")
+ done
+
+ write_list_start "Available ECJ targets:"
+ write_numbered_list -m "(none found)" "${targets[@]}"
+}
+
+### set action ###
+
+describe_set() {
+ echo "Set a new ECJ target"
+}
+
+describe_set_options() {
+ echo "target : Target name or number (from 'list' action)"
+}
+
+describe_set_parameters() {
+ echo "<target>"
+}
+
+do_set() {
+ [[ ${1} ]] || die -q "You didn't give me a target name or number."
+ [[ ${2} ]] && die -q "Too many parameters. Expected only one."
+
+ local target=$(find_target "${1}")
+
+ rm -f "${ECJ}" "${ECJ_JAR}"
+
+ ln -sf "${target}" "${ECJ}" || die "Couldn't set ${target} symlink."
+ mkdir -p $(dirname ${ECJ_JAR})
+ [[ "${target}" != ecj-gcj* ]] && target="eclipse-${target}"
+ ln -sf "${EROOT}"/usr/share/${target}/lib/ecj.jar ${ECJ_JAR} \
+ || die -q "Wasn't able to set a new provider."
+}
+
+### update action ###
+
+describe_update() {
+ echo "Set the ECJ target to the latest if the current target is invalid or if the given target is the latest"
+}
+
+describe_update_options() {
+ echo "target (optional) : Target name (from 'list' action)"
+}
+
+describe_update_parameters() {
+ echo "<target>"
+}
+
+do_update() {
+ [[ ${1} ]] && find_target "${1}" >/dev/null
+ [[ ${2} ]] && die -q "Too many parameters. Expected only one."
+
+ if [[ ! -f "${ECJ}" ]] || [[ ! -f "${ECJ_JAR}" ]]; then
+ local target="${1}"
+ if [[ -z "${target}" ]]; then
+ local all_targets=( $(find_targets) )
+ target=${all_targets}
+ fi
+ if [[ ${target} ]]; then
+ do_set ${target}
+ else
+ rm -f "${ECJ}" "${ECJ_JAR}"
+ fi
+ fi
+}
diff --git a/src/modules/java-nsplugin.eselect.in b/src/modules/java-nsplugin.eselect.in
new file mode 100644
index 0000000..3d21db0
--- /dev/null
+++ b/src/modules/java-nsplugin.eselect.in
@@ -0,0 +1,208 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+inherit tests multilib
+
+DESCRIPTION="Manage the Java plugin for Netscape-like Browsers"
+MAINTAINER="java@gentoo.org"
+SVN_DATE='$Date: $'
+VERSION=$(svn_date_to_version "${SVN_DATE}" )
+
+
+PLUGINS_HOME="${ROOT}/usr/share/java-config-2/nsplugin"
+SYSTEM_PLUGIN_DIR="${ROOT}/usr/lib/nsbrowser/plugins"
+SYSTEM_PLUGIN_DIR_32="${ROOT}/usr/lib32/nsbrowser/plugins"
+SYSTEM_PLUGIN_DIR_64="${ROOT}/usr/lib64/nsbrowser/plugins"
+SYSTEM_PLUGIN="${SYSTEM_PLUGIN_DIR}/javaplugin.so"
+SYSTEM_PLUGIN_32="${SYSTEM_PLUGIN_DIR_32}/javaplugin.so"
+SYSTEM_PLUGIN_64="${SYSTEM_PLUGIN_DIR_64}/javaplugin.so"
+
+libdirs=$(list_libdirs)
+if has lib32 ${libdirs} && has lib64 ${libdirs}; then
+ IS_MULTILIB="true"
+else
+ IS_MULTILIB="false"
+fi
+### show action
+
+## {{{ show stuff
+
+ describe_show() {
+ echo "Show the current Java browser plugin"
+ }
+
+ do_show() {
+ local system_name=$(get_system_plugin_vm)
+ write_list_start "Current Java browser plugin"
+ if [[ -z "${system_name}" ]] ; then
+ write_kv_list_entry "(unset)" ""
+ else
+ write_kv_list_entry "${system_name}" ""
+ fi
+ }
+
+## }}}
+
+### list action
+
+
+
+## {{{ list stuff
+ describe_list() {
+ echo "List available Java browser plugins"
+ }
+
+ tweak_list_item() {
+ local vm=${1}
+ local system_name=${2}
+ local mark=""
+ if [[ ${vm} == ${system_name} ]]; then
+ mark="${mark} $(highlight 'current')"
+ fi
+ echo "${vm} ${mark}"
+ }
+
+ tweak_list() {
+ local targets=( ${@} )
+ system_name=$(get_system_plugin_vm)
+
+ for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do
+ twaek_list_item ${targets[${i}]} ${system_name}
+ done
+ }
+
+ do_list() {
+ if [[ ${IS_MULTILIB} != "true" ]]; then
+ MULTILIB_MODE="none"
+ local system_name=$(get_system_plugin_vm)
+ local targets=( $(get_targets) )
+ for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do
+ targets[${i}]=$(tweak_list_item ${targets[${i}]} ${system_name})
+ done
+
+ write_list_start "Available Java browser plugins"
+ write_numbered_list "${targets[@]}"
+ else
+ MULTILIB_MODE="32"
+ local system_name_32=$(get_system_plugin_vm)
+ local targets_32=( $(get_targets) )
+ for (( i = 0 ; i < ${#targets_32[@]} ; i = i + 1 )) ; do
+ targets_32[${i}]=$(tweak_list_item ${targets_32[${i}]} ${system_name_32})
+ done
+ write_list_start "Available 32-bit Java browser plugins"
+ write_numbered_list "${targets_32[@]}"
+
+ MULTILIB_MODE="64"
+ local system_name_64=$(get_system_plugin_vm)
+ local targets_64=( $(get_targets) )
+ for (( i = 0 ; i < ${#targets_64[@]} ; i = i + 1 )) ; do
+ targets_64[${i}]=$(tweak_list_item ${targets_64[${i}]} ${system_name_64})
+ done
+ write_list_start "Available 64-bit Java browser plugins"
+ write_numbered_list "${targets_64[@]}"
+ fi
+ }
+## }}}
+
+### set action
+
+## {{{ set stuff
+ describe_set() {
+ echo "Set the system Java browser plugin"
+ }
+
+ do_set() {
+ if [[ ${IS_MULTILIB} != "true" ]]; then
+ if [[ ${#} != 1 ]] ; then
+ die -q "Usage: set [nsplugin-vm]"
+ fi
+ MULTILIB_MODE="none"
+ else
+ if [[ ${#} != 2 ]] ; then
+ die -q "Usage: set [32bit or 64bit] [nsplugin-vm]"
+ fi
+ case ${1} in
+ 32bit) ;;
+ 64bit) ;;
+ *)
+ die -q "Usage: set [32bit or 64bit] [nsplugin-vm]"
+ ;;
+ esac
+ MULTILIB_MODE=${1%bit}
+ shift
+ fi
+
+ local vm=${1}
+
+ if is_number "${vm}" ; then
+ local targets=( $(get_targets) )
+ vm=${targets[$(( ${vm} - 1 ))]}
+ fi
+
+ if [[ -z ${vm} ]] ; then
+ die -q "You didn't specify valid plugin number to set"
+ fi
+
+ local plugin="${PLUGINS_HOME}/${vm}-javaplugin.so"
+
+ if [[ ! -f ${plugin} ]]; then
+ write_error_msg "Expected \"${plugin}\" to exist, but it doesn't."
+ write_error_msg "Perhaps \"${vm}\" isn't a valid name of VM built with nsplugin?"
+ return
+ fi
+
+ local system_plugin
+ case ${MULTILIB_MODE} in
+ 32) system_plugin=${SYSTEM_PLUGIN_32} ;;
+ 64) system_plugin=${SYSTEM_PLUGIN_64} ;;
+ none) system_plugin=${SYSTEM_PLUGIN} ;;
+ esac
+ mkdir -p $(dirname ${system_plugin}) || die -q "Error creating \"$(dirname ${SYSTEM_PLUGIN})\""
+ if [[ -w $(dirname ${system_plugin}) ]] ; then
+ ln -sf ${plugin} ${system_plugin} || die -q "Error creating nsplugin symlink"
+ else
+ die -q "Sorry, you don't have enough permission to set nsplugin"
+ fi
+ }
+## }}}
+
+get_targets() {
+ for plugin in $(ls ${PLUGINS_HOME}/*-javaplugin.so 2>/dev/null);
+ do
+ local vm=$(plugin_to_vm ${plugin})
+ local matches=""
+ case ${MULTILIB_MODE} in
+ 32)
+ [[ ${vm} = emul-linux-* ]] && matches="true"
+ ;;
+ 64)
+ [[ ${vm} != emul-linux-* ]] && matches="true"
+ ;;
+ none)
+ matches="true"
+ ;;
+ esac
+ [[ ${matches} == "true" ]] && echo ${vm}
+ done
+}
+
+plugin_to_vm() {
+ local base=$(basename ${1})
+ echo ${base%-javaplugin.so}
+}
+
+get_system_plugin_vm() {
+ local plugin;
+
+ if [[ ${MULTILIB_MODE} == "32" ]]; then
+ plugin=$(readlink ${SYSTEM_PLUGIN_32})
+ elif [[ ${MULTILIB_MODE} == "64" ]]; then
+ plugin=$(readlink ${SYSTEM_PLUGIN_64})
+ else
+ plugin=$(readlink ${SYSTEM_PLUGIN})
+ fi
+ plugin_to_vm ${plugin}
+}
+
+# vim: ts=4 sw=4 noet fdm=marker
diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
new file mode 100644
index 0000000..063b7c2
--- /dev/null
+++ b/src/modules/java-vm.eselect.in
@@ -0,0 +1,163 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+# Based on kernel.eselect
+
+DESCRIPTION="Manage the Java system and user VM"
+MAINTAINER="java@gentoo.org"
+SVN_DATE='$Date: $'
+VERSION=$(svn_date_to_version "${SVN_DATE}" )
+
+VM_BASE=/usr/lib/jvm
+VM_SYSTEM="/etc/java-config-2/current-system-vm"
+VM_USER="${HOME}/.gentoo/java-config-2/current-user-vm"
+VM_CONFIG="/usr/share/java-config-2/vm"
+
+find_targets() {
+ local f
+ for f in ${VM_BASE}/* ; do
+ [[ -L ${f} ]] && echo $(basename ${f})
+ done
+}
+
+sym_to_vm() {
+ basename $(readlink "${1}")
+}
+
+### show action ###
+
+describe_show() {
+ echo "Show the current vm"
+}
+
+do_show() {
+ if [[ ${1} == "system" ]]; then
+ my_show ${VM_SYSTEM} 'system-vm'
+ elif [[ ${1} == "user" ]]; then
+ my_show ${VM_USER} 'user-vm'
+ else
+ my_show ${VM_SYSTEM} 'system-vm'
+ my_show ${VM_USER} 'user-vm'
+ fi
+}
+
+my_show() {
+ local symlink=${1} vm_type=${2}
+ write_list_start "Current ${vm_type}"
+ if [[ -L "${symlink}" ]] ; then
+ write_kv_list_entry "$(sym_to_vm ${symlink})" ""
+ else
+ write_kv_list_entry "(unset)" ""
+ fi
+}
+
+### list action ###
+
+describe_list() {
+ echo "List Available Virtual Machines"
+}
+
+do_list() {
+ targets=( $(find_targets) )
+ write_list_start "Available Java Virtual Machines:"
+ local found_build_only
+ if [[ -n ${targets[@]} ]] ; then
+ local i system_name user_name
+
+ [[ -L ${VM_SYSTEM} ]] && system_name=$(sym_to_vm ${VM_SYSTEM})
+ [[ -L ${VM_USER} ]] && user_name=$(sym_to_vm ${VM_USER})
+
+ for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do
+ local build_only=$(grep 'BUILD_ONLY' ${VM_CONFIG}/${targets[${i}]} | cut -c 13-16 )
+ local mark=""
+
+ if [[ "${build_only}" == "TRUE" || "{build_only}" == "true" ]]; then
+ mark="$(highlight_warning 'Build Only')"
+ found_build_only="TRUE"
+ fi
+
+ if [[ ${targets[${i}]} == ${system_name} ]]; then
+ mark="${mark} $(highlight 'system-vm')"
+ fi
+ if [[ ${targets[${i}]} == ${user_name} ]]; then
+ mark="${mark} $(highlight 'user-vm' )"
+ fi
+ targets[${i}]="${targets[${i}]} ${mark}"
+ done
+ write_numbered_list "${targets[@]}"
+ else
+ write_kv_list_entry "(none found)" ""
+ fi
+ echo
+ if [[ "${found_build_only}" == "TRUE" ]]; then
+ write_warning_msg "VMs marked as Build Only may contain Security Vulnerabilities and/or be EOL."
+ write_warning_msg "Gentoo recommends not setting these VMs as either your System or User VM."
+ write_warning_msg "Please see http://www.gentoo.org/doc/en/java.xml#build-only for more information."
+ fi
+}
+
+### set action ###
+
+describe_set() {
+ echo "Set a new system or user vm"
+}
+
+do_set() {
+ local usage="Usage [user|system] [vm]"
+ if [[ ${#} != 2 ]]; then
+ die -q ${usage}
+
+ elif [[ ${1} == "system" ]]; then
+ if [[ -w $(dirname ${VM_SYSTEM}) ]]; then
+ my_set ${VM_SYSTEM} ${2}
+ else
+ die -q "Sorry, you don't have enough premission to set system"
+ fi
+ elif [[ ${1} == "user" ]]; then
+ if [[ ${UID} != 0 ]]; then
+ my_set ${VM_USER} ${2}
+ else
+ die -q "Sorry, you cannot set a user vm as root. Set the system vm instead"
+ fi
+ else
+ die -q ${usage}
+ fi
+}
+
+my_set() {
+ local target=${2} symlink=${1}
+ if [[ -z ${target} ]] ; then
+ die -q "You didn't tell me what to set the symlink to"
+
+ elif [[ -L "${symlink}" ]] ; then
+ set_symlink "${target}" "${symlink}" || die -q "Couldn't set a new symlink"
+
+ elif [[ -e "${symlink}" ]] ; then
+ die -q "Target file already exists and is not a symlink: ${symlink}"
+
+ else
+ set_symlink "${target}" "${symlink}" || die -q "Couldn't set a new symlink"
+ fi
+}
+
+set_symlink() {
+ local target=${1} symlink=${2}
+ if is_number "${target}" ; then
+ targets=( $(find_targets) )
+ target=${targets[$(( ${target} - 1 ))]}
+ fi
+ if [[ -z ${target} ]] ; then
+ die -q "Target \"${1}\" doesn't appear to be valid!"
+ elif [[ -d "${VM_BASE}/${target}" ]] ; then
+ local sym_dir=$(dirname ${symlink})
+ if [[ ! -d ${sym_dir} ]]; then
+ mkdir -p ${sym_dir} || die -q "Could not create ${my_dir}"
+ fi
+ ln -snf "${VM_BASE}/${target}" "${symlink}"
+ else
+ die -q "Target \"${1}\" doesn't appear to be valid!"
+ fi
+}
+
+# vim: set ft=eselect :
diff --git a/src/modules/maven.eselect.in b/src/modules/maven.eselect.in
new file mode 100644
index 0000000..caac8be
--- /dev/null
+++ b/src/modules/maven.eselect.in
@@ -0,0 +1,175 @@
+# -*-eselect-*- vim: ft=eselect
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: maven-0.2.eselect,v 1.1 2010/02/28 19:31:04 ulm Exp $
+
+DESCRIPTION="Manage Maven targets"
+MAINTAINER="java@gentoo.org"
+VERSION="0.2"
+
+MVN="${EROOT}/usr/bin/mvn"
+
+# find a list of mvn symlink targets, best first.
+find_targets() {
+ for f in $(ls -r "${MVN}"-[0-9]* 2> /dev/null) ; do
+ if [[ -f "${f}" ]] ; then
+ echo $(basename "${f}")
+ fi
+ done
+}
+
+# get a named or numbered target.
+find_target() {
+ local target=${1}
+
+ if is_number "${target}" && [[ ${target} -ge 1 ]] ; then
+ targets=( $(find_targets ) )
+ [[ -z "${targets}" ]] && die -q "No targets found!"
+ target=${targets[target-1]}
+ fi
+
+ if [[ "${target}" = mvn-[0-9]* ]] && [[ -f "${EROOT}/usr/bin/${target}" ]] ; then
+ echo ${target}
+ else
+ die -q "Target \"${1}\" doesn't appear to be valid!"
+ fi
+}
+
+# try to remove the mvn symlink.
+remove_symlink() {
+ rm "${MVN}" &>/dev/null
+}
+
+# determine the current target.
+get_target() {
+ local canonicalised=$(canonicalise "${MVN}")
+ echo $(basename "${canonicalised}")
+}
+
+# set the Maven symlink.
+set_symlink() {
+ local target=$(find_target "${1}")
+ remove_symlink
+ ln -s "${target}" "${MVN}" || die "Couldn't set ${target} symlink."
+}
+
+### show action ###
+
+describe_show() {
+ echo "Show current Maven target"
+}
+
+do_show() {
+ if [[ ${#} -gt 0 ]]; then
+ die -q "No parameters allowed."
+ fi
+
+ if [[ -L "${MVN}" ]] ; then
+ get_target
+ return 0
+ elif [[ -e "${MVN}" ]] ; then
+ echo "(not a symlink)" >&2
+ return 1
+ else
+ echo "(unset)" >&2
+ return 1
+ fi
+}
+
+### list action ###
+
+describe_list() {
+ echo "List available Maven targets"
+}
+
+do_list() {
+ if [[ ${#} -gt 0 ]]; then
+ die -q "Usage error: no parameters allowed."
+ fi
+
+ local i targets
+ targets=( $(find_targets) )
+
+ for (( i = 0; i < ${#targets[@]}; i++ )); do
+ [[ ${targets[i]} = $(basename "$(canonicalise "${MVN}")") ]] \
+ && targets[i]=$(highlight_marker "${targets[i]}")
+ done
+
+ write_list_start "Available Maven targets:"
+ write_numbered_list -m "(none found)" "${targets[@]}"
+}
+
+### set action ###
+
+describe_set() {
+ echo "Set a new Maven target"
+}
+
+describe_set_options() {
+ echo "target : Target name or number (from 'list' action)"
+}
+
+describe_set_parameters() {
+ echo "<target>"
+}
+
+do_set() {
+ if [[ $# -gt 1 ]]; then
+ die -q "Too many parameters. Expected only one."
+ fi
+
+ local target=${1}
+
+ if [[ -z "${target}" ]] ; then
+ die -q "You didn't give me a target name or number."
+ elif [[ -L "${MVN}" ]] ; then
+ if ! remove_symlink ; then
+ die -q "Can't remove existing Maven provider."
+ elif ! set_symlink "${1}" ; then
+ die -q "Can't set new Maven provider."
+ fi
+ elif [[ -e "${MVN}" ]] ; then
+ write_warning_msg "Can't set a new Maven provider. There's a file in the way at ${MVN}. You can try removing it manually, and then re-running this command."
+ else
+ set_symlink "${target}" || die -q "Wasn't able to set a new provider."
+ fi
+}
+
+### update action ###
+
+describe_update() {
+ echo "Set the Maven target to the latest if the current target is invalid or if the given target is the latest"
+}
+
+describe_update_options() {
+ echo "target (optional) : Target name (from 'list' action)"
+}
+
+describe_update_parameters() {
+ echo "<target>"
+}
+
+do_update() {
+ if [[ $# -gt 1 ]] ; then
+ die -q "Too many parameters. Expected only one."
+ fi
+
+ # For pkg_postrm
+ if [[ ! $(find_targets) ]]; then
+ remove_symlink
+ return
+ fi
+
+ local canonicalised=$(canonicalise "${MVN}")
+
+ if [[ ! -L "${MVN}" ]] || [[ ! -f "${canonicalised}" ]] ; then
+ do_set 1
+ elif [[ -n "${1}" ]] ; then
+ # Check whether target name is valid.
+ find_target "${1}" > /dev/null
+
+ if [[ "${1}" == "$(find_target 1)" ]] ; then
+ do_set 1
+ fi
+ fi
+}