created script for adding firefox addons
This commit is contained in:
parent
afbb5ccfd1
commit
30e0f7d5f5
13
salt/states/files/install_firefox_addon
Executable file
13
salt/states/files/install_firefox_addon
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -aeo pipefail
|
||||
filename="$1"
|
||||
url="$2"
|
||||
tmpfile=$(mktemp /tmp/install_firefox_addon.XXXXXX)
|
||||
|
||||
|
||||
|
||||
curl -sLo "$tmpfile" "$url"
|
||||
for p in "$(sed -n 's/^Path=\(.*\)$/\1/p' $HOME/.mozilla/firefox/profiles.ini)";do
|
||||
cp "$tmpfile" "$HOME/.mozilla/firefox/$p/$filename"
|
||||
done
|
||||
rm "$tmpfile"
|
@ -1,7 +1,15 @@
|
||||
copy the install addon script:
|
||||
file.managed:
|
||||
- name: {{ salt['user.info']( pillar['username'] ).home }}/bin/install_firefox_addon
|
||||
- source: salt://files/install_firefox_addon
|
||||
- user: {{ pillar['username'] }}
|
||||
- group: users
|
||||
- mode: "0755"
|
||||
|
||||
{% for name, args in pillar['firefox']['addons'].items() %}
|
||||
Downloading {{ name }} Firefox xpi:
|
||||
cmd.run:
|
||||
- name: curl -sLo {{ salt['user.info']( pillar['username'] ).home }}/.mozilla/firefox/$(sed -n 's/^Path=\(.*\)$/\1/p' {{ salt['user.info']( pillar['username'] ).home }}/.mozilla/firefox/profiles.ini)/{{ args['name'] }} {{ args['url'] }}
|
||||
- name: {{ salt['user.info']( pillar['username'] ).home }}/bin/install_firefox_addon {{ args['name'] }} {{ args['url'] }}
|
||||
- unless: grep -oP '(?<=\},\"name\":\"){{ name }}' {{ salt['user.info']( pillar['username'] ).home }}/.mozilla/firefox/*.default*/addons.json
|
||||
- user: {{ pillar['username'] }}
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user