#!/bin/bash
set -eu

url='https://linphone.org/releases/linux/latest_app'
destination='/opt/appimages/linphone.AppImage'

if command -v pkill >/dev/null 2>&1; then
pkill -x AppRun.wrapped 2>/dev/null || true
pkill -TERM -f '/opt/appimages/linphone.AppImage' 2>/dev/null || true
fi

echo "Downloading Linphone AppImage..."
wget -O "$destination" "$url"
chmod 755 "$destination"
echo "Done."
