reaper
1 #!/bin/sh 2 3 # AM INSTALL SCRIPT VERSION 3.5 4 set -u 5 APP=reaper 6 ICON=cockos-reaper 7 SITE="https://reaper.fm" 8 9 # CREATE DIRECTORIES AND ADD REMOVER 10 [ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1 11 printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove 12 printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove 13 chmod a+x ../remove || exit 1 14 15 # DOWNLOAD AND PREPARE THE APP, $version is also used for updates 16 version=$(echo "https://www.reaper.fm/$(curl -Ls https://www.reaper.fm/download.php | tr '">< ' '\n' | grep -i "x86_64.*tar.xz$")") 17 wget "$version" || exit 1 18 [ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z 19 [ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.* 20 [ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip 21 cd .. 22 mv ./tmp/*/*/* ./ 23 rm -R -f ./tmp || exit 1 24 echo "$version" > ./version 25 chmod a+x ./$APP || exit 1 26 27 # LINK TO PATH 28 ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" 29 30 # SCRIPT TO UPDATE THE PROGRAM 31 cat >> ./AM-updater << 'EOF' 32 #!/bin/sh 33 set -u 34 APP=reaper 35 SITE="https://reaper.fm" 36 version0=$(cat "/opt/$APP/version") 37 version=$(echo "https://www.reaper.fm/$(curl -Ls https://www.reaper.fm/download.php | tr '">< ' '\n' | grep -i "x86_64.*tar.xz$")") 38 [ -n "$version" ] || { echo "Error getting link"; exit 1; } 39 if [ "$version" != "$version0" ]; then 40 mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1 41 notify-send "A new version of $APP is available, please wait" 42 wget "$version" || exit 1 43 [ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z 44 [ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.* 45 [ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip 46 cd .. 47 mv --backup=t ./tmp/*/*/* ./ 48 chmod a+x ./"$APP" || exit 1 49 echo "$version" > ./version 50 rm -R -f ./tmp ./*~ 51 notify-send "$APP is updated!" 52 else 53 echo "Update not needed!" 54 fi 55 EOF 56 chmod a+x ./AM-updater || exit 1 57 58 # ICON 59 mkdir -p icons 60 wget https://portable-linux-apps.github.io/icons/reaper.png -O ./icons/"$ICON" 2> /dev/null 61 62 # LAUNCHER 63 echo "[Desktop Entry] 64 Name=REAPER 65 Name[pt_BR]=REAPER 66 Exec=$APP 67 Icon=/opt/$APP/icons/$ICON 68 Type=Application 69 Terminal=false 70 Categories=AudioVideo; 71 Actions=NewProject;ShowAudioConfig;WhatsNew;License; 72 StartupWMClass=REAPER 73 74 [Desktop Action NewProject] 75 Name=REAPER (create new project) 76 Name[pt_BR]=REAPER (criar novo projeto) 77 Exec=$APP -new 78 Icon=/opt/$APP/icons/$ICON 79 80 [Desktop Action ShowAudioConfig] 81 Name=REAPER (show audio configuration on startup) 82 Name[pt_BR]=REAPER (mostrar configurações de áudio ao iniciar) 83 Exec=$APP -audiocfg 84 Icon=/opt/$APP/icons/$ICON 85 86 [Desktop Action WhatsNew] 87 Name=What's new 88 Name[pt_BR]=O que há de novo? 89 Exec=xdg-open /opt/$APP/whatsnew.txt 90 Icon=text-x-plain 91 92 [Desktop Action License] 93 Name=License and User Agreement 94 Name[pt_BR]=Licença e contrato de usuário 95 Exec=xdg-open /opt/$APP/EULA.txt 96 Icon=text-x-plain" > /usr/local/share/applications/"$APP"-AM.desktop