figma-linux
1 #!/bin/sh 2 3 APP=figma-linux 4 5 # CREATE THE FOLDER 6 mkdir /opt/$APP 7 cd /opt/$APP 8 9 # ADD THE REMOVER 10 echo '#!/bin/sh' >> /opt/$APP/remove 11 echo "rm -R -f /usr/local/share/applications/$APP-AM.desktop /opt/$APP /usr/local/bin/$APP" >> /opt/$APP/remove 12 chmod a+x /opt/$APP/remove 13 14 # DOWNLOAD THE APPIMAGE 15 mkdir tmp 16 cd ./tmp 17 18 wget https://github.com/$(wget https://github.com/Figma-Linux/figma-linux/releases/latest | grep -E '/.*/.*/.*arm64.AppImage' -o); 19 20 version=$(ls /opt/$APP/tmp) 21 echo "$version" >> /opt/$APP/version 22 23 cd .. 24 mv ./tmp/*mage ./$APP 25 chmod a+x /opt/$APP/$APP 26 rmdir ./tmp 27 28 # LINK 29 ln -s /opt/$APP/$APP /usr/local/bin/$APP 30 31 # SCRIPT TO UPDATE THE PROGRAM 32 echo '#!/bin/sh' >> /opt/$APP/AM-updater 33 echo "APP=$APP" >> /opt/$APP/AM-updater 34 echo "cd /opt/$APP" /usr/local/bin/$APP 35 echo 'version0=$(cat /opt/$APP/version) 36 37 url=https://github.com/Figma-Linux/figma-linux/releases/latest' >> /opt/$APP/AM-updater 38 39 echo 'if curl -L -s $url | grep -ioF "$version0"; then' >> /opt/$APP/AM-updater 40 echo ' echo "Update not needed!".' >> /opt/$APP/AM-updater 41 echo 'else' >> /opt/$APP/AM-updater 42 echo " notify-send 'A new version of $APP is available, please wait'" >> /opt/$APP/AM-updater 43 echo " mkdir /opt/$APP/tmp 44 cd /opt/$APP/tmp" >> /opt/$APP/AM-updater 45 46 ######################################################################################## 47 48 function1='$(wget https://github.com/Figma-Linux/figma-linux/releases/latest -O -' 49 function2="grep -E '/.*/.*/.*arm64.AppImage' -o)" 50 function3='$(ls /opt/$APP/tmp)' 51 52 echo " wget https://github.com/$function1 | $function2 53 version=$function3" >> /opt/$APP/AM-updater 54 55 ######################################################################################## 56 57 echo ' cd .. 58 if test -f ./tmp/*mage; then rm ./version 59 fi 60 echo "$version" >> ./version' >> /opt/$APP/AM-updater 61 echo " mv ./tmp/*mage ./$APP 62 chmod a+x /opt/$APP/$APP 63 rmdir ./tmp 64 fi" >> /opt/$APP/AM-updater 65 chmod a+x /opt/$APP/AM-updater 66 67 # LAUNCHER 68 rm -f /usr/local/share/applications/$APP-AM.desktop 69 echo "[Desktop Entry] 70 Name=Figma Linux 71 Exec=figma-linux 72 Comment=Figma is the first interface design tool based in the browser, making it easier for teams to create software. 73 Icon=/opt/$APP/$APP.svg 74 Type=Application 75 Categories=Graphics;" >> /usr/local/share/applications/$APP-AM.desktop 76 77 # ICON 78 wget https://raw.githubusercontent.com/ivan-hc/AM-application-manager/main/programs/.icons/$APP/$APP.svg