leapp.sh 747 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. bin=~/.bin/leapp
  3. latest_version_url="https://api.github.com/repos/noovolari/leapp/releases/latest"
  4. # Function to compare version numbers
  5. function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
  6. # If leapp binary is not found or if there is a newer version, download it
  7. if [ ! -f $bin ] || version_gt "$(curl -s $latest_version_url | grep -oP '"tag_name": "\K(.*)(?=")')" "$(basename $bin | grep -oP '\d+\.\d+\.\d+')"; then
  8. notify-send -u normal "⏬ Leapp" "Checking for updates..."
  9. url="https://asset.noovolari.com/latest/Leapp-appImage.zip"
  10. wget -q -O /tmp/leapp.AppImage "$url"
  11. unzip /tmp/leapp.AppImage -d /tmp
  12. mv /tmp/release/Leapp* $bin
  13. chmod +x $bin
  14. fi
  15. # Execute leapp
  16. $bin -f -i $1 -o $2