Support more Mint versions and verify newer Ubuntu versions in snipeit.sh

In https://github.com/grokability/snipe-it/pull/16763 we added support
for Linux Mint 22.1, which is the newest stable version of Mint, but but
didn't get around to testing or adding support for less-recent versions.

With this PR, we're adding support for the following LinuxMint versions
* 22
* 21.3
* 21.2
* 21.1
* 21

We recommend using the newest version, but at least now you won't be
blocked so long as you're remotely up-to-date.

We're not going back any further because prior versions are based on
Ubuntu 20.04 (Focal), which is out of support as of April 2025, aka this
month.

Additionally, the most recent Ubuntu version specifically mentioned in
the script is 23.10. The script in its current version works all the way
up to the most recent version, so we're adding notation to that
effect.

Newly included Ubuntu versions are
25.04
24.10
24.04 (LTS)
This commit is contained in:
Jeremy Price 2025-04-23 13:27:58 -07:00
parent ddd4065c81
commit 67ec042ee3

View file

@ -18,6 +18,8 @@
# Updated Snipe-IT Install Script #
# Update created by Aaron Myers #
# Change log #
# * verify support for Ubuntu 24.04 -> 25.04 #
# * add support for linux Mint 21 -> 22 inclusive #
# * add support for linux mint 22.1 #
# * add support for php8.2, awslinux2, alma 8/9 #
# * fix rocky8/9 support #
@ -88,6 +90,7 @@ readonly APP_NAME="snipeit"
readonly APP_PATH="/var/www/html/$APP_NAME"
readonly APP_LOG="/var/log/snipeit-install.log"
readonly COMPOSER_PATH="/home/$APP_USER"
is_mint=false
progress () {
spin[0]="-"
@ -351,6 +354,7 @@ case $distro in
*linuxmint*)
echo " The installer has detected $distro version $version codename $codename."
distro=Ubuntu
is_mint=true
apache_group=www-data
apachefile=/etc/apache2/sites-available/$APP_NAME.conf
;;
@ -540,7 +544,7 @@ case $distro in
;;
Ubuntu)
if [ "${version//./}" -ge "2304" ]; then
# Install for Ubuntu 23.04 and 23.10
# Install for Ubuntu 23.04 and above
set_fqdn
set_dbpass
tzone=$(cat /etc/timezone)
@ -550,7 +554,7 @@ case $distro in
progress
echo "* Installing Apache httpd, PHP, MariaDB and other requirements."
PACKAGES="cron mariadb-server mariadb-client apache2 libapache2-mod-php php php-curl php-mysql php-gd php-ldap php-zip php-mbstring php-xml php-bcmath curl git unzip"
PACKAGES="cron mariadb-server mariadb-client apache2 libapache2-mod-php php php-curl php-mysql php-gd php-ldap php-zip php-mbstring php-xml php-bcmath curl git unzip wget"
install_packages
echo "* Configuring Apache."
@ -575,12 +579,27 @@ case $distro in
chmod 777 -R $APP_PATH/storage/framework/cache/
log "run_as_app_user php $APP_PATH/artisan cache:clear"
chmod 775 -R $APP_PATH/storage/
elif [ "${version//./}" -eq "221" ]; then
# Install for Linux Mint 22.1
elif [[ "${is_mint}" == "true" ]]; then
# Install for Linux Mint 21.2 - 22.1
if [[ "${version//.*/}" -eq "22" ]] ; then
ubuntu_codename=noble
elif [[ "${version//.*/}" -eq "21" ]]; then
ubuntu_codename=jammy
else
echo "Unsupported Linux Mint version. Version found: $version"
exit 1
fi
set_fqdn
set_dbpass
tzone=$(cat /etc/timezone)
echo "* Set up Ondrej PHP repository"
echo "# Odrej PHP repo for ability to choose non-distro PHP versions" > /etc/apt/sources.list.d/ppa_ondrej_php_$ubuntu_codename.list
echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu $ubuntu_codename main" >> /etc/apt/sources.list.d/ppa_ondrej_php_$ubuntu_codename.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C
echo -n "* Updating installed packages."
log "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y upgrade" & pid=$!
progress