diff --git a/ansible/audio.yml b/ansible/audio.yml index 10cde6a..5e8e44b 100644 --- a/ansible/audio.yml +++ b/ansible/audio.yml @@ -10,7 +10,6 @@ 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: @@ -26,28 +25,9 @@ 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 dependencies" + - name: "Install gcc, git, libdbus-1-dev, libdbus-cpp-dev and make" ansible.builtin.apt: pkg: - gcc @@ -55,55 +35,67 @@ - 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://salsa.debian.org/erebion/tinyalsa.git' - dest: /opt/repos/tinyalsa - version: mobian-git20240129 - retries: 20 + 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 - name: "Clone q6voiced repo" ansible.builtin.git: - repo: 'https://salsa.debian.org/erebion/q6voiced.git' - dest: /opt/repos/q6voiced - version: mobian-git20240607 - retries: 20 + repo: 'https://gitlab.com/postmarketOS/q6voiced' + dest: /opt/q6voiced + version: master - - 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" + - name: "Compile q6voiced" ansible.builtin.shell: - cmd: debuild -i -us -uc -b - chdir: "{{ item }}" - become_user: nobody - loop: - - "/opt/repos/tinyalsa/" - - "/opt/repos/q6voiced/" + cmd: "gcc $(pkg-config --cflags dbus-1) q6voiced.c -o q6voiced -ltinyalsa -ldbus-1 -ldl" + args: + chdir: /opt/q6voiced + creates: /opt/q6voiced/q6voiced - - 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" + - 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" diff --git a/ansible/files/bluetooth-mac.bash b/ansible/files/bluetooth-mac.bash index f19dd8a..7661542 100644 --- a/ansible/files/bluetooth-mac.bash +++ b/ansible/files/bluetooth-mac.bash @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -x rfkill unblock bluetooth -echo $"stdin for btmgmt" | btmgmt -i hci0 public-addr $(hciconfig hci0 | grep -o $"[[:xdigit:]:]\\{11,17\\}") +echo $"stdin for btmgmt" | btmgmt -i hci0 public-addr $(hciconfig hci0 | grep -o $"[[:xdigit:]:]\\{11,17\\}")' # btmgmt requires stdin, so we feed it some garbage...