#!/bin/sh APP=libreoffice # CREATE DIRECTORIES if [ -z "$APP" ]; then exit 1; fi mkdir -p "/opt/$APP/icons" && cd "/opt/$APP" || exit 1 # ADD THE REMOVER echo "#!/bin/sh rm -f /usr/share/applications/AM-$APP* /usr/local/bin/$APP rm -R -f /opt/$APP" >> "/opt/$APP/remove" chmod a+x "/opt/$APP/remove" # CHOOSE A VERSION read -r -p " This script will help you choose a version of Libreoffice, because they are classified according to functionality (STILL and FRESH) and the number of languages included (STANDARD and FULL): - STILL is the Stable version. This version is slightly older and does not have the latest features, but it has been tested for longer. - FRESH is the Testing version. If you're a technology enthusiast, early adopter or power user, this version is for you! - STANDARD supports English (US and GB), Arabic, Chinese (Simplified and Traditional), French, German, Italian, Japanese, Korean, Portuguese (Brazilian and Portugal), Russian, and Spanish. - FULL includes all the languages supported by LibreOffice. - HELP, this flag is a version including manuals. 1) STILL-STANDARD 2) STILL-STANDARD-HELP 3) STILL-FULL 4) STILL-FULL-HELP 5) FRESH-STANDARD 6) FRESH-STANDARD-HELP 7) FRESH-FULL 8) FRESH-FULL-HELP Which version you choose (type a number and press ENTER)? " response case "$response" in 1) rm -f /opt/"$APP"/version wget https://appimages.libreitalia.org/LibreOffice-still.standard-x86_64.AppImage -O "$APP" wget https://appimages.libreitalia.org/LibreOffice-still.standard-x86_64.AppImage.zsync -O "$APP".zsync 2> /dev/null echo "https://appimages.libreitalia.org/LibreOffice-still.standard-x86_64.AppImage" >> version;; 2) rm -f /opt/"$APP"/version wget https://appimages.libreitalia.org/LibreOffice-still.standard.help-x86_64.AppImage -O "$APP" wget https://appimages.libreitalia.org/LibreOffice-still.standard.help-x86_64.AppImage.zsync -O "$APP".zsync 2> /dev/null echo "https://appimages.libreitalia.org/LibreOffice-still.standard.help-x86_64.AppImage" >> version;; 3) rm -f /opt/"$APP"/version wget https://appimages.libreitalia.org/LibreOffice-still.full-x86_64.AppImage -O "$APP" wget https://appimages.libreitalia.org/LibreOffice-still.full-x86_64.AppImage.zsync -O "$APP".zsync 2> /dev/null echo "https://appimages.libreitalia.org/LibreOffice-still.full-x86_64.AppImage" >> version;; 4) rm -f /opt/"$APP"/version wget https://appimages.libreitalia.org/LibreOffice-still.full.help-x86_64.AppImage -O "$APP" wget https://appimages.libreitalia.org/LibreOffice-still.full.help-x86_64.AppImage.zsync -O "$APP".zsync 2> /dev/null echo "https://appimages.libreitalia.org/LibreOffice-still.full.help-x86_64.AppImage" >> version;; 5) rm -f /opt/"$APP"/version wget https://appimages.libreitalia.org/LibreOffice-fresh.standard-x86_64.AppImage -O "$APP" wget https://appimages.libreitalia.org/LibreOffice-fresh.standard-x86_64.AppImage.zsync -O "$APP".zsync 2> /dev/null echo "https://appimages.libreitalia.org/LibreOffice-fresh.standard-x86_64.AppImage" >> version;; 6) rm -f /opt/"$APP"/version wget https://appimages.libreitalia.org/LibreOffice-fresh.standard.help-x86_64.AppImage -O "$APP" wget https://appimages.libreitalia.org/LibreOffice-fresh.standard.help-x86_64.AppImage.zsync -O "$APP".zsync 2> /dev/null echo "https://appimages.libreitalia.org/LibreOffice-fresh.standard.help-x86_64.AppImage" >> version;; 7) rm -f /opt/"$APP"/version wget https://appimages.libreitalia.org/LibreOffice-fresh.full-x86_64.AppImage -O "$APP" wget https://appimages.libreitalia.org/LibreOffice-fresh.full-x86_64.AppImage.zsync -O "$APP".zsync 2> /dev/null echo "https://appimages.libreitalia.org/LibreOffice-fresh.full-x86_64.AppImage" >> version;; 8) rm -f /opt/"$APP"/version wget https://appimages.libreitalia.org/LibreOffice-fresh.full.help-x86_64.AppImage -O "$APP" wget https://appimages.libreitalia.org/LibreOffice-fresh.full.help-x86_64.AppImage.zsync -O "$APP".zsync 2> /dev/null echo "https://appimages.libreitalia.org/LibreOffice-fresh.full.help-x86_64.AppImage" >> version;; *) /opt/"$APP"/remove && echo " Installation aborted!"; exit;; esac chmod a+x /opt/$APP/$APP # LINK ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP" # SCRIPT TO UPDATE THE PROGRAM cat >> "/opt/$APP/AM-updater" << 'EOF' #!/bin/sh APP=libreoffice mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1 wget $(cat "/opt/$APP/version").zsync; cd .. mv ./tmp/*mage.zsync ./$APP.zsync rmdir ./tmp zsync ./"$APP".zsync rm -f ./*zs-old ./*.part chmod a+x "/opt/$APP/$APP" EOF chmod a+x "/opt/$APP/AM-updater" # ICONS cd "/opt/$APP" || exit 1 mv $(./libreoffice --appimage-extract usr/share/icons/hicolor/scalable/apps/*.svg) ./icons 2> /dev/null RELEASE=$(ls ./icons | head -1 | rev | cut -c 10- | rev) mv ./icons/"$RELEASE"-base* ./icons/"$APP"-base 2> /dev/null mv ./icons/"$RELEASE"-basic* ./icons/"$APP"-basic 2> /dev/null mv ./icons/"$RELEASE"-calc* ./icons/"$APP"-calc 2> /dev/null mv ./icons/"$RELEASE"-chart* ./icons/"$APP"-chart 2> /dev/null mv ./icons/"$RELEASE"-draw* ./icons/"$APP"-draw 2> /dev/null mv ./icons/"$RELEASE"-extension* ./icons/"$APP"-extension 2> /dev/null mv ./icons/"$RELEASE"-impress* ./icons/"$APP"-impress 2> /dev/null mv ./icons/"$RELEASE"-main* ./icons/"$APP"-main 2> /dev/null mv ./icons/"$RELEASE"-math* ./icons/"$APP"-math 2> /dev/null mv ./icons/"$RELEASE"-startcenter* ./icons/"$APP"-startcenter 2> /dev/null mv ./icons/"$RELEASE"-writer* ./icons/"$APP"-writer 2> /dev/null # LAUNCHERS mv $(./libreoffice --appimage-extract opt/libreoffice*/share/xdg) . 2> /dev/null cd ./xdg || exit 1 for f in * ; do mv "$f" "AM-$APP-$f"; done sed -i "s# $(echo $RELEASE | cut -c 12-) # #g; s#Icon=$APP#Icon=/opt/$APP/icons/$APP#g; s#$RELEASE#$APP#g" * sed -i '/Name=LibreOffice/c\Name=LibreOffice' ./*startcenter.desktop cd .. mv ./xdg/* /usr/share/applications/ 2> /dev/null rm -R -f ./squashfs-root ./xdg