Merge remote-tracking branch 'origin/develop' into develop

Conflicts:
	install.sh
This commit is contained in:
Walter
2015-11-03 13:39:12 -05:00
+36 -16
View File
@@ -1,9 +1,9 @@
#!/bin/bash
######################################################
# Snipe-It Install Script #
# Script created by Mike Tucker #
# mtucker6784@gmail.com #
# Snipe-It Install Script #
# Script created by Mike Tucker #
# mtucker6784@gmail.com #
# This script is just to help streamline the #
# install process for Debian and CentOS #
# based distributions. I assume you will be #
@@ -16,7 +16,7 @@
# ensure running as root
if [ "$(id -u)" != "0" ]; then
exec sudo "$0" "$@"
exec sudo "$0" "$@"
fi
#First things first, let's set some variables and find our distro.
@@ -25,13 +25,24 @@ si="Snipe-IT"
hostname="$(hostname)"
fqdn="$(hostname --fqdn)"
hosts=/etc/hosts
distro="$(cat /proc/version)"
file=master.zip
name="snipeit"
tmp=/tmp/$name
ans=default
mkdir $tmp
# Lets find what distro we are using and what version
distro="$(cat /proc/version)"
if grep -q centos <<<$distro; then
for f in $(find /etc -type f -maxdepth 1 \( ! -wholename /etc/os-release ! -wholename /etc/lsb-release -wholename /etc/\*release -o -wholename /etc/\*version \) 2> /dev/null);
do
distro="${f:5:${#f}-13}"
done;
if [ "$distro" = "centos" ] || [ "$distro" = "redhat" ]; then
distro+="$(rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release))"
fi
fi
echo "
_____ _ __________
/ ___/____ (_)___ ___ / _/_ __/
@@ -45,19 +56,23 @@ echo ""
echo ""
echo " Welcome to Snipe-IT Inventory Installer for Centos and Debian!"
echo ""
#TODO add centos/redhat version checking to determine <6 or 7
case $distro in
*Ubuntu*|*Debian*)
echo " The installer has detected Ubuntu/Debian as the OS."
distro=u
distro=debian
;;
*centos*)
echo " The installer has detected CentOS as the OS."
distro=c6
*centos6*|*redhat6*)
echo " The installer has detected $distro $distVersion as the OS."
distro=redhat6
;;
*centos7*|*redhat7*)
echo " The installer has detected $distro $distVersion as the OS."
distro=redhat7
;;
*)
echo " The installer was unable to determine your OS. Exiting for safety."
exit
exit
;;
esac
@@ -66,7 +81,7 @@ esac
echo -n " Q. What is the FQDN of your server? ($fqdn): "
read fqdn
if [ -z "$fqdn" ]; then
fqdn="$(hostname --fqdn)"
fqdn="$(hostname --fqdn)"
fi
echo " Setting to $fqdn"
echo ""
@@ -103,11 +118,16 @@ echo >> $dbSetup "CREATE DATABASE snipeit;"
echo >> $dbSetup "GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
#Let us make it so only root can read the file. Again, this isn't best practice, so please remove these after the install.
<<<<<<< HEAD
chown root:root $dbSetup
chmod 700 $dbSetup
=======
chown root:root $passwordfile $dbSetup
chmod 700 $passwordfile $dbSetup
>>>>>>> origin/develop
case $distro in
u )
debian)
##################################### Install for Debian/ubuntu ##############################################
webdir=/var/www
@@ -188,7 +208,7 @@ case $distro in
service apache2 restart
;;
c6 )
redhat6 )
##################################### Install for Centos/Redhat 6 ##############################################
webdir=/var/www/html
@@ -201,7 +221,7 @@ case $distro in
echo >> $mariadbRepo "[mariadb]"
echo >> $mariadbRepo "name = MariaDB"
echo >> $mariadbRepo "baseurl = http://yum.mariadb.org/10.0/centos7-amd64"
echo >> $mariadbRepo "gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB"
echo >> $mariadbRepo "gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaD6"
echo >> $mariadbRepo "gpgcheck=1"
echo >> $mariadbRepo "enable=1"
@@ -295,7 +315,7 @@ case $distro in
service httpd restart
;;
c7 )
redhat7 )
##################################### Install for Centos/Redhat 7 ##############################################
webdir=/var/www/html