[java-policy] 73/198: - checkin missing scripts subdirectory, missing since 0.24
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Wed Sep 23 07:49:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository java-policy.
commit fde3063313abc628561c5b72bd8afd72a144b405
Author: Matthias Klose <doko at debian.org>
Date: Wed Mar 5 17:33:30 2008 +0000
- checkin missing scripts subdirectory, missing since 0.24
---
scripts/update-java-alternatives | 145 +++++++++++++++++++++++++++++++++++++
scripts/update-java-alternatives.8 | 55 ++++++++++++++
2 files changed, 200 insertions(+)
diff --git a/scripts/update-java-alternatives b/scripts/update-java-alternatives
new file mode 100755
index 0000000..3e232b7
--- /dev/null
+++ b/scripts/update-java-alternatives
@@ -0,0 +1,145 @@
+#! /bin/bash
+
+shopt -s dotglob
+
+prog=$(basename $0)
+
+usage()
+{
+ rv=$1
+ cat >&2 <<-EOF
+ usage: $prog [--jre] [--plugin] [ -t|--test|-v|--verbose]
+ -l|--list [<jname>]
+ -s|--set <jname>
+ -a|--auto
+ -h|-?|--help
+ EOF
+ exit $rv
+}
+
+action=
+uaopts='--quiet'
+
+while [ "$#" -gt 0 ]; do
+ case "$1" in
+ -a|--auto)
+ [ -z "$action" ] || usage 1
+ action=auto;;
+ -j|--jre)
+ jreonly=yes;;
+ --plugin)
+ pluginonly=yes;;
+ -l|--list)
+ [ -z "$action" ] || usage 1
+ action=list
+ if [ "$#" -gt 0 ]; then
+ shift
+ jname=$1
+ fi
+ ;;
+ -s|--set)
+ [ -z "$action" ] || usage 1
+ action=set
+ shift
+ [ "$#" -gt 0 ] || usage 1
+ jname=$1
+ ;;
+ -t|--test)
+ dryrun=yes
+ uaopts="$uaopts --test";;
+ -v|--verbose)
+ verbose=yes
+ uaopts="${uaopts/--quiet/}";;
+ -h|-?|--help)
+ usage 0;;
+ -*)
+ usage 1;;
+ *)
+ break;;
+ esac
+ shift
+done
+
+[ "$#" -eq 0 ] || usage 1
+[ -n "$action" ] || usage 1
+
+which='^(jre|jdk|plugin|DUMMY) '
+[ -n "$jreonly$pluginonly" ] && which=${which/jdk|/}
+[ -n "$pluginonly" ] && [ -z "$jreonly" ] && which=${which/jre|/}
+[ -z "$pluginonly" ] && [ -n "$jreonly" ] && which=${which/plugin|/}
+
+top=/usr/lib/jvm
+
+if [ -n "$jname" ]; then
+ case "$jname" in
+ /*) jdir=$jname; jname=$(basename $jdir);;
+ *) jdir=$top/$jname
+ esac
+ if [ ! -d $jdir ]; then
+ echo >&2 "$prog: directory does not exist: $jdir"
+ exit 1
+ fi
+ if [ -f $top/.$jname.jinfo ]; then
+ jinfo=$top/.$jname.jinfo
+ elif [ -f $top/$jname.jinfo ]; then
+ jinfo=$top/$jname.jinfo
+ else
+ echo >&2 "$prog: file does not exist: $top/.$jname.jinfo"
+ exit 1
+ fi
+fi
+
+vecho()
+{
+ [ -z "$verbose" ] || echo >&2 "$@"
+}
+
+jinfo_files=
+
+do_auto()
+{
+ vecho "resetting java alternatives"
+ awk "/$which/ {print \$2}" $top/*.jinfo | sort -u \
+ | \
+ while read name; do
+ update-alternatives $uaopts --auto $name
+ done
+}
+
+do_list()
+{
+ vecho "listing java alternatives:"
+ for i in $top/${jname:-*}.jinfo; do
+ alias=$(basename ${i%*.jinfo})
+ alias=${alias#.*}
+ prio=$(awk -F= '/priority=/ {print $2}' $i)
+ echo $alias $prio $top/$alias
+ [ -n "$verbose" ] && egrep "$which" $i
+ done
+}
+
+do_set()
+{
+ do_auto
+
+ awk "/$which/ {print}" $jinfo | sort -u \
+ | \
+ while read type name location; do
+ if [ $type = jdk -a -z "$jreonly$pluginonly" -a ! -f $location ]; then
+ echo >&2 "$prog: jdk alternative does not exist: $location"
+ continue
+ fi
+ if [ $type = plugin -a -z "$jreonly" -a ! -f $location ]; then
+ echo >&2 "$prog: plugin alternative does not exist: $location"
+ continue
+ fi
+ update-alternatives $uaopts --set $name $location
+ done
+}
+
+if [ "$action" != list ] && [ "$(id -u)" -ne 0 ]; then
+ echo >&2 "$prog: no root privileges"
+ exit 1
+fi
+
+do_$action
diff --git a/scripts/update-java-alternatives.8 b/scripts/update-java-alternatives.8
new file mode 100644
index 0000000..d6c0a99
--- /dev/null
+++ b/scripts/update-java-alternatives.8
@@ -0,0 +1,55 @@
+.TH UPDATE-JAVA-ALTERNATIVES "8" "May 2006"
+.SH NAME
+update-java-alternatives \- update alternatives for jre/sdk installations
+.SH SYNOPSIS
+.B update-java-alternatives [--jre] [--plugin] [-t|--test|-v|--verbose]
+ -l|--list [<jname>]
+ -s|--set <jname>
+ -a|--auto
+ -h|-?|--help
+.SH DESCRIPTION
+update-java-alternatives updates all alternatives belonging to one runtime
+or development kit for the Java language. A package does provide these
+information of it's alternatives in /usr/lib/jvm/.<jname>.jinfo.
+.SH OPTIONS
+.TP
+\fB\-l|\-\-list [<jname>]\fR
+List all installed packages (or just <jname>) providing information to set
+a bunch of java alternatives. Verbose output shows each alternative
+provided by the packages.
+.TP
+\fB\-a|\-\-auto\fR
+Switch all alternatives of registered jre/sdk installations to automatic mode.
+.TP
+\fB\-s|\-\-set <jname>\fR
+Set all alternatives of the registered jre/sdk installation to the program
+path provided by the <jname> installation.
+.TP
+\fB\-\-jre\fR
+Limit the actions to alternatives belong to a runtime environment,
+not a development kit.
+.TP
+\fB\-\-plugins\fR
+Limit the actions to alternatives providing browser plugins.
+.TP
+\fB\-h|\-\-help\fR
+Display a help message.
+.TP
+\fB\-t|\-\-test\fR
+Don't actually do anything, just say what would be done. The implementation
+status of this option is the same as for update-alternatives (not implemented).
+.TP
+\fB\-v|\-\-verbose\fR
+Verbose output.
+
+.SH FILES
+.TP
+.I /usr/lib/jvm/.*.jinfo
+A text file describing a jre/sdk installation. Consists of some
+variables of the form <var>=<value> and a list of alternatives of the form
+jre|jdk <name> <path>.
+
+.PP
+.SH AUTHOR
+update-java-alternatives and this manual page was written by Matthias
+Klose <doko at ubuntu.com>.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/java-policy.git
More information about the pkg-java-commits
mailing list