Bash Script to install Pure & Spider Basic on Debian Trixie (13)

Linux specific forum
dmontaine
User
User
Posts: 52
Joined: Tue Jun 04, 2019 1:03 pm

Bash Script to install Pure & Spider Basic on Debian Trixie (13)

Post by dmontaine »

This script is only for 64 bit Pure Basic 6.30 and/or Spider Basic 3.10 or later on Debian Trixie.

Packages are installed in related groups so that those that are not needed can be commented out.

9 Sep 2025
- specialized script for Debian Trixie installation
- updated libraries to those available in Trixie
- added libraries for new features in PowerBasic 6.30
- added mime info for SpiderBasic
- added optional chain to cordova-installer.sh script
- added installation libraries required for cordova

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 13 and Purebasic 6.30 on Debian Trixie
# packages are installed in related groups so that those that are not needed
# can be commented out.
#
# 9 Sep 2025 	
# - specialized script for Debian Trixie installation
# - updated libraries to those available in Trixie
# - added libraries for new features in 6.30
# - added chain to cordova-installer.sh script
# - added mime info for SpiderBasic
# - added installation libraries required for cordova
# - made cordova installation option
#                
# 3 Oct 2023    
# - added checks for existing installs
# - handle lowercase downloads directory name
# - 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
#----------------------------------------------------------------------------------------
clear
echo "PureBasic and/or SpiderBasic Install Script for Debian Trixie"
echo "--------------------------------------------------------------------"
echo
echo "This install script is only for Pure Basic 6.30 and/or Spider Basic 3.10 or later"
echo "on Debian Trixie (13)"
echo
echo
read -p "Continue? (y/N) " yn
case $yn in
    [yY] ) echo;;
    [nN] ) exit;;
    * ) exit ;;
esac
clear
#
echo "Working ..."
#
cd ~/Downloads
#
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.1-dev
	#	#----------------------------------------------------------------------------------------
	# VLC development libraries
	#
	sudo apt-get -y install libvlc-dev
	#	#----------------------------------------------------------------------------------------
	# Mesa development libraries
	#
	sudo apt-get -y install libgl1-mesa-dev libgl1 libglx-mesa0
	#	#----------------------------------------------------------------------------------------
	# qt5 development libraries
	#
	sudo apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qttools5-dev qtmultimedia5-dev qtdeclarative5-dev libqt5svg5-dev libqt5webengine5 libqt5multimedia5-plugins	qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
	#	#----------------------------------------------------------------------------------------
	# PureBasic IDE support package
	#
	sudo apt-get -y install libcanberra-gtk3-module
	#
#----------------------------------------------------------------------------------------	
	
	# HID support packages
	sudo apt-get -y install libusb-1.0-0-dev libudev-dev
	#	#----------------------------------------------------------------------------------------
	# 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
#
cd ~/Downloads
#
#----------------------------------------------------------------------------------------
# SPIDER BASIC INSTALL SECTION
#----------------------------------------------------------------------------------------
#
if test -f SpiderBasic*.tgz && ! test -d ~/spiderbasic; then	
	#
	tar -xf SpiderBasic*.tgz
	mv spiderbasic ..
	#
	#----------------------------------------------------------------------------------------
	# MIME INFO FOR SPIDER BASIC
	#----------------------------------------------------------------------------------------
	# change to dir for spiderbasic.xml
	cd ~/.local/share/mime/packages
	# spiderbasic.xml create
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > spiderbasic.xml
	echo "<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>" >> spiderbasic.xml
	echo "   <mime-type type=\"text/spiderbasic\">" >> spiderbasic.xml
	echo "      <comment>SpiderBasic source code</comment>" >> spiderbasic.xml
	echo "      <glob pattern=\"*.sb\"/>" >> spiderbasic.xml
	echo "      <glob pattern=\"*.sbi\"/>" >> spiderbasic.xml
	echo "      <glob pattern=\"*.sbp\"/>" >> spiderbasic.xml
	echo "      <glob pattern=\"*.sbf\"/>" >> spiderbasic.xml
	echo "   </mime-type>" >> spiderbasic.xml
	echo "</mime-info>" >> spiderbasic.xml
	update-mime-database ~/.local/share/mime
	# change to dir for spiderbasic.xml
	cd ~/.local/share/mime/packages
	#----------------------------------------------------------------------------------------
	# 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

cd ~/Downloads
#
#----------------------------------------------------------------------------------------
# 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"
else
	echo
	echo "Do you want to run the install_cordova script"
	echo "To enable Android Development using Spider Basic"
	echo
	echo
	read -p "Yes or No? (y/N) " yn
	case $yn in
	    [yY] ) clear 
		   sudo apt-get -y install nodejs npm curl openjdk-21-jre
		   cd ../spiderbasic
		   exec ./install-cordova.sh;;
	    [nN] ) exit;;
	    * ) exit ;;
	esac
fi
#
#----------------------------------------------------------------------------------------
echo "Pure and Spider Basic install script completed"
#----------------------------------------------------------------------------------------