diff --git a/states/arduino/defaults.yaml b/states/arduino/defaults.yaml index de9672d..91185cc 100644 --- a/states/arduino/defaults.yaml +++ b/states/arduino/defaults.yaml @@ -1,4 +1,5 @@ --- arduino: - mirror: "https://downloads.arduino.cc" - install_dir: "/usr/local/apps" \ No newline at end of file + mirror: https://downloads.arduino.cc + install_dir: /usr/local/apps + release_dir: /usr/local/apps/releases \ No newline at end of file diff --git a/states/arduino/init.sls b/states/arduino/init.sls index f1e7157..10ad9a6 100644 --- a/states/arduino/init.sls +++ b/states/arduino/init.sls @@ -1,40 +1,3 @@ --- -{%- from "arduino/map.jinja" import arduino with context %} -{%- if not salt['file.directory_exists']( arduino.install_dir + '/arduino-' + arduino.version ) %} -arduino-archive-extract: - archive.extracted: - - name: {{ arduino.install_dir }} - - source: {{ arduino.mirror }}/arduino-{{ arduino.version }}-{{ arduino.arch }}.tar.xz - - skip_verify: true - - archive_format: tar - - keep: true - - if_missing: {{ arduino.install_dir }}/arduino-{{ arduino.version }} - -arduino-symlink: - file.symlink: - - name: {{ arduino.install_dir }}/arduino - - target: {{ arduino.install_dir }}/arduino-{{ arduino.version }} - - force: true - - onchanges: - - arduino-archive-extract - -arduino-bin-symlink: - file.symlink: - - name: /usr/bin/arduino - - target: {{ arduino.install_dir }}/arduino-{{ arduino.version }}/arduino - - force: true - - onchanges: - - arduino-archive-extract - -arduino-shortcut: - file.managed: - - name: /usr/share/applications/arduino-arduinoide.desktop - - source: salt://arduino/arduino-arduinoide.desktop.j2 - - template: jinja - - user: root - - group: root - - mode: 644 - - onchanges: - - arduino-archive-extract - - arduino-symlink -{%- endif %} \ No newline at end of file +include: + - .install \ No newline at end of file diff --git a/states/arduino/install.sls b/states/arduino/install.sls new file mode 100644 index 0000000..9f8561b --- /dev/null +++ b/states/arduino/install.sls @@ -0,0 +1,39 @@ +--- +{%- from "arduino/map.jinja" import arduino with context %} +arduino-archive-extract: + archive.extracted: + - name: {{ arduino.release_dir }} + - source: {{ arduino.mirror }}/arduino-{{ arduino.version }}-{{ arduino.arch }}.tar.xz + - skip_verify: true + - archive_format: tar + - keep: true + - if_missing: {{ arduino.release_dir }}/arduino-{{ arduino.version }} + +arduino-symlink: + file.symlink: + - name: {{ arduino.install_dir }}/arduino + - target: {{ arduino.release_dir }}/arduino-{{ arduino.version }} + - force: true + - onchanges: + - arduino-archive-extract + +arduino-bin-symlink: + file.symlink: + - name: /usr/bin/arduino + - target: {{ arduino.install_dir }}/arduino-{{ arduino.version }}/arduino + - force: true + - onchanges: + - arduino-archive-extract + +arduino-shortcut: + file.managed: + - name: /usr/share/applications/arduino-arduinoide.desktop + - source: salt://arduino/arduino-arduinoide.desktop.j2 + - template: jinja + - user: root + - group: root + - mode: 644 + - onchanges: + - arduino-archive-extract + - arduino-symlink + diff --git a/states/pycharm/defaults.yaml b/states/pycharm/defaults.yaml index cab726a..39d28a9 100644 --- a/states/pycharm/defaults.yaml +++ b/states/pycharm/defaults.yaml @@ -2,5 +2,6 @@ pycharm: enabled: true install_dir: /usr/local/apps + release_dir: /usr/local/apps/releases mirror: https://download.jetbrains.com/python - config: + config: {} diff --git a/states/pycharm/init.sls b/states/pycharm/init.sls index e66d5ce..10ad9a6 100644 --- a/states/pycharm/init.sls +++ b/states/pycharm/init.sls @@ -1,29 +1,3 @@ --- -{%- from "pycharm/map.jinja" import pycharm with context %} -{%- if not salt['file.directory_exists'](pycharm.install_dir + '/pycharm-community-' + pycharm.version) %} -pycharm-archive-extract: - archive.extracted: - - source: {{ pycharm.mirror }}/pycharm-community-{{ pycharm.version }}.tar.gz - - source_hash: {{ pycharm.mirror }}/pycharm-community-{{ pycharm.version }}.tar.gz.sha256 - - archive_format: tar - - name: {{ pycharm.install_dir }} - - if_missing: {{ pycharm.install_dir }}/pycharm-community-{{ pycharm.version }} - - watch: - - file: pycharm-link - - file: pycharm-shortcut -{%- endif %} - -pycharm-link: - file.symlink: - - name: {{ pycharm.install_dir }}/pycharm - - target: {{ pycharm.install_dir }}/pycharm-community-{{ pycharm.version }} - - force: true - -pycharm-shortcut: - file.managed: - - name: /usr/share/applications/jetbrains-pycharm-ce.desktop - - source: salt://pycharm/jetbrains-pycharm-ce.desktop.j2 - - template: jinja - - user: root - - group: root - - mode: 644 \ No newline at end of file +include: + - .install \ No newline at end of file diff --git a/states/pycharm/install.sls b/states/pycharm/install.sls new file mode 100644 index 0000000..39026c0 --- /dev/null +++ b/states/pycharm/install.sls @@ -0,0 +1,28 @@ +--- +{%- from "pycharm/map.jinja" import pycharm with context %} +pycharm-archive-extract: + archive.extracted: + - source: {{ pycharm.mirror }}/pycharm-community-{{ pycharm.version }}.tar.gz + - source_hash: {{ pycharm.mirror }}/pycharm-community-{{ pycharm.version }}.tar.gz.sha256 + - archive_format: tar + - name: {{ pycharm.release_dir }} + - if_missing: {{ pycharm.release_dir }}/pycharm-community-{{ pycharm.version }} + - watch: + - file: pycharm-link + - file: pycharm-shortcut + +pycharm-link: + file.symlink: + - name: {{ pycharm.install_dir }}/pycharm + - target: {{ pycharm.release_dir }}/pycharm-community-{{ pycharm.version }} + - force: true + +pycharm-shortcut: + file.managed: + - name: /usr/share/applications/jetbrains-pycharm-ce.desktop + - source: salt://pycharm/jetbrains-pycharm-ce.desktop.j2 + - template: jinja + - user: root + - group: root + - mode: 644 +