Page 1 of 1

Updated Bash Install script for Debian Bookworm (12)

Posted: Thu Sep 11, 2025 9:39 pm
by dmontaine
Use the PowerBasic and SpiderBasic tgz files for Ubuntu 20.04 - 22.04

- Updated script for Debian Bookworm
- added libraries for new HID features in 6.30
- added chain to cordova-installer.sh script
- added mime info for SpiderBasic

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 22.04 and derivatives
# Packages are installed in related groups so that those that are not needed
# can be commented out.
#
# 11 Sep 2025
# 		- Updated script for Debian Bookworm
# 		- added libraries for new HID features in 6.30
# 		- added chain to cordova-installer.sh script
#		 - added mime info for SpiderBasic
#
# 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
	#----------------------------------------------------------------------------------------
	#
	# canberra for ide
	sudo apt-get -y install libcanberra-gtk-module
	# HID libraries
	sudo apt 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
#
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 ..
	#
	#----------------------------------------------------------------------------------------
	# 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
#
#----------------------------------------------------------------------------------------
# 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-17-jre
		   cd ~/spiderbasic
		   exec ./install-cordova.sh;;
	    [nN] ) exit;;
	    * ) exit ;;
	esac
fi
#
#
echo "Pure and Spider Basic install script completed"