Client Signal sous Fedora

Aucune version de Signal n’est packagée officiellement pour Fedora (ou dérivés RedHat). Voici un script pour récupérer le dernier .deb et le convertir en .rpm (après quelques correctifs), pour ensuite être installé sous Fedora:

#!/bin/bash

DISTRIB=xenial

LAST_VERSION=`curl -s https://updates.signal.org/desktop/apt/dists/$DISTRIB/main/binary-amd64/Packages | grep ^Version: | grep -v beta | awk '{print $2}' | sort -V -r | head -n1`
if [ -z $LAST_VERSION ]; then
    echo "No version found"
    exit 1
fi

CURRENT_VERSION=`rpm -q --qf "%{VERSION}\n" signal-desktop`
if [ $? -ne 0 ]; then
    CURRENT_VERSION=0.0.0
fi

echo Current version: $CURRENT_VERSION
echo Available version: $LAST_VERSION

if [[ $CURRENT_VERSION = $LAST_VERSION ]]; then
    echo Up to date
    exit 0
fi

TMP_DIR=/tmp/signal-desktop_${LAST_VERSION}_amd64
TMP_FILE=${TMP_DIR}.deb
WORK_DIR=$TMP_DIR/signal-desktop-${LAST_VERSION}

echo Temporary file: $TMP_FILE
echo Temporary directory: $TMP_DIR
echo RPM working directory: $WORK_DIR

mkdir -p $TMP_DIR
test -f $TMP_FILE || curl https://updates.signal.org/desktop/apt/pool/main/s/signal-desktop/signal-desktop_${LAST_VERSION}_amd64.deb -s -o $TMP_FILE

test -d $WORK_DIR || (cd $TMP_DIR && sudo alien -r -g $TMP_FILE)
if [ $? -ne 0 ]; then
    exit 1
fi

sudo sed -i 's/^Summary: $/Summary: signal-desktop/' $TMP_DIR/signal-desktop-${LAST_VERSION}/signal-desktop-${LAST_VERSION}-2.spec
(cd $TMP_DIR && sudo rpmbuild --buildroot $WORK_DIR -bb $WORK_DIR/signal-desktop-${LAST_VERSION}-2.spec && sudo dnf install ../signal-desktop-${LAST_VERSION}-2.x86_64.rpm)
if [ $? -ne 0 ]; then
    exit 1
fi

rm $TMP_FILE
sudo rm -R $TMP_DIR
exit 0