Skip to content

A free open source IT asset/license management system

Added code to snipeit.sh for Raspbian 9.4 install (#5980)

Jason5c820dd7b8a9
diff --git a/snipeit.sh b/snipeit.sh
index 48be3a9797..e8547d3f7d 100755
--- a/snipeit.sh
+++ b/snipeit.sh
@@ -105,6 +105,17 @@ install_packages () {
fi
done;
;;
+ raspbian)
+ for p in $PACKAGES; do
+ if dpkg -s "$p" >/dev/null 2>&1; then
+ echo " * $p already installed"
+ else
+ echo " * Installing $p"
+ log "DEBIAN_FRONTEND=noninteractive apt-get install -y -t buster $p"
+ fi
+ done;
+ ;;
+
centos)
for p in $PACKAGES; do
if yum list installed "$p" >/dev/null 2>&1; then
@@ -146,7 +157,7 @@ create_virtualhost () {
create_user () {
echo "* Creating Snipe-IT user."
- if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] ; then
+ if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] || [ "$distro" == "raspbian" ] ; then
adduser --quiet --disabled-password --gecos '""' "$APP_USER"
else
adduser "$APP_USER"
@@ -295,6 +306,12 @@ case $distro in
apache_group=www-data
apachefile=/etc/apache2/sites-available/$APP_NAME.conf
;;
+ *Raspbian*)
+ echo " The installer has detected $distro version $version codename $codename."
+ distro=raspbian
+ apache_group=www-data
+ apachefile=/etc/apache2/sites-available/$APP_NAME.conf
+ ;;
*debian*)
echo " The installer has detected $distro version $version codename $codename."
distro=debian
@@ -532,7 +549,57 @@ case $distro in
exit 1
fi
;;
- centos)
+ raspbian)
+ if [ "$version" == "9.4" ]; then
+ # Install for Raspbian 9.4
+ tzone=$(cat /etc/timezone)
+ cat >/etc/apt/sources.list.d/10-buster.list <<EOL
+deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi
+EOL
+
+ cat >/etc/apt/preferences.d/10-buster <<EOL
+Package: *
+Pin: release n=stretch
+Pin-Priority: 900
+
+Package: *
+Pin: release n=buster
+Pin-Priority: 750
+EOL
+
+ echo -n "* Updating installed packages."
+ log "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y upgrade" & pid=$!
+ progress
+
+ echo "* Installing Apache httpd, PHP, MariaDB and other requirements."
+ PACKAGES="mariadb-server mariadb-client apache2 libapache2-mod-php php7.2 php7.2-mcrypt php7.2-curl php7.2-mysql php7.2-gd php7.2-ldap php7.2-zip php7.2-mbstring php7.2-xml php7.2-bcmath curl git unzip"
+ install_packages
+
+ echo "* Configuring Apache."
+ create_virtualhost
+ log "phpenmod mcrypt"
+ log "phpenmod mbstring"
+ log "a2enmod rewrite"
+ log "a2ensite $APP_NAME.conf"
+
+ set_hosts
+
+ echo "* Starting MariaDB."
+ log "systemctl start mariadb.service"
+
+ echo "* Securing MariaDB."
+ /usr/bin/mysql_secure_installation
+
+ install_snipeit
+
+ echo "* Restarting Apache httpd."
+ log "systemctl restart apache2"
+ else
+ echo "Unsupported Raspbian version. Version found: $version"
+ exit 1
+ fi
+ ;;
+ centos)
if [[ "$version" =~ ^6 ]]; then
# Install for CentOS/Redhat 6.x
tzone=$(grep ZONE /etc/sysconfig/clock | tr -d '"' | sed 's/ZONE=//g');