aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/java-nsplugin.eselect.in258
1 files changed, 123 insertions, 135 deletions
diff --git a/src/modules/java-nsplugin.eselect.in b/src/modules/java-nsplugin.eselect.in
index c87cff9..2404d97 100644
--- a/src/modules/java-nsplugin.eselect.in
+++ b/src/modules/java-nsplugin.eselect.in
@@ -22,140 +22,6 @@ is_multilib() {
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}"
- }
-
- do_list() {
- if ! is_multilib; 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; 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
@@ -194,4 +60,126 @@ get_system_plugin_vm() {
plugin_to_vm ${plugin}
}
-# vim: ts=4 sw=4 noet fdm=marker
+### show action ###
+
+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 ###
+
+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}"
+}
+
+do_list() {
+ if ! is_multilib; 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 ###
+
+describe_set() {
+ echo "Set the system Java browser plugin"
+}
+
+do_set() {
+ if ! is_multilib; 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
+}