Run flatpak with exported variables

https://github.com/flatpak/flatpak/issues/3847#issuecomment-818532856
This commit is contained in:
2021-12-18 15:40:39 +01:00
parent d221cc07cc
commit 735fecc221
5 changed files with 16 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
--- ---
flatpak_configure_remotes: true flatpak_configure_remotes: true
flatpak_alter_flatpaks: true flatpak_alter_flatpaks: true
flatpak_automatic_updates: false flatpak_automatic_updates: true

View File

@@ -1,8 +0,0 @@
[Unit]
Description=flatpak Automatic Update
Documentation=man:flatpak(1)
[Service]
Type=simple
ExecStartPre=/bin/sh -c 'until ping -c1 google.com; do sleep 5; done;'
ExecStart=/usr/bin/flatpak update -y

View File

@@ -7,17 +7,18 @@
ansible.builtin.include: flatpaks.yml ansible.builtin.include: flatpaks.yml
when: flatpak_alter_flatpaks | bool when: flatpak_alter_flatpaks | bool
# https://github.com/flatpak/flatpak/issues/3847#issuecomment-818532856
- name: Enable flatpak Automatic Update - name: Enable flatpak Automatic Update
ansible.builtin.copy: ansible.builtin.template:
src: "{{ item }}" src: "{{ item }}"
dest: "/etc/systemd/system/{{ item }}" dest: "/etc/systemd/system/{{ item | regex_replace('.j2', '') }}"
owner: root owner: root
group: root group: root
mode: '0644' mode: '0644'
become: yes become: yes
with_items: with_items:
- flatpak-automatic.service - flatpak-automatic.service.j2
- flatpak-automatic.timer - flatpak-automatic.timer.j2
notify: notify:
- Enable flatpak-automatic - Enable flatpak-automatic
when: flatpak_automatic_updates | bool when: flatpak_automatic_updates | bool

View File

@@ -0,0 +1,10 @@
[Unit]
Description=flatpak Automatic Update
Documentation=man:flatpak(1)
[Service]
Environment='DISPLAY={{ ansible_facts["env"]["DISPLAY"] }}'
Environment='DBUS_SESSION_BUS_ADDRESS={{ ansible_facts["env"]["DBUS_SESSION_BUS_ADDRESS"] }}'
Type=simple
ExecStartPre=nm-online
ExecStart=/usr/bin/flatpak update -y