#!/bin/sh # AM INSTALL SCRIPT VERSION 3.5 set -u APP=thunderbird-beta SITE="https://www.thunderbird.net" SITE2="ivan-hc/Thunderbird-appimage" # CREATE DIRECTORIES AND ADD REMOVER [ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1 printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove chmod a+x ../remove || exit 1 # DOWNLOAD AND PREPARE THE APP read -r -p " Choose a package format: 1. Official portable package, with automatic updates (~300 MB). Source: https://www.thunderbird.net 2. AppImage created from the official package mentioned above (~100 MB). Source: https://github.com/ivan-hc/Thunderbird-appimage Which version you choose (type a number and press ENTER)?" response RELEASE="" if echo "$response" | grep -q "^1"; then RELEASE="PORTABLE" LANGUAGE=$(curl -Ls https://raw.githubusercontent.com/linuxmint/mdm/master/config/locale.alias | grep -i "$LANG" | grep -o '^\S*') CODE=$(curl -Ls https://releases.mozilla.org/pub/thunderbird/releases/latest/README.txt | cut -d ':' -f2 | grep -i "$LANGUAGE" | cut -d '=' -f2) wget "https://download.mozilla.org/?product=$APP-latest&os=linux64&lang=$CODE" --trust-server-names || exit 1 [ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.* cd .. mv ./tmp/thunderbird/* ./ rm -R ./tmp || exit 1 elif echo "$response" | grep -q "^2"; then RELEASE="APPIMAGE" version=$(curl -Ls https://api.github.com/repos/ivan-hc/Thunderbird-appimage/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | grep -i "beta" | head -1) wget "$version" || exit 1 cd .. mv ./tmp/*mage ./"$APP" rm -R -f ./tmp || exit 1 echo "$version" > ./version chmod a+x ./"$APP" || exit 1 fi [ -z "$RELEASE" ] && exit 0 if [ "$RELEASE" = APPIMAGE ]; then # LINK TO PATH ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" # SCRIPT TO UPDATE THE PROGRAM (APPIMAGE ONLY) cat <<-'HEREDOC' >> ./AM-updater #!/bin/sh set -u APP=thunderbird-beta SITE="ivan-hc/Thunderbird-appimage" version0=$(cat "/opt/$APP/version") version=$(curl -Ls https://api.github.com/repos/ivan-hc/Thunderbird-appimage/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | grep -i "beta" | head -1) [ -n "$version" ] || { echo "Error getting link"; exit 1; } if command -v appimageupdatetool >/dev/null 2>&1; then cd "/opt/$APP" || exit 1 appimageupdatetool -Or ./"$APP" && chmod a+x ./"$APP" && echo "$version" > ./version && exit 0 fi if [ "$version" != "$version0" ]; then mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1 notify-send "A new version of $APP is available, please wait" wget "$version" || exit 1 # Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded. cd .. mv --backup=t ./tmp/*mage ./"$APP" chmod a+x ./"$APP" || exit 1 echo "$version" > ./version rm -R -f ./*zs-old ./*.part ./tmp ./*~ notify-send "$APP is updated!" else echo "Update not needed!" fi HEREDOC sed -i 's/ / /g' ./AM-updater chmod a+x ./AM-updater || exit 1 # LAUNCHER & ICON ./"$APP" --appimage-extract *.desktop 1>/dev/null && mv ./squashfs-root/*.desktop ./"$APP".desktop ./"$APP" --appimage-extract .DirIcon 1>/dev/null && mv ./squashfs-root/.DirIcon ./DirIcon COUNT=0 while [ "$COUNT" -lt 10 ]; do # Tries to get the actual icon/desktop if it is a symlink to another symlink if [ -L ./"$APP".desktop ]; then LINKPATH="$(readlink ./"$APP".desktop | sed 's|^\./||' 2>/dev/null)" ./"$APP" --appimage-extract "$LINKPATH" 1>/dev/null && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop fi if [ -L ./DirIcon ]; then LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)" ./"$APP" --appimage-extract "$LINKPATH" 1>/dev/null && mv ./squashfs-root/"$LINKPATH" ./DirIcon fi [ ! -L ./"$APP".desktop ] && [ ! -L ./DirIcon ] && break COUNT=$((COUNT + 1)) done sed -i "s#Exec=[^ ]*#Exec=$APP#g; s#Icon=.*#Icon=/opt/$APP/icons/$APP#g" ./"$APP".desktop mv ./"$APP".desktop /usr/local/share/applications/"$APP"-AM.desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null rm -R -f ./squashfs-root else # LINK TO PATH ln -s "/opt/$APP/thunderbird" "/usr/local/bin/$APP" # LAUNCHER cat <<-HEREDOC >> /usr/local/share/applications/"$APP"-AM.desktop [Desktop Entry] Name=Thunderbird Beta Comment=Send and receive mail with Thunderbird Comment[ast]=Lleer y escribir corréu electrónicu Comment[ca]=Llegiu i escriviu correu Comment[cs]=Čtení a psaní pošty Comment[da]=Skriv/læs e-post/nyhedsgruppe med Mozilla Thunderbird Comment[de]=E-Mails und Nachrichten mit Thunderbird lesen und schreiben Comment[el]=Διαβάστε και γράψτε γράμματα με το Mozilla Thunderbird Comment[es]=Lea y escriba correos y noticias con Thunderbird Comment[fi]=Lue ja kirjoita sähköposteja Comment[fr]=Lire et écrire des courriels Comment[gl]=Lea e escriba correo electrónico Comment[he]=קריאה/כתיבה של דוא״ל/חדשות באמצעות Mozilla Thunderbird Comment[hr]=Čitajte/šaljite e-poštu s Thunderbird Comment[hu]=Levelek írása és olvasása a Thunderbirddel Comment[it]=Per leggere e scrivere email Comment[ja]=メールの読み書き Comment[ko]=Mozilla Thunderbird 메일/뉴스 읽기 및 쓰기 클라이언트 Comment[nl]=E-mail/nieuws lezen en schrijven met Mozilla Thunderbird Comment[pl]=Czytanie i wysyłanie e-maili Comment[pt_BR]=Leia e escreva suas mensagens Comment[ru]=Читайте и пишите письма Comment[sk]=Čítajte a píšte poštu pomocou programu Thunderbird Comment[sv]=Läs och skriv e-post Comment[ug]=ئېلخەت ۋە خەۋەرلەرنى Mozilla Thunderbird دا كۆرۈش ۋە يېزىش Comment[uk]=Читання та написання листів Comment[vi]=Đọc và soạn thư điện tử Comment[zh_CN]=阅读邮件或新闻 Comment[zh_TW]=以 Mozilla Thunderbird 讀寫郵件或新聞 GenericName=Mail Client (Bleeding edge) GenericName[ast]=Client de correu GenericName[ca]=Client de correu GenericName[cs]=Poštovní klient GenericName[da]=E-postklient GenericName[de]=E-Mail-Anwendung GenericName[el]=Λογισμικό αλληλογραφίας GenericName[es]=Cliente de correo GenericName[fi]=Sähköpostiohjelma GenericName[fr]=Client de messagerie GenericName[gl]=Cliente de correo electrónico GenericName[he]=לקוח דוא״ל GenericName[hr]=Klijent e-pošte GenericName[hu]=Levelezőkliens GenericName[it]=Client email GenericName[ja]=電子メールクライアント GenericName[ko]=메일 클라이언트 GenericName[nl]=E-mailprogramma GenericName[pl]=Klient poczty GenericName[pt_BR]=Cliente de E-mail GenericName[ru]=Почтовый клиент GenericName[sk]=Poštový klient GenericName[ug]=ئېلخەت دېتالى GenericName[uk]=Поштова програма GenericName[vi]=Phần mềm khách quản lý thư điện tử GenericName[zh_CN]=邮件新闻客户端 GenericName[zh_TW]=郵件用戶端 Exec=$APP %u Terminal=false Type=Application Icon=/opt/$APP/chrome/icons/default/default128.png Categories=Network;Email; MimeType=message/rfc822;x-scheme-handler/mailto;application/x-xpinstall; StartupNotify=true Actions=ComposeMessage;OpenAddressBook; HEREDOC fi