Bash script to install Pure and Spider Basic (Fedora)

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

Bash script to install Pure and Spider Basic (Fedora)

Post by dmontaine »

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 Fedora and has been tested on Fedora 40 using the "PureBasic 6.10 LTS for Linux 
# (Ubuntu 20.04 or 22.04)" download and the "SpiderBasic 2.51 for Linux (Ubuntu 20.04 - x64)" download.
# Everything still seems to work correctly as of 30 Apr 2024.

# Packages are installed in related groups so that those that are not needed can be commented out.
#
# 15 Oct 2023 - synchronized script with current Debian/Ubuntu install script
#
#----------------------------------------------------------------------------------------
# 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 dnf -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 dnf -y install make automake gcc gcc-c++ 
	sudo dnf -y install xvidtune xine-lib-devel unixODBC-devel SDL2-devel openssl-devel 
	sudo dnf -y install gtk2-devel gtk3-devel 
	sudo dnf -y install webkit2gtk4.0-devel 
	#
	#----------------------------------------------------------------------------------------
	# VLC development libraries
	#----------------------------------------------------------------------------------------
	# To install the vlc libraries on Fedora you must enable the rpm-fusion repositories using this command
	sudo dnf -y install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm 
	# Install the vlc development package
	sudo dnf -y install vlc-devel 
	#
	#----------------------------------------------------------------------------------------
	# Mesa development libraries
	#----------------------------------------------------------------------------------------
	#
	sudo dnf -y install mesa-libGL-devel mesa-libEGL-devel >/dev/null
	#
	#----------------------------------------------------------------------------------------
	# qt5 development libraries
	#----------------------------------------------------------------------------------------
	#
	sudo dnf -y install qt5-qtbase-devel qt5-qttools-devel qt5-qtmultimedia-devel qt5-qtdeclarative-devel qt5-qtsvg-devel qt5-qtwebkit-devel qt5-qtmultimedia 
	#
	#----------------------------------------------------------------------------------------
	# Other necessary packages
	#----------------------------------------------------------------------------------------
	#
	sudo dnf -y install libcanberra-gtk2 
	sudo dnf -y install libcanberra-gtk3 
	#
	#----------------------------------------------------------------------------------------
	# END OF LIBRARIES and PACKAGES INSTALLATION
	#----------------------------------------------------------------------------------------
	#
	#----------------------------------------------------------------------------------------
	# MIME INFO FOR PUREBASIC
	#----------------------------------------------------------------------------------------
	#
	# 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
#
#----------------------------------------------------------------------------------------
# SPIDER BASIC INSTALL SECTION
#----------------------------------------------------------------------------------------
#
if test -d ~/Downloads; then
	cd ~/Downloads
else
	cd ~/downloads
fi
#
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 messages
#----------------------------------------------------------------------------------------
#
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"
Last edited by dmontaine on Tue Apr 30, 2024 11:55 pm, edited 2 times in total.
dmontaine
User
User
Posts: 50
Joined: Tue Jun 04, 2019 1:03 pm

Re: Bash script to install Pure and Spider Basic (Fedora)

Post by dmontaine »

15 Oct 2023
Synchronized script with my current Ubuntu/Debian install script
dmontaine
User
User
Posts: 50
Joined: Tue Jun 04, 2019 1:03 pm

Re: Bash script to install Pure and Spider Basic (Fedora)

Post by dmontaine »

30 Apr 2024
Tested script with Fedora 40.
Everything still seems to work without problems.
dmontaine
User
User
Posts: 50
Joined: Tue Jun 04, 2019 1:03 pm

Re: Bash script to install Pure and Spider Basic (Fedora)

Post by dmontaine »

08 Nov 2024
Tested script with Fedora 41
using current Ubuntu 24.04 download of Pure Basic & Spider Basic
Everything installs correctly
Post Reply