summarylogtreecommitdiffstats
path: root/install_jdk17-temurin.sh
diff options
context:
space:
mode:
authorMichael Laß2022-04-20 21:23:01 +0200
committerMichael Laß2022-04-20 21:25:22 +0200
commit2d79c95bc3004f3440b572b2bdc3148f7d5ae89e (patch)
tree8484cc360a438a8af37e4fb048c682ddb9cc41b3 /install_jdk17-temurin.sh
parent4bfb9c3ee6ec669ba940ee21d5ede2cf77c1919b (diff)
downloadaur-2d79c95bc3004f3440b572b2bdc3148f7d5ae89e.tar.gz
Modify to be its own independent package
Diffstat (limited to 'install_jdk17-temurin.sh')
-rw-r--r--install_jdk17-temurin.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/install_jdk17-temurin.sh b/install_jdk17-temurin.sh
new file mode 100644
index 000000000000..0fa20575bf78
--- /dev/null
+++ b/install_jdk17-temurin.sh
@@ -0,0 +1,50 @@
+THIS_JDK='java-17-temurin'
+
+fix_default() {
+ if [ ! -x /usr/bin/java ]; then
+ /usr/bin/archlinux-java unset
+ echo ""
+ else
+ /usr/bin/archlinux-java get
+ fi
+}
+
+post_install() {
+ default=$(fix_default)
+ case ${default} in
+ "")
+ /usr/bin/archlinux-java set ${THIS_JDK}
+ ;;
+ ${THIS_JDK})
+ # Nothing
+ ;;
+ *)
+ echo "Default Java environment is already set to '${default}'"
+ echo "See 'archlinux-java help' to change it"
+ ;;
+ esac
+
+ if [ ! -f /etc/ssl/certs/java/cacerts ]; then
+ /usr/bin/update-ca-trust
+ fi
+}
+
+post_upgrade() {
+ default=$(fix_default)
+ if [ -z "${default}" ]; then
+ /usr/bin/archlinux-java set ${THIS_JDK}
+ fi
+
+ if [ ! -f /etc/ssl/certs/java/cacerts ]; then
+ /usr/bin/update-ca-trust
+ fi
+}
+
+pre_remove() {
+ if [ "x$(fix_default)" = "x${THIS_JDK}" ]; then
+ # Check JRE is still available
+ if [ -x /usr/lib/jvm/${THIS_JDK}/bin/java ]; then
+ /usr/bin/archlinux-java unset
+ fi
+ fi
+}