Skip to content

Commit f58f917

Browse files
committed
fix
Signed-off-by: sykwer <sykwer@gmail.com>
1 parent 1508ef3 commit f58f917

3 files changed

Lines changed: 43 additions & 19 deletions

File tree

ansible/roles/agnocast/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@ None.
99
## Manual Installation
1010

1111
```bash
12-
sudo add-apt-repository ppa:t4-system-software/agnocast
12+
agnocast_version="1.0.1"
13+
14+
sudo add-apt-repository -y ppa:t4-system-software/agnocast
1315
sudo apt update
14-
sudo apt install "agnocast-heaphook=1.0.1*" "agnocast-kmod=1.0.1*"
15-
```
16+
sudo apt install -y "agnocast-heaphook=${agnocast_version}*"
17+
18+
if dkms status | grep agnocast | grep -q "${agnocast_version}"; then
19+
echo "agnocast-kmod version ${agnocast_version} is already registered in dkms. Skipping purge and install."
20+
else
21+
sudo apt purge -y "agnocast-kmod=${agnocast_version}*"
22+
sudo apt install -y "agnocast-kmod=${agnocast_version}*"
23+
fi
24+
25+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
agnocast_version: "1.0.1"
Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
- name: Add agnocast PPA repository
2-
apt_repository:
3-
repo: "ppa:t4-system-software/agnocast"
2+
ansible.builtin.apt_repository:
3+
repo: ppa:t4-system-software/agnocast
44
state: present
5-
become: yes
5+
become: true
66

77
- name: Update apt cache
8-
apt:
9-
update_cache: yes
10-
become: yes
8+
ansible.builtin.apt:
9+
update_cache: true
10+
become: true
1111

12-
- name: Remove existing agnocast DKMS module
13-
shell: dkms remove -m agnocast -v 1.0.1 --all --force
14-
ignore_errors: yes
15-
become: yes
12+
- name: Install agnocast-heaphook v{{ agnocast_version }}
13+
ansible.builtin.apt:
14+
name: "agnocast-heaphook={{ agnocast_version }}*"
15+
state: present
16+
become: true
17+
18+
- name: Check if agnocast-kmod v{{ agnocast_version }} is installed in dkms
19+
ansible.builtin.shell: "dkms status | grep agnocast | grep {{ agnocast_version }}"
20+
register: dkms_status
21+
failed_when: false
22+
become: true
23+
24+
- name: Purge agnocast-kmod if v{{ agnocast_version }} not found in dkms
25+
ansible.builtin.apt:
26+
name: "agnocast-kmod={{ agnocast_version }}*"
27+
state: absent
28+
become: true
29+
when: dkms_status.rc != 0
1630

17-
- name: Install agnocast packages with specific version
18-
apt:
19-
name:
20-
- "agnocast-heaphook=1.0.1*"
21-
- "agnocast-kmod=1.0.1*"
31+
- name: Install agnocast-kmod if v{{ agnocast_version }} not found in dkms
32+
ansible.builtin.apt:
33+
name: "agnocast-kmod={{ agnocast_version }}*"
2234
state: present
23-
become: yes
35+
become: true
36+
when: dkms_status.rc != 0

0 commit comments

Comments
 (0)