Use Discord canary deb instead of Flatpak
This commit is contained in:
parent
8a0df461bb
commit
e6fa30e155
|
@ -37,7 +37,7 @@ workspaces:
|
||||||
monitor: "Acer Technologies KG271U TATEE0048524"
|
monitor: "Acer Technologies KG271U TATEE0048524"
|
||||||
default: true
|
default: true
|
||||||
layoutopt_orientation: "top"
|
layoutopt_orientation: "top"
|
||||||
on_created_empty: "flatpak run com.discordapp.Discord & keepassxc"
|
on_created_empty: "~/.local/bin/update-discord && discord-canary & keepassxc"
|
||||||
- id: 9
|
- id: 9
|
||||||
monitor: "LG Electronics LG ULTRAGEAR 311NTVS8J911"
|
monitor: "LG Electronics LG ULTRAGEAR 311NTVS8J911"
|
||||||
|
|
||||||
|
|
2
main.yml
2
main.yml
|
@ -10,4 +10,4 @@
|
||||||
#- vs-code
|
#- vs-code
|
||||||
#- qemu-kvm
|
#- qemu-kvm
|
||||||
#- docker
|
#- docker
|
||||||
#- discord
|
#- discord-canary
|
||||||
|
|
28
roles/discord-canary/files/update-discord
Executable file
28
roles/discord-canary/files/update-discord
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}")
|
||||||
|
CACHE_FILE_PATH="$SCRIPT_PATH/.discord_version_cache"
|
||||||
|
|
||||||
|
CURRENT_VERSION=$(curl -s "https://discord.com/api/updates/canary?platform=linux" | jq -r .name)
|
||||||
|
INSTALLED_VERSION=""
|
||||||
|
|
||||||
|
if test -f "$CACHE_FILE_PATH"; then
|
||||||
|
INSTALLED_VERSION=$(head -n 1 "$CACHE_FILE_PATH")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$CURRENT_VERSION" != "$INSTALLED_VERSION" ]; then
|
||||||
|
echo "New version $CURRENT_VERSION found. Downloading..."
|
||||||
|
curl -Ls -o /tmp/discord-canary.deb "https://discord.com/api/download/canary?platform=linux&format=deb"
|
||||||
|
if [ ${1-default} != "--download-only" ]; then
|
||||||
|
pkexec apt install -y /tmp/discord-canary.deb
|
||||||
|
rm /tmp/discord-canary.deb
|
||||||
|
fi
|
||||||
|
echo $CURRENT_VERSION > $CACHE_FILE_PATH
|
||||||
|
else
|
||||||
|
echo "Current version is already installed."
|
||||||
|
if [ ${1-default} == "--download-only" ]; then
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
36
roles/discord-canary/tasks/main.yml
Normal file
36
roles/discord-canary/tasks/main.yml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
- name: Install pkexec
|
||||||
|
become: yes
|
||||||
|
apt:
|
||||||
|
state: latest
|
||||||
|
install_recommends: false
|
||||||
|
name: pkexec
|
||||||
|
|
||||||
|
- name: Copy update helper
|
||||||
|
copy:
|
||||||
|
src: "{{ role_path }}/files/update-discord"
|
||||||
|
dest: "{{ ansible_env.HOME }}/.local/bin/"
|
||||||
|
|
||||||
|
- name: Make update helper executable
|
||||||
|
ansible.builtin.file:
|
||||||
|
dest: "{{ ansible_env.HOME }}/.local/bin/update-discord"
|
||||||
|
mode: "ug+x"
|
||||||
|
|
||||||
|
- name: Download Discord canary using helper
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: "update-discord --download-only"
|
||||||
|
chdir: "{{ ansible_env.HOME }}/.local/bin"
|
||||||
|
register: helper_result
|
||||||
|
failed_when: ( helper_result.rc not in [ 0, 2 ] )
|
||||||
|
|
||||||
|
- name: Install Discord canary
|
||||||
|
become: yes
|
||||||
|
apt:
|
||||||
|
deb: /tmp/discord-canary.deb
|
||||||
|
install_recommends: false
|
||||||
|
when: helper_result.rc != 2
|
||||||
|
|
||||||
|
- name: Remove installation package
|
||||||
|
ansible.builtin.file:
|
||||||
|
state: absent
|
||||||
|
path: /tmp/discord-canary.deb
|
||||||
|
when: helper_result.rc != 2
|
|
@ -1,5 +0,0 @@
|
||||||
- name: Install Discord
|
|
||||||
community.general.flatpak:
|
|
||||||
name: "com.discordapp.Discord"
|
|
||||||
state: present
|
|
||||||
method: user
|
|
Loading…
Reference in a new issue