2020-08-02 16:08:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -aeo pipefail
|
|
|
|
filename="$1"
|
|
|
|
url="$2"
|
2020-08-03 08:19:23 +00:00
|
|
|
tmpfile=$(mktemp /tmp/install_firefox_addon.XXXXXX.xpi)
|
2020-08-02 16:08:29 +00:00
|
|
|
|
2020-08-03 08:19:23 +00:00
|
|
|
{% for name, args in pillar['firefox']['addons'].items() %}
|
|
|
|
if [[ $(grep -oP '(?<=\},\"name\":\"){{ name }}' {{ salt['user.info']( pillar['username'] ).home }}/.mozilla/firefox/*.default*/addons.json) ]]; then
|
|
|
|
printf "{{ name }} is already installed\n"
|
|
|
|
else
|
|
|
|
printf "installing {{ name }}\n"
|
|
|
|
curl -sLo "$tmpfile" "$url"
|
|
|
|
firefox "$tmpfile"
|
|
|
|
fi
|
|
|
|
{% endfor %}
|
2020-08-02 16:36:13 +00:00
|
|
|
|
2020-08-02 16:08:29 +00:00
|
|
|
rm "$tmpfile"
|