diff --git a/ansible/audio.yml b/ansible/audio.yml index 5e8e44b..10cde6a 100644 --- a/ansible/audio.yml +++ b/ansible/audio.yml @@ -10,6 +10,7 @@ url: "https://gitlab.com/sdm670-mainline/alsa-ucm-conf/-/archive/master/alsa-ucm-conf-master.tar.gz" dest: /root/alsa-ucm-conf-master.tar.gz mode: '0440' + retries: 20 - name: "Remove alsa ucm configs" ansible.builtin.file: @@ -25,9 +26,28 @@ args: chdir: /usr/share/alsa + ### Remove Remnants Of Previous Playbook Versions ### + + - name: "Deactivate systemd unit if it exists, ignore errors if it does not" + ansible.builtin.systemd_service: + name: q6voiced-temp.service + state: stopped + enabled: false + masked: true + ignore_errors: true + + - name: "Remove remnants of previous versions of this playbook" + ansible.builtin.file: + path: "{{ item }}" + state: absent + loop: + - "/opt/tinyalsa" + - "/opt/q6voiced" + - "/etc/systemd/system/q6voiced-temp.service" + ### Call Audio ### - - name: "Install gcc, git, libdbus-1-dev, libdbus-cpp-dev and make" + - name: "Install dependencies" ansible.builtin.apt: pkg: - gcc @@ -35,67 +55,55 @@ - libdbus-1-dev - libdbus-cpp-dev - make + - devscripts + - doxygen state: present update_cache: true + - name: "Create directory for the repos (first delete it to make it empty)" + ansible.builtin.file: + path: "/opt/repos/" + state: "{{ item }}" + owner: nobody + group: nogroup + loop: + - "absent" + - "directory" + - name: "Clone tinyalsa repo" ansible.builtin.git: - repo: 'https://github.com/tinyalsa/tinyalsa.git' - dest: /opt/tinyalsa - version: master - - - name: "Compile tinyalsa" - community.general.make: - chdir: /opt/tinyalsa - - - name: "Install tinyalsa" - community.general.make: - chdir: /opt/tinyalsa - target: install - - - name: "Run ldconfig" - ansible.builtin.command: /sbin/ldconfig - args: - chdir: /opt/tinyalsa + repo: 'https://salsa.debian.org/erebion/tinyalsa.git' + dest: /opt/repos/tinyalsa + version: mobian-git20240129 + retries: 20 - name: "Clone q6voiced repo" ansible.builtin.git: - repo: 'https://gitlab.com/postmarketOS/q6voiced' - dest: /opt/q6voiced - version: master + repo: 'https://salsa.debian.org/erebion/q6voiced.git' + dest: /opt/repos/q6voiced + version: mobian-git20240607 + retries: 20 - - name: "Compile q6voiced" + - name: "chown repo directories to nobody:nogroup" + ansible.builtin.file: + path: "/opt/repos/" + recurse: true + owner: nobody + group: nogroup + + - name: "Build Debian packages for tinyalsa and q6voiced" ansible.builtin.shell: - cmd: "gcc $(pkg-config --cflags dbus-1) q6voiced.c -o q6voiced -ltinyalsa -ldbus-1 -ldl" - args: - chdir: /opt/q6voiced - creates: /opt/q6voiced/q6voiced + cmd: debuild -i -us -uc -b + chdir: "{{ item }}" + become_user: nobody + loop: + - "/opt/repos/tinyalsa/" + - "/opt/repos/q6voiced/" - - name: "Create /etc/q6voiced.conf" - ansible.builtin.copy: - src: q6voiced.conf - dest: /etc/q6voiced.conf - owner: root - group: root - mode: u+rwx - force: false - - - name: "Create q6voiced-temp.service" - ansible.builtin.copy: - src: q6voiced-temp.service - dest: /etc/systemd/system/q6voiced-temp.service - owner: root - group: root - mode: u+rwx - force: true - register: unit - - - name: Reload systemd units - ansible.builtin.systemd: - daemon_reload: yes - when: unit.changed - - - name: "Enable custom service unit for q6voiced" - ansible.builtin.service: - enabled: true - name: "q6voiced-temp.service" + - name: "Install tinyalsa and q6voiced" + ansible.builtin.apt: + deb: "/opt/repos/{{ item }}" + loop: + - "libtinyalsa_2.0.0+git20240621-7f06b2f-1_arm64.deb" + - "tinyalsa_2.0.0+git20240621-7f06b2f-1_arm64.deb" + - "q6voiced_0~0+git20240607-75ae4079-1_arm64.deb"