From 0d81f4b851b1f625dd01814c426e47cbcabdd472 Mon Sep 17 00:00:00 2001 From: tony mancill Date: Sat, 10 Sep 2016 15:17:36 -0700 Subject: [PATCH] add --priority option (Closes: #820857) This option allows the user to override the default computed priority considered by update-alternatives. Internally, it changes the priority written to the .jinfo files as well as sets priority for update-alternatives in the postinst. --- lib/javase.sh | 6 +++--- lib/oracle-jdk.sh | 2 +- lib/oracle-jre.sh | 2 +- lib/oracle-server-jre.sh | 2 +- make-jpkg | 7 ++++++- make-jpkg.1 | 6 ++++++ 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/javase.sh b/lib/javase.sh index a0eab00..12e5e21 100644 --- a/lib/javase.sh +++ b/lib/javase.sh @@ -126,7 +126,7 @@ if [ "\$1" = configure ]; then for program in \$*; do if [[ -f "\$program_base/\$program" ]]; then update-alternatives \\ - --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" $j2se_priority \\ + --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" ${priority_override:-$j2se_priority} \\ --slave "/usr/share/man/man1/\$program.1.gz" "\$program.1.gz" "$jvm_base$j2se_name/man/man1/\$program.1.gz" fi done @@ -138,7 +138,7 @@ if [ "\$1" = configure ]; then shift for program in \$*; do if [[ -f "\$program_base/\$program" ]]; then - update-alternatives --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" $j2se_priority + update-alternatives --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" ${priority_override:-$j2se_priority} fi done } @@ -151,7 +151,7 @@ if [ "\$1" = configure ]; then local plugin="\$4" [ -d "\$link_path" ] || install -d -m 755 "\$link_path" if [[ -f "\$plugin" ]]; then - update-alternatives --install "\$link_path/\$link_name" "\$plugin_name" "\$plugin" $j2se_priority + update-alternatives --install "\$link_path/\$link_name" "\$plugin_name" "\$plugin" ${priority_override:-$j2se_priority} fi } EOF diff --git a/lib/oracle-jdk.sh b/lib/oracle-jdk.sh index 3f51c30..721d5ca 100644 --- a/lib/oracle-jdk.sh +++ b/lib/oracle-jdk.sh @@ -163,7 +163,7 @@ EOF oracle_j2sdk_jinfo() { cat << EOF name=$j2se_name -priority=$j2se_priority +priority=${priority_override:-$j2se_priority} section=main EOF jinfos "hl" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_hl diff --git a/lib/oracle-jre.sh b/lib/oracle-jre.sh index 56eadeb..d33a610 100644 --- a/lib/oracle-jre.sh +++ b/lib/oracle-jre.sh @@ -126,7 +126,7 @@ EOF oracle_j2re_jinfo() { cat << EOF name=$j2se_name -priority=$j2se_priority +priority=${priority_override:-$j2se_priority} section=main EOF jinfos "hl" $jvm_base$j2se_name/bin/ $oracle_jre_bin_hl diff --git a/lib/oracle-server-jre.sh b/lib/oracle-server-jre.sh index 6faaeb6..c5195f6 100644 --- a/lib/oracle-server-jre.sh +++ b/lib/oracle-server-jre.sh @@ -114,7 +114,7 @@ EOF oracle_server_j2re_jinfo() { cat << EOF name=$j2se_name -priority=$j2se_priority +priority=${priority_override:-$j2se_priority} section=main EOF jinfos "hl" $jvm_base$j2se_name/bin/ $oracle_jre_bin_hl diff --git a/make-jpkg b/make-jpkg index 0533b95..3db992c 100755 --- a/make-jpkg +++ b/make-jpkg @@ -82,7 +82,8 @@ The following options are recognized: --full-name NAME full name used in the maintainer field of the package --email EMAIL email address used in the maintainer field of the package - --distribution Define the distribution to use in the changelog + --distribution DIST Define the distribution to use in the changelog + --priority PRIORITY Override default package priority --changes create a .changes file --revision add debian revision --source build a source package instead of a binary deb package @@ -135,6 +136,10 @@ while [[ $# -gt 0 && "x$1" == x--* ]]; do [ $# -le 1 ] && missing_argument "$1" shift distribution="$1" + elif [[ "x$1" == x--priority ]]; then + [ $# -le 1 ] && missing_argument "$1" + shift + priority_override="$1" elif [[ "x$1" == x--revision ]]; then [ $# -le 1 ] && missing_argument "$1" shift diff --git a/make-jpkg.1 b/make-jpkg.1 index ffcc716..34a5462 100644 --- a/make-jpkg.1 +++ b/make-jpkg.1 @@ -46,6 +46,12 @@ email address used in the maintainer field of the package .B --distribution \fIDISTRIBUTION\fR distribution to use in the debian changelog for the resulting package .TP +.B --priority \fIPRIORITY\fR +numeric priority for use by \fBupdate-alternatives\fP. This overrides the default +priority, which is intentionally lower than that of the Debian-provided OpenJDK +packages. Only use this option if the generated package should be considered higher +priority by \fBupdate-alternatives\fP. +.TP .B --changes create a .changes file .TP -- 2.39.5