moved firefox addon to interactive script
This commit is contained in:
parent
6540462723
commit
5b063c09c1
@ -93,6 +93,17 @@ function do_salt_call(){
|
||||
$salt state.apply pillar="{username: $USER}"
|
||||
}
|
||||
|
||||
function firefox_addons(){
|
||||
new_log "Installing firefox addons"
|
||||
if [[ ! -f "$HOME/bin/install_firefox_addon" ]];then
|
||||
printf "install firefox addon script not found, run dotfile sync first"
|
||||
fi
|
||||
if asktobreak;then
|
||||
return
|
||||
fi
|
||||
exec $HOME/bin/install_firefox_addon
|
||||
}
|
||||
|
||||
setup_dotfiles
|
||||
do_salt_call
|
||||
gnome_key_bindings
|
||||
|
@ -2,15 +2,16 @@
|
||||
set -aeo pipefail
|
||||
filename="$1"
|
||||
url="$2"
|
||||
tmpfile=$(mktemp /tmp/install_firefox_addon.XXXXXX)
|
||||
tmpfile=$(mktemp /tmp/install_firefox_addon.XXXXXX.xpi)
|
||||
|
||||
readarray -t profiles <<<"$(sed -n 's/^Path=\(.*\)$/\1/p' $HOME/.mozilla/firefox/profiles.ini)"
|
||||
{% 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 %}
|
||||
|
||||
|
||||
|
||||
curl -sLo "$tmpfile" "$url"
|
||||
for p in $(sed -n 's/^Path=\(.*\)$/\1/p' $HOME/.mozilla/firefox/profiles.ini);do
|
||||
echo "Installing in profile $p"
|
||||
cp "$tmpfile" "$HOME/.mozilla/firefox/$p/extensions/$filename"
|
||||
done
|
||||
rm "$tmpfile"
|
||||
|
@ -2,14 +2,7 @@ copy the install addon script:
|
||||
file.managed:
|
||||
- name: {{ salt['user.info']( pillar['username'] ).home }}/bin/install_firefox_addon
|
||||
- source: salt://files/install_firefox_addon
|
||||
- template: jinja
|
||||
- user: {{ pillar['username'] }}
|
||||
- group: users
|
||||
- mode: "0755"
|
||||
|
||||
{% for name, args in pillar['firefox']['addons'].items() %}
|
||||
Downloading {{ name }} Firefox xpi:
|
||||
cmd.run:
|
||||
- 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
|
||||
- runas: {{ pillar['username'] }}
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user