mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-16 17:50:27 +00:00
Merge pull request #200 from noelmcloughlin/master
Fix MacOS desktop shortcuts
This commit is contained in:
commit
091584f1a6
3 changed files with 12 additions and 8 deletions
|
@ -1,10 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CMD='/usr/bin/osascript -e'
|
||||
if [[ -f "{{ home }}/{{ user }}/Desktop/{{ app }}" ]] && [[ "${1}" -eq "remove" ]]
|
||||
|
||||
if [[ -e "{{ home }}/{{ user }}/Desktop/{{ app }}" ]] && [[ "${1}" -eq "remove" ]]
|
||||
then
|
||||
${CMD} "tell application \"Finder\" to delete file \"{{home}}/{{user}}/Desktop/{{ app }}\""
|
||||
elif [[ -d "{{ dir }}/{{ app }}" ]] && [[ "${1}" -eq "add" ]]
|
||||
$CMD "tell application \"Finder\" to delete POSIX file \"{{home}}/{{user}}/Desktop/{{ app }}\""
|
||||
elif [[ -e "{{ dir }}/{{ app ~ '.app' if suffix else app }}" ]] && [[ "${1}" -eq "add" ]]
|
||||
then
|
||||
${CMD} "tell application \"Finder\" to make new Alias at (path to desktop folder) to POSIX file \"{{ dir }}/{{ app }}\""
|
||||
$CMD "tell application \"Finder\" to delete POSIX file \"{{home}}/{{user}}/Desktop/{{ app }}\"" >/dev/null 2>&1
|
||||
$CMD "tell application \"Finder\" to make new Alias at (path to desktop folder) to POSIX file \"{{ dir }}/{{ app }}{{ suffix or '' }}\""
|
||||
fi
|
||||
|
|
|
@ -90,8 +90,9 @@ mysql-macos-{{ product }}-desktop-shortcut-add:
|
|||
- context:
|
||||
user: {{ mysql.macos.user }}
|
||||
home: {{ mysql.macos.userhomes }}
|
||||
dir: {{'/Applications/' ~ data.app ~ '.app' if "isapp" in data and data.isapp else dl.prefix ~ '/' ~ archivename ~ '/bin'}}
|
||||
app: {{ data.app }}
|
||||
dir: {{ '/Applications' if "isapp" in data and data.isapp else dl.prefix ~ '/' ~ archivename ~ '/bin' }}
|
||||
suffix: {{ '.app' if "isapp" in data and data.isapp else '' }}
|
||||
cmd.run:
|
||||
- name: /tmp/mac_shortcut.sh add
|
||||
- runas: {{ mysql.macos.user }}
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
{%- from salt.file.dirname(tpldir) ~ "/map.jinja" import mysql with context -%}
|
||||
|
||||
{%- set dl = mysql.macos.dl %}
|
||||
{%- for product, data in mysql.macos.products.items() if "enabled" in data and data.enabled %}
|
||||
{%- for product, data in mysql.macos.products.items() if "app" in data and data.app and "url" in data and data.url %}
|
||||
{%- set archivename = data.url.split('/')[-1]|replace('.dmg', '')|replace('.tar.gz', '')|replace('.zip', '') %}
|
||||
|
||||
mysql-macos-{{ product }}-remove-destdir:
|
||||
file.absent:
|
||||
- names:
|
||||
- {{ data.path }}
|
||||
- {{ '/Applications' ~ data.app ~ '.app' if "isapp" in data and data.isapp else dl.prefix ~ '/' ~ archivename }}
|
||||
|
||||
mysql-macos-{{ product }}-desktop-shortcut-remove:
|
||||
file.managed:
|
||||
|
@ -21,8 +21,9 @@ mysql-macos-{{ product }}-desktop-shortcut-remove:
|
|||
- context:
|
||||
user: {{ mysql.macos.user }}
|
||||
home: {{ mysql.macos.userhomes }}
|
||||
dir: {{'/Applications/' ~ data.app ~ '.app' if "isapp" in data and data.isapp else dl.prefix ~ '/' ~ archivename ~ '/bin'}}
|
||||
app: {{ data.app }}
|
||||
dir: {{ '/Applications' if "isapp" in data and data.isapp else dl.prefix ~ '/' ~ archivename ~ '/bin' }}
|
||||
suffix: {{ '.app' if "isapp" in data and data.isapp else '' }}
|
||||
cmd.run:
|
||||
- name: /tmp/mac_shortcut.sh remove
|
||||
- runas: {{ mysql.macos.user }}
|
||||
|
|
Loading…
Add table
Reference in a new issue