diff options
| author | Joe Carstairs <me@joeac.net> | 2026-08-26 14:30:09 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2026-08-26 14:30:09 +0100 |
| commit | 78a578a86f7d8ca1a2cc267f88600f5f9a4d9543 (patch) | |
| tree | 5257e88cdc2bd76cc42d2d62b94cce345b8e4222 /roles | |
| parent | 53a13b0ad2165cb4bec9c9c20829bd4d5b03bb74 (diff) | |
mox is self-updating
Diffstat (limited to 'roles')
| -rw-r--r-- | roles/mox/tasks/main.yml | 14 | ||||
| -rw-r--r-- | roles/mox/templates/update_mox | 13 |
2 files changed, 26 insertions, 1 deletions
diff --git a/roles/mox/tasks/main.yml b/roles/mox/tasks/main.yml index 2e41a4c..ac4a43c 100644 --- a/roles/mox/tasks/main.yml +++ b/roles/mox/tasks/main.yml @@ -105,7 +105,7 @@ ansible.builtin.get_url: dest: /usr/bin/mox mode: "755" - url: "{{ mox_url }}" + url: https://beta.gobuilds.org/github.com/mjl-/mox@latest/linux-{{ mox_platform }}-latest/dl - name: Install mox service register: mox_service @@ -153,3 +153,15 @@ cmd: mox setaccountpassword {{ item.name }} stdin: "{{ item.password }}" chdir: ~mox + +- name: Install script to update mox + ansible.builtin.template: + src: update_mox + dest: /usr/bin/update_mox + mode: "755" + +- name: Install daily crontab to update mox + ansible.builtin.cron: + special_time: daily + name: Update mox + job: /usr/bin/update_mox diff --git a/roles/mox/templates/update_mox b/roles/mox/templates/update_mox new file mode 100644 index 0000000..9300b68 --- /dev/null +++ b/roles/mox/templates/update_mox @@ -0,0 +1,13 @@ +#!/bin/sh + +mox_url="https://beta.gobuilds.org/github.com/mjl-/mox@latest/linux-{{ mox_platform }}-latest" +current_version="$(mox version | grep -Eo ^v[0-9.]\+)" +latest_version="$(curl ${mox_url}/ --show-headers --silent | grep ^location: | grep -Eo /mox@v[0-9.]\+/ | grep -Eo v[0-9.]\+)" +if [ -z "$current_version" ] || [ "$current_version" != "$latest_version" ] +then + wget -O ~/mox ${mox_url}/dl + chmod 755 ~/mox + rc-service mox stop + mv ~/mox /usr/bin/mox + rc-service mox restart +fi |
