Code: Select all
#!/bin/bash
# this assumes the pure and spider basic tgz
# downloads and this script are in the Downloads directory
# This script is for Debian 11 & 12 and Ubuntu 20.04 or later and derivatives
# Packages are installed in related groups so that those that are not needed
# can be commented out.
#
# 3 Oct 2023 - added checks for existing installs
# - uncapitalized downloads directory
# - and missing install files
# - added additional messages
# - changed to apt-get and routed output to /dev/null
#
# 15 Oct 2023
# - removed routing of apt-get output to /dev/null
# - Disabled ability to run as root user
# - Changed some echo messages
#
#----------------------------------------------------------------------------------------
# Disallow running script as root user
#----------------------------------------------------------------------------------------
#
if [[ $EUID -eq 0 ]]; then
echo "This script must NOT be run as root" 1>&2
exit 1
fi
#
#----------------------------------------------------------------------------------------
# PRE-INSTALLATION TESTS
#----------------------------------------------------------------------------------------
#
echo "Working ..."
#
if test -d ~/Downloads; then
cd ~/Downloads
else
cd ~/downloads
fi
#
if test -d ~/purebasic; then
echo "Pure Basic is already installed"
fi
if ! test -f PureBasic*.tgz; then
echo "No Pure Basic install file available"
fi
if test -d ~/spiderbasic; then
echo "Spider Basic is already installed"
fi
if ! test -f SpiderBasic*.tgz; then
echo "No Spider Basic install file available"
fi
if test -d ~/purebasic && test -d ~/spiderbasic; then
echo "Pure Basic and Spider Basic are already installed"
echo "Nothing to do!"
exit
fi
if ! test -f PureBasic*.tgz && ! test -f SpiderBasic*.tgz; then
echo "Pure Basic and Spider Basic install files missing"
echo "Nothing to do!"
exit
fi
#
#----------------------------------------------------------------------------------------
# MAKE SURE MIME AND APPLICATIONS DIRECTORIES EXIST
#----------------------------------------------------------------------------------------
#
if [ ! -d ~/.local/share/mime/packages ]; then mkdir -p ~/.local/share/mime/packages; fi
if [ ! -d ~/.local/share/applications ]; then mkdir -p ~/.local/share/applications; fi
#
#----------------------------------------------------------------------------------------
# MAKE SURE desktop-file-utils ARE INSTALLED
#----------------------------------------------------------------------------------------
#
sudo apt-get -y install desktop-file-utils
#
#----------------------------------------------------------------------------------------
# PURE BASIC INSTALL
#----------------------------------------------------------------------------------------
#
if test -f PureBasic*.tgz && ! test -d ~/purebasic; then
tar -xf PureBasic*.tgz
mv purebasic ..
cd ../purebasic
#
#----------------------------------------------------------------------------------------
# START OF LIBRARIES and PACKAGES INSTALLATION
#----------------------------------------------------------------------------------------
#
sudo apt-get -y install build-essential gcc g++
sudo apt-get -y install libxxf86vm-dev libxine2-dev unixodbc-dev libsdl1.2-dev libsdl2-dev libssl-dev
sudo apt-get -y install libgtk2.0-dev libgtk-3-dev
sudo apt-get -y install libwebkit2gtk-4.0-dev
#
#----------------------------------------------------------------------------------------
# VLC development libraries
#----------------------------------------------------------------------------------------
#
sudo apt-get -y install libvlc-dev
#
#----------------------------------------------------------------------------------------
# Mesa development libraries
#----------------------------------------------------------------------------------------
#
sudo apt-get -y install libgl1-mesa-dev libgl1-mesa-glx
#
#----------------------------------------------------------------------------------------
# qt5 development libraries
#----------------------------------------------------------------------------------------
#
sudo apt-get -y install qtbase5-dev qttools5-dev qtmultimedia5-dev qtdeclarative5-dev libqt5svg5-dev libqt5webkit5-dev libqt5multimedia5-plugins
#
#----------------------------------------------------------------------------------------
# Other necessary packages
#----------------------------------------------------------------------------------------
#
sudo apt-get -y install libcanberra-gtk-module
#
#----------------------------------------------------------------------------------------
# END OF LIBRARIES and PACKAGES INSTALLATION
#----------------------------------------------------------------------------------------
#
#----------------------------------------------------------------------------------------
# MIME INFO FOR PURE BASIC
#----------------------------------------------------------------------------------------
#
# change to dir for purebasic.xml
cd ~/.local/share/mime/packages
# purebasic.xml create
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > purebasic.xml
echo "<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>" >> purebasic.xml
echo " <mime-type type=\"text/purebasic\">" >> purebasic.xml
echo " <comment>PureBasic source code</comment>" >> purebasic.xml
echo " <glob pattern=\"*.pb\"/>" >> purebasic.xml
echo " <glob pattern=\"*.pbi\"/>" >> purebasic.xml
echo " <glob pattern=\"*.pbf\"/>" >> purebasic.xml
echo " </mime-type>" >> purebasic.xml
echo "</mime-info>" >> purebasic.xml
update-mime-database ~/.local/share/mime
#
#----------------------------------------------------------------------------------------
# Create Pure Basic Desktop File
#----------------------------------------------------------------------------------------
#
# change to dir for PureBasic.desktop
cd ~/.local/share/applications
#
# Create PureBasic.desktop file
echo "[Desktop Entry]" > PureBasic.desktop
echo "Comment=PureBasic IDE" >> PureBasic.desktop
echo "Terminal=false" >> PureBasic.desktop
echo "Name=PureBasic" >> PureBasic.desktop
echo "Type=Application" >> PureBasic.desktop
echo "MimeType=text/purebasic" >> PureBasic.desktop
echo "Categories=Development;" >> PureBasic.desktop
echo "StartupNotify=true" >> PureBasic.desktop
echo "Exec=${HOME}/purebasic/compilers/purebasic" >> PureBasic.desktop
echo "Icon=${HOME}/purebasic/logo.png" >> PureBasic.desktop
update-desktop-database ~/.local/share/applications
if test -d ~/purebasic; then
echo "PureBasic installed"
fi
fi
#
if test -d ~/Downloads; then
cd ~/Downloads
else
cd ~/downloads
fi
#
#----------------------------------------------------------------------------------------
# SPIDER BASIC INSTALL SECTION
#----------------------------------------------------------------------------------------
#
if test -f SpiderBasic*.tgz && ! test -d ~/spiderbasic; then
#
tar -xf SpiderBasic*.tgz
mv spiderbasic ..
#
#----------------------------------------------------------------------------------------
# Create Spider Basic Desktop File
#----------------------------------------------------------------------------------------
#
cd ~/.local/share/applications
# Create SpiderBasic.desktop file
echo "[Desktop Entry]" > SpiderBasic.desktop
echo "Comment=SpiderBasic IDE" >> SpiderBasic.desktop
echo "Terminal=false" >> SpiderBasic.desktop
echo "Name=SpiderBasic" >> SpiderBasic.desktop
echo "Type=Application" >> SpiderBasic.desktop
echo "Categories=Development;" >> SpiderBasic.desktop
echo "StartupNotify=true" >> SpiderBasic.desktop
echo "Exec=${HOME}/spiderbasic/compilers/spiderbasic" >> SpiderBasic.desktop
echo "Icon=${HOME}/spiderbasic/logo.png" >> SpiderBasic.desktop
update-desktop-database ~/.local/share/applications
if test -d ~/spiderbasic; then
echo "SpiderBasic installed"
fi
fi
#
#----------------------------------------------------------------------------------------
# end of script message
#----------------------------------------------------------------------------------------
#
if ! test -d ~/purebasic; then
echo "Pure Basic not installed"
fi
if ! test -d ~/spiderbasic; then
echo "Spider Basic not installed"
fi
#
echo "Pure and Spider Basic install script completed"