build and use debian packages

This commit is contained in:
erebion 2024-07-20 02:39:08 +02:00
parent 75fb8b4299
commit cc69607f53

View file

@ -10,6 +10,7 @@
url: "https://gitlab.com/sdm670-mainline/alsa-ucm-conf/-/archive/master/alsa-ucm-conf-master.tar.gz" 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 dest: /root/alsa-ucm-conf-master.tar.gz
mode: '0440' mode: '0440'
retries: 20
- name: "Remove alsa ucm configs" - name: "Remove alsa ucm configs"
ansible.builtin.file: ansible.builtin.file:
@ -25,9 +26,28 @@
args: args:
chdir: /usr/share/alsa 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 ### ### Call Audio ###
- name: "Install gcc, git, libdbus-1-dev, libdbus-cpp-dev and make" - name: "Install dependencies"
ansible.builtin.apt: ansible.builtin.apt:
pkg: pkg:
- gcc - gcc
@ -35,67 +55,55 @@
- libdbus-1-dev - libdbus-1-dev
- libdbus-cpp-dev - libdbus-cpp-dev
- make - make
- devscripts
- doxygen
state: present state: present
update_cache: true 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" - name: "Clone tinyalsa repo"
ansible.builtin.git: ansible.builtin.git:
repo: 'https://github.com/tinyalsa/tinyalsa.git' repo: 'https://salsa.debian.org/erebion/tinyalsa.git'
dest: /opt/tinyalsa dest: /opt/repos/tinyalsa
version: master version: mobian-git20240129
retries: 20
- 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" - name: "Clone q6voiced repo"
ansible.builtin.git: ansible.builtin.git:
repo: 'https://gitlab.com/postmarketOS/q6voiced' repo: 'https://salsa.debian.org/erebion/q6voiced.git'
dest: /opt/q6voiced dest: /opt/repos/q6voiced
version: master 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: ansible.builtin.shell:
cmd: "gcc $(pkg-config --cflags dbus-1) q6voiced.c -o q6voiced -ltinyalsa -ldbus-1 -ldl" cmd: debuild -i -us -uc -b
args: chdir: "{{ item }}"
chdir: /opt/q6voiced become_user: nobody
creates: /opt/q6voiced/q6voiced loop:
- "/opt/repos/tinyalsa/"
- "/opt/repos/q6voiced/"
- name: "Create /etc/q6voiced.conf" - name: "Install tinyalsa and q6voiced"
ansible.builtin.copy: ansible.builtin.apt:
src: q6voiced.conf deb: "/opt/repos/{{ item }}"
dest: /etc/q6voiced.conf loop:
owner: root - "libtinyalsa_2.0.0+git20240621-7f06b2f-1_arm64.deb"
group: root - "tinyalsa_2.0.0+git20240621-7f06b2f-1_arm64.deb"
mode: u+rwx - "q6voiced_0~0+git20240607-75ae4079-1_arm64.deb"
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"