Merge pull request #16798 from grokability/more-mint-support-and-newer-ubuntus

Support more Mint versions and verify newer Ubuntu versions in snipeit.sh
This commit is contained in:
snipe 2025-04-29 10:19:28 +01:00 committed by GitHub
commit 8984d60c39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,6 +18,8 @@
# Updated Snipe-IT Install Script # # Updated Snipe-IT Install Script #
# Update created by Aaron Myers # # Update created by Aaron Myers #
# Change log # # 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 linux mint 22.1 #
# * add support for php8.2, awslinux2, alma 8/9 # # * add support for php8.2, awslinux2, alma 8/9 #
# * fix rocky8/9 support # # * fix rocky8/9 support #
@ -88,6 +90,7 @@ readonly APP_NAME="snipeit"
readonly APP_PATH="/var/www/html/$APP_NAME" readonly APP_PATH="/var/www/html/$APP_NAME"
readonly APP_LOG="/var/log/snipeit-install.log" readonly APP_LOG="/var/log/snipeit-install.log"
readonly COMPOSER_PATH="/home/$APP_USER" readonly COMPOSER_PATH="/home/$APP_USER"
is_mint=false
progress () { progress () {
spin[0]="-" spin[0]="-"
@ -351,6 +354,7 @@ case $distro in
*linuxmint*) *linuxmint*)
echo " The installer has detected $distro version $version codename $codename." echo " The installer has detected $distro version $version codename $codename."
distro=Ubuntu distro=Ubuntu
is_mint=true
apache_group=www-data apache_group=www-data
apachefile=/etc/apache2/sites-available/$APP_NAME.conf apachefile=/etc/apache2/sites-available/$APP_NAME.conf
;; ;;
@ -540,7 +544,7 @@ case $distro in
;; ;;
Ubuntu) Ubuntu)
if [ "${version//./}" -ge "2304" ]; then if [ "${version//./}" -ge "2304" ]; then
# Install for Ubuntu 23.04 and 23.10 # Install for Ubuntu 23.04 and above
set_fqdn set_fqdn
set_dbpass set_dbpass
tzone=$(cat /etc/timezone) tzone=$(cat /etc/timezone)
@ -550,7 +554,7 @@ case $distro in
progress progress
echo "* Installing Apache httpd, PHP, MariaDB and other requirements." 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 install_packages
echo "* Configuring Apache." echo "* Configuring Apache."
@ -575,12 +579,27 @@ case $distro in
chmod 777 -R $APP_PATH/storage/framework/cache/ chmod 777 -R $APP_PATH/storage/framework/cache/
log "run_as_app_user php $APP_PATH/artisan cache:clear" log "run_as_app_user php $APP_PATH/artisan cache:clear"
chmod 775 -R $APP_PATH/storage/ chmod 775 -R $APP_PATH/storage/
elif [ "${version//./}" -eq "221" ]; then elif [[ "${is_mint}" == "true" ]]; then
# Install for Linux Mint 22.1 # 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_fqdn
set_dbpass set_dbpass
tzone=$(cat /etc/timezone) 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." echo -n "* Updating installed packages."
log "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y upgrade" & pid=$! log "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y upgrade" & pid=$!
progress progress