dotfiles/salt/states/files/install_firefox_addon
Jonas Forsberg abe597c302
fixed url
2020-08-03 10:24:15 +02:00

18 lines
506 B
Bash
Executable File

#!/bin/bash
set -aeo pipefail
filename="$1"
url="$2"
tmpfile=$(mktemp /tmp/install_firefox_addon.XXXXXX.xpi)
{% 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" {{ args['url'] }}
firefox "$tmpfile"
fi
{% endfor %}
rm "$tmpfile"