Topic: LibreOffice Install Script for the Lazy...
Hey, I modified the OpenOffice.org install script for LibreOffice. This is just for the lazy like me that just want to copy and paste.
#!/bin/bash
# ---------------------------------------------------------------------
# An Openbox pipemenu for use with Libreoffice.org/ and CrunchBang Linux.
# Written for CrunchBang Linux <http://crunchbanglinux.org/>
# by Philip Newborough (aka corenominal) <mail@philipnewborough.co.uk>
# edited by Aaron Valandra (aka Ratty)
# ---------------------------------------------------------------------
# Set flag
INSTALLED=false
if [ "$1" = "--install" ]; then
terminator --command="cb-libreoffice.org-pipemenu --install-libre"
exit 0
fi
if [ "$1" = "--install-libre" ]; then
clear
echo ""
echo " INSTALL LIBREOFFICE.ORG"
echo " ----------------------"
echo " This script will install libreoffice.org."
echo ""
echo -n " Run the installer now? (Y|n) > "
read a
if [ "$a" = "y" ] || [ "$a" = "Y" ] || \
[ "$a" = "" ]; then
# Checking internet connection...
clear
echo " Checking internet connection..."
sleep 2s
echo ""
IS=`/bin/ping -c 1 ftp.de.debian.org | grep -c "64 bytes"`
if [ "$IS" -lt "1" ]; then
until [ "$CONT" != "" ]; do
echo ""
IS=`/bin/ping -c 1 ftp.de.debian.org | grep -c "64 bytes"`
if [ "$IS" -lt "1" ]; then
clear
echo " Internet connection test failed!"
echo ""
echo " This script requires a working internet connection. Please configure"
echo " your internet connection, then hit any key to continue, else hit \"q\""
echo " to quit."
read -n1 a
if [ "$a" = "q" ]; then
clear
echo "Script aborted."
sleep 3s
exit 0
fi
else
CONT="pass"
fi
done
fi
clear
echo " Internet connection test passed..."
sleep 2s
clear
echo " Adding LibreOffice Repo to /etc/apt/sources.list..."
sleep 2s
echo 'deb http://download.tuxfamily.org/gericom/libreoffice /' | sudo tee -a /etc/apt/sources.list
sleep 2s
echo " Adding key for LibreOffice..."
sleep 2s
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 890E7A26
sleep 2s
echo " Updating sources..."
sleep 2s
sudo apt-get update
clear
if ! sudo apt-get install -y libreoffice3* liboasis3.3*; then
clear
echo ""
echo " There was a problem installing LibreOffice.org."
echo ""
echo " Hit any key to try again, or \"q\" to quit..."
read -n1 a
if [ "$a" = "q" ] || [ "$a" = "Q" ]; then
clear
exit 0
else
cb-libreoffice.org-pipemenu --install-libre
exit 0
fi
else
clear
echo ""
echo " LibreOffice.org has been installed successfully."
echo ""
echo " Hit any key to exit..."
read -n1 a
exit 0
fi
else
exit 0
fi
fi
# Start pipemenu
echo " <openbox_pipe_menu>"
# Writer
if [ -x "/opt/libreoffice/program/swriter" ];then
INSTALLED=true
cat << _swriter_
<item label="Writer">
<action name="Execute">
<execute>
/opt/libreoffice/program/soffice
</execute>
</action>
</item>
_swriter_
fi
# Formula
if [ -x "//opt/libreoffice/program/scalc" ];then
INSTALLED=true
cat << _scalc_
<item label="Calc">
<action name="Execute">
<execute>
/opt/libreoffice/program/scalc
</execute>
</action>
</item>
_scalc_
fi
# Impress
if [ -x "/opt/libreoffice/program/simpress" ];then
INSTALLED=true
cat << _simpress_
<item label="Impress">
<action name="Execute">
<execute>
/opt/libreoffice/program/simpress
</execute>
</action>
</item>
_simpress_
fi
# Draw
if [ -x "/opt/libreoffice/program/sdraw" ];then
INSTALLED=true
cat << _sdraw_
<item label="Draw">
<action name="Execute">
<execute>
/opt/libreoffice/program/sdraw
</execute>
</action>
</item>
_sdraw_
fi
# Math
if [ -x "/opt/libreoffice/program/smath" ];then
INSTALLED=true
cat << _smath_
<item label="Math">
<action name="Execute">
<execute>
/opt/libreoffice/program/smath
</execute>
</action>
</item>
_smath_
fi
# SQL
if [ -x "/opt/libreoffice/program/sbase" ];then
INSTALLED=true
cat << _squery_
<item label="SQL">
<action name="Execute">
<execute>
/opt/libreoffice/program/sbase
</execute>
</action>
</item>
_squery_
fi
# Base
if [ -x "/usr/bin/libreoffice" ];then
INSTALLED=true
cat << _sbase_
<item label="Base">
<action name="Execute">
<execute>
libreoffice
</execute>
</action>
</item>
_sbase_
fi
if [ $INSTALLED = false ]; then
cat << _sinstall_
<item label="Install LibreOffice.org">
<action name="Execute">
<execute>
cb-libreoffice.org-pipemenu --install
</execute>
</action>
</item>
_sinstall_
fi
# End pipemenu
echo " </openbox_pipe_menu>"
exit 0Save the file as cb-libreoffice.org-pipemenu in /usr/bin OR just edit cb-openoffice.org-pipemenu. IF you create a new file don't forget to make it executable (sudo chmod +x /usr/bin/cb-libreoffice.org-pipemenu). Another note, don't forget to edit your menu config to point to the new script.
Cheers!
Ratty
Last edited by Raistlfiren (2011-01-25 04:58:54)