From 757959fc78dc997f02c4682ebb51ac3219772fd2 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 2 Oct 2021 12:46:10 +0200 Subject: [PATCH] updated androidstudio state --- states/androidstudio/defaults.yaml | 2 ++ states/androidstudio/init.sls | 25 ++----------------------- states/androidstudio/install.sls | 30 ++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 23 deletions(-) create mode 100644 states/androidstudio/install.sls diff --git a/states/androidstudio/defaults.yaml b/states/androidstudio/defaults.yaml index ee37d6a..e10663c 100644 --- a/states/androidstudio/defaults.yaml +++ b/states/androidstudio/defaults.yaml @@ -1,5 +1,7 @@ --- androidstudio: + # https://developer.android.com/studio/archive.html enabled: true install_dir: /usr/local/apps + release_dir: /usr/local/apps/releases config: {} diff --git a/states/androidstudio/init.sls b/states/androidstudio/init.sls index 88598af..e39dc86 100644 --- a/states/androidstudio/init.sls +++ b/states/androidstudio/init.sls @@ -1,24 +1,3 @@ --- -# https://developer.android.com/studio/archive.html -{%- from "androidstudio/map.jinja" import androidstudio with context %} - -{%- if salt['file.grep'](androidstudio.install_dir + '/android-studio/build.txt', androidstudio.version_regex)['retcode'] == 1 or not salt['file.file_exists'](androidstudio.install_dir + '/android-studio/build.txt') %} -androidstudio-archive-extract: - archive.extracted: - - name: {{ androidstudio.install_dir }} - - source: {{ androidstudio.mirror }}/{{ androidstudio.version }}/android-studio-ide-{{ androidstudio.tag }}-linux.tar.gz - - skip_verify: true - - archive_format: tar - - overwrite: true - -androidstudio-shortcut: - file.managed: - - name: /usr/share/applications/jetbrains-studio.desktop - - source: salt://androidstudio/jetbrains-studio.desktop.j2 - - user: root - - group: root - - mode: 644 - - template: jinja - - onchanges: - - androidstudio-archive-extract -{%- endif %} \ No newline at end of file +include: + - .install diff --git a/states/androidstudio/install.sls b/states/androidstudio/install.sls new file mode 100644 index 0000000..3c2768f --- /dev/null +++ b/states/androidstudio/install.sls @@ -0,0 +1,30 @@ +--- +{%- from "androidstudio/map.jinja" import androidstudio with context %} +androidstudio-archive-extract: + archive.extracted: + - name: {{ androidstudio.install_dir }} + - source: {{ androidstudio.mirror }}/{{ androidstudio.version }}/android-studio-ide-{{ androidstudio.tag }}-linux.tar.gz + - skip_verify: true + - archive_format: tar + - overwrite: true + - if_missing: {{ androidstudio.release_dir }}/androidstudio-{{ androidstudio.version }} + - watch: + - file: androidstudio-link + - file: androidstudio-shortcut + +androidstudio-link: + file.symlink: + - name: {{ androidstudio.install_dir }}/androidstudio + - target: {{ androidstudio.release_dir }}/androidstudio-{{ androidstudio.version }} + - force: true + +androidstudio-shortcut: + file.managed: + - name: /usr/share/applications/jetbrains-studio.desktop + - source: salt://androidstudio/jetbrains-studio.desktop.j2 + - user: root + - group: root + - mode: 644 + - template: jinja + - onchanges: + - androidstudio-archive-extract