From 3643ea114e09eb90a2e7e28cacf838ea34dff3df Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Wed, 4 Jan 2023 23:33:41 +0100 Subject: [PATCH] updated java state --- states/java/install.sls | 18 ++++++++++++------ states/java/osarchmap.yaml | 6 +++--- .../templates/update-alternatives-java.sh.j2 | 7 +++++++ 3 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 states/java/templates/update-alternatives-java.sh.j2 diff --git a/states/java/install.sls b/states/java/install.sls index ae33184..cf8b446 100644 --- a/states/java/install.sls +++ b/states/java/install.sls @@ -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 diff --git a/states/java/osarchmap.yaml b/states/java/osarchmap.yaml index e75c7fe..a20d7b9 100644 --- a/states/java/osarchmap.yaml +++ b/states/java/osarchmap.yaml @@ -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 diff --git a/states/java/templates/update-alternatives-java.sh.j2 b/states/java/templates/update-alternatives-java.sh.j2 new file mode 100644 index 0000000..6f0e72f --- /dev/null +++ b/states/java/templates/update-alternatives-java.sh.j2 @@ -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