vivaldi-stable 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/sh
  2. APP=vivaldi-stable
  3. SITE="https://vivaldi.com"
  4. # CREATE THE FOLDER
  5. mkdir /opt/$APP
  6. cd /opt/$APP
  7. # ADD THE REMOVER
  8. echo '#!/bin/sh' >> /opt/$APP/remove
  9. echo "rm -R -f /usr/local/share/applications/$APP-AM.desktop /opt/$APP /usr/local/bin/$APP" >> /opt/$APP/remove
  10. chmod a+x /opt/$APP/remove
  11. # DOWNLOAD THE ARCHIVE
  12. mkdir tmp
  13. cd ./tmp
  14. version=$(echo "https://repo.vivaldi.com/snapshot/deb/pool/main/$(curl -Ls https://repo.vivaldi.com/snapshot/deb/pool/main/ | grep $APP | grep arm64 | tail -1 | grep -o -P '(?<=href=").*(?=">vivaldi)')")
  15. wget $version
  16. echo "$version" >> /opt/$APP/version
  17. ar x ./*deb
  18. tar fx ./data.tar.xz
  19. cd ..
  20. mv ./tmp/opt/*/* ./
  21. mv ./tmp/etc .
  22. cp ./tmp/usr/share/applications/* ./$APP.desktop
  23. mv ./tmp/usr .
  24. rm -R -f ./tmp
  25. # LINK
  26. ln -s /opt/$APP/vivaldi /usr/local/bin/$APP
  27. # SCRIPT TO UPDATE THE PROGRAM
  28. cat >> /opt/$APP/AM-updater << 'EOF'
  29. #!/usr/bin/env bash
  30. APP=vivaldi-stable
  31. version0=$(cat /opt/$APP/version)
  32. version=$(echo "https://repo.vivaldi.com/snapshot/deb/pool/main/$(curl -Ls https://repo.vivaldi.com/snapshot/deb/pool/main/ | grep $APP | grep arm64 | tail -1 | grep -o -P '(?<=href=").*(?=">vivaldi)')")
  33. if [ $version = $version0 ]; then
  34. echo "Update not needed!"
  35. else
  36. notify-send "A new version of $APP is available, please wait"
  37. mkdir /opt/$APP/tmp
  38. cd /opt/$APP/tmp
  39. wget $version
  40. ar x ./*deb
  41. tar fx ./data.tar.xz
  42. cd ..
  43. rm ./version
  44. echo $version >> ./version
  45. mv --backup=t ./tmp/opt/*/* ./
  46. mv --backup=t ./tmp/etc .
  47. mv --backup=t ./tmp/usr .
  48. chmod a+x /opt/$APP/$APP
  49. rm -R -f ./tmp ./*~
  50. notify-send "$APP is updated!"
  51. fi
  52. EOF
  53. chmod a+x /opt/$APP/AM-updater
  54. # ENABLE CODEC HTML5
  55. sed -i '/^ DOWNLOAD/s/ -T[0-9]\+//' ./update-ffmpeg 2> /dev/null
  56. ./update-ffmpeg 2> /dev/null
  57. # LAUNCHER
  58. sed -i "s#Exec=/usr/bin/#Exec=#g" $APP.desktop
  59. sed -i "s#Icon=vivaldi#Icon=/opt/$APP/icons/$APP#g" $APP.desktop
  60. mv ./$APP.desktop /usr/local/share/applications/$APP-AM.desktop 2> /dev/null
  61. # ICON
  62. mkdir icons
  63. cp ./*256.png ./icons/$APP