Skip to content

Commit

Permalink
Added code to snipeit.sh for Raspbian 9.4 install (snipe#5980)
Browse files Browse the repository at this point in the history
* Added code to snipeit.sh for Raspbian 9.4 install

* More additions to snipeit.sh to install php7.2  on raspian in prep for
version 5

* added public/phpinfo.php to .gitignore

* Deleted phpinfo.php

* removed phpinfo.php from .gitignore
  • Loading branch information
jasonlshelton authored and snipe committed Jul 27, 2018
1 parent 248fcfa commit 5c820dd
Showing 1 changed file with 69 additions and 2 deletions.
71 changes: 69 additions & 2 deletions snipeit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 5c820dd

Please sign in to comment.