updated java state

This commit is contained in:
Paul 2023-01-04 23:33:41 +01:00
parent 6e011a0658
commit 3643ea114e
3 changed files with 22 additions and 9 deletions

View File

@ -1,6 +1,6 @@
---
{%- from "java/map.jinja" import java with context %}
java_directory:
java-directory:
file.directory:
- name: {{ java.install_dir }}
- user: root
@ -8,7 +8,7 @@ java_directory:
- dir_mode: 755
- file_mode: 644
java_extract:
java-extract:
archive.extracted:
- name: {{ java.install_dir }}
- source: {{ java.fetch_url }}/jdk-{{ java.version }}_{{ java.os }}-{{ java.arch }}_bin.tar.gz
@ -17,23 +17,29 @@ java_extract:
- skip_verify: true
- if_missing: {{ java.install_dir }}/jdk-{{ java.version }}
java_link:
java-link:
file.symlink:
- name: {{ java.install_dir }}/default
- target: {{ java.install_dir }}/jdk-{{ java.version }}
- force: true
- user: root
- group: root
- require:
- archive: java-extract
java_updatealternatives_script:
java-update-alternatives-script:
file.managed:
- name: {{ java.install_dir }}/default/update-alternatives-java.sh
- source: salt://java/update-alternatives-java.sh.j2
- source: salt://java/templates/update-alternatives-java.sh.j2
- template: jinja
- user: root
- group: root
- mode: 755
- require:
- archive: java-extract
java_default:
java-default:
cmd.run:
- name: {{ java.install_dir }}/default/update-alternatives-java.sh
- require:
- archive: java-extract

View File

@ -8,6 +8,9 @@ x86_64:
arm64:
arch: aarch64
armhf:
arch: armhf
# 386:
# arch: 386
@ -16,6 +19,3 @@ arm64:
# armv7l:
# arch: arm
# armhf:
# arch: arm

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
{%- from "java/map.jinja" import java with context %}
for item in $(ls {{ java.install_dir }}/default/bin)
do
update-alternatives --install /usr/bin/${item} ${item} {{ java.install_dir }}/default/bin/${item} 1
update-alternatives --set ${item} {{ java.install_dir }}/default/bin/${item}
done