mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Support configuring smtp settings (#4161)
* Able to configure smtp settings. General cleanup. * Check if sudo is available.
This commit is contained in:
parent
10c13baf2b
commit
1ad7bbdd0c
|
@ -1,7 +1,13 @@
|
||||||
# ensure running as root
|
# ensure running as root
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
exec sudo "$0" "$@"
|
#Debian doesnt have sudo if root has a password.
|
||||||
|
if ! hash sudo 2>/dev/null; then
|
||||||
|
exec su -c "$0" "$@"
|
||||||
|
else
|
||||||
|
exec sudo "$0" "$@"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wget https://raw.githubusercontent.com/snipe/snipe-it/master/snipeit.sh
|
wget https://raw.githubusercontent.com/snipe/snipe-it/master/snipeit.sh
|
||||||
chmod 744 snipeit.sh
|
chmod 744 snipeit.sh
|
||||||
sudo ./snipeit.sh 2>&1 | sudo tee -a /var/log/snipeit-install.log
|
sudo ./snipeit.sh 2>&1 | sudo tee -a /var/log/snipeit-install.log
|
||||||
|
|
185
snipeit.sh
185
snipeit.sh
|
@ -54,7 +54,6 @@ progress () {
|
||||||
vhenvfile () {
|
vhenvfile () {
|
||||||
find /etc/apache2/mods-enabled -maxdepth 1 -name 'rewrite.load' >/dev/null 2>&1
|
find /etc/apache2/mods-enabled -maxdepth 1 -name 'rewrite.load' >/dev/null 2>&1
|
||||||
apachefile=/etc/apache2/sites-available/$name.conf
|
apachefile=/etc/apache2/sites-available/$name.conf
|
||||||
echo "* Creating Virtual host for apache."
|
|
||||||
{
|
{
|
||||||
echo "<VirtualHost *:80>"
|
echo "<VirtualHost *:80>"
|
||||||
echo "ServerAdmin webmaster@localhost"
|
echo "ServerAdmin webmaster@localhost"
|
||||||
|
@ -99,6 +98,12 @@ setenv () {
|
||||||
sed -i 's,^\(APP_URL=\).*,\1'http://$fqdn',' $webdir/$name/.env
|
sed -i 's,^\(APP_URL=\).*,\1'http://$fqdn',' $webdir/$name/.env
|
||||||
}
|
}
|
||||||
|
|
||||||
|
installcomposer () {
|
||||||
|
cd $webdir/$name/
|
||||||
|
curl -sS https://getcomposer.org/installer | php
|
||||||
|
php composer.phar install --no-dev --prefer-source
|
||||||
|
}
|
||||||
|
|
||||||
#CentOS Friendly f(x)s
|
#CentOS Friendly f(x)s
|
||||||
function isinstalled {
|
function isinstalled {
|
||||||
if yum list installed "$@" >/dev/null 2>&1; then
|
if yum list installed "$@" >/dev/null 2>&1; then
|
||||||
|
@ -173,13 +178,14 @@ read setpw
|
||||||
case $setpw in
|
case $setpw in
|
||||||
[yY] | [yY][Ee][Ss] )
|
[yY] | [yY][Ee][Ss] )
|
||||||
mysqluserpw="$(echo `< /dev/urandom tr -dc _A-Za-z-0-9 | head -c16`)"
|
mysqluserpw="$(echo `< /dev/urandom tr -dc _A-Za-z-0-9 | head -c16`)"
|
||||||
|
echo ""
|
||||||
ans="yes"
|
ans="yes"
|
||||||
;;
|
;;
|
||||||
[nN] | [n|N][O|o] )
|
[nN] | [n|N][O|o] )
|
||||||
echo -n " Q. What do you want your snipeit user password to be?"
|
echo -n " Q. What do you want your snipeit user password to be?"
|
||||||
read -s mysqluserpw
|
read -s mysqluserpw
|
||||||
echo ""
|
echo ""
|
||||||
ans="no"
|
ans="no"
|
||||||
;;
|
;;
|
||||||
*) echo " Invalid answer. Please type y or n"
|
*) echo " Invalid answer. Please type y or n"
|
||||||
;;
|
;;
|
||||||
|
@ -192,6 +198,7 @@ done
|
||||||
|
|
||||||
case $distro in
|
case $distro in
|
||||||
debian)
|
debian)
|
||||||
|
if [[ "$version" =~ ^9 ]]; then
|
||||||
##################################### Install for Debian 9 ##############################################
|
##################################### Install for Debian 9 ##############################################
|
||||||
webdir=/var/www
|
webdir=/var/www
|
||||||
|
|
||||||
|
@ -213,10 +220,13 @@ case $distro in
|
||||||
log "git clone https://github.com/snipe/snipe-it $webdir/$name" & pid=$!
|
log "git clone https://github.com/snipe/snipe-it $webdir/$name" & pid=$!
|
||||||
progress
|
progress
|
||||||
|
|
||||||
|
echo "* Configuring .env file."
|
||||||
tzone=$(cat /etc/timezone)
|
tzone=$(cat /etc/timezone)
|
||||||
setenv
|
setenv
|
||||||
|
|
||||||
|
echo "* Creating the new virtual host in Apache."
|
||||||
vhenvfile
|
vhenvfile
|
||||||
wait
|
|
||||||
echo >> $hosts "127.0.0.1 $hostname $fqdn"
|
echo >> $hosts "127.0.0.1 $hostname $fqdn"
|
||||||
a2ensite $name.conf
|
a2ensite $name.conf
|
||||||
|
|
||||||
|
@ -228,10 +238,9 @@ case $distro in
|
||||||
mysql -u root -p --execute="CREATE DATABASE snipeit;GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
|
mysql -u root -p --execute="CREATE DATABASE snipeit;GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
|
||||||
|
|
||||||
echo "* Installing and running composer."
|
echo "* Installing and running composer."
|
||||||
cd $webdir/$name/
|
installcomposer
|
||||||
curl -sS https://getcomposer.org/installer | php
|
|
||||||
php composer.phar install --no-dev --prefer-source
|
|
||||||
|
|
||||||
|
echo "* Setting permissions."
|
||||||
perms
|
perms
|
||||||
chown -R www-data:www-data "/var/www/$name"
|
chown -R www-data:www-data "/var/www/$name"
|
||||||
|
|
||||||
|
@ -242,7 +251,12 @@ case $distro in
|
||||||
|
|
||||||
echo "* Artisan Migrate."
|
echo "* Artisan Migrate."
|
||||||
php artisan migrate --force
|
php artisan migrate --force
|
||||||
;;
|
|
||||||
|
else
|
||||||
|
echo "Unable to Handle Debian Version #. Version Found: " $version
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
ubuntu)
|
ubuntu)
|
||||||
if [[ "$version" =~ 1[6-7] ]]; then
|
if [[ "$version" =~ 1[6-7] ]]; then
|
||||||
##################################### Install for Ubuntu 16-17 ##############################################
|
##################################### Install for Ubuntu 16-17 ##############################################
|
||||||
|
@ -277,6 +291,7 @@ case $distro in
|
||||||
tzone=$(cat /etc/timezone)
|
tzone=$(cat /etc/timezone)
|
||||||
setenv
|
setenv
|
||||||
|
|
||||||
|
echo "* Creating the new virtual host in Apache."
|
||||||
vhenvfile
|
vhenvfile
|
||||||
|
|
||||||
echo "* Starting the MariaDB server.";
|
echo "* Starting the MariaDB server.";
|
||||||
|
@ -290,10 +305,9 @@ case $distro in
|
||||||
mysql -u root -p --execute="CREATE DATABASE snipeit;GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
|
mysql -u root -p --execute="CREATE DATABASE snipeit;GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
|
||||||
|
|
||||||
echo "* Installing and running composer."
|
echo "* Installing and running composer."
|
||||||
cd $webdir/$name/
|
installcomposer
|
||||||
curl -sS https://getcomposer.org/installer | php
|
|
||||||
php composer.phar install --no-dev --prefer-source
|
|
||||||
|
|
||||||
|
echo "* Setting permissions."
|
||||||
perms
|
perms
|
||||||
chown -R www-data:www-data "/var/www/$name"
|
chown -R www-data:www-data "/var/www/$name"
|
||||||
|
|
||||||
|
@ -340,6 +354,7 @@ case $distro in
|
||||||
tzone=$(cat /etc/timezone)
|
tzone=$(cat /etc/timezone)
|
||||||
setenv
|
setenv
|
||||||
|
|
||||||
|
echo "* Creating the new virtual host in Apache."
|
||||||
vhenvfile
|
vhenvfile
|
||||||
|
|
||||||
echo "* Starting the MariaDB server.";
|
echo "* Starting the MariaDB server.";
|
||||||
|
@ -353,10 +368,9 @@ case $distro in
|
||||||
mysql -u root -p --execute="CREATE DATABASE snipeit;GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
|
mysql -u root -p --execute="CREATE DATABASE snipeit;GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
|
||||||
|
|
||||||
echo "* Installing and running composer."
|
echo "* Installing and running composer."
|
||||||
cd $webdir/$name/
|
installcomposer
|
||||||
curl -sS https://getcomposer.org/installer | php
|
|
||||||
php composer.phar install --no-dev --prefer-source
|
|
||||||
|
|
||||||
|
echo "* Setting permissions."
|
||||||
perms
|
perms
|
||||||
chown -R www-data:www-data "/var/www/$name"
|
chown -R www-data:www-data "/var/www/$name"
|
||||||
|
|
||||||
|
@ -378,7 +392,7 @@ case $distro in
|
||||||
##################################### Install for Centos/Redhat 6 ##############################################
|
##################################### Install for Centos/Redhat 6 ##############################################
|
||||||
webdir=/var/www/html
|
webdir=/var/www/html
|
||||||
|
|
||||||
echo "## Adding IUS, epel-release and MariaDB repositories.";
|
echo "* Adding IUS, epel-release and MariaDB repositories.";
|
||||||
mariadbRepo=/etc/yum.repos.d/MariaDB.repo
|
mariadbRepo=/etc/yum.repos.d/MariaDB.repo
|
||||||
touch "$mariadbRepo"
|
touch "$mariadbRepo"
|
||||||
{
|
{
|
||||||
|
@ -394,37 +408,35 @@ case $distro in
|
||||||
log "yum -y install https://centos6.iuscommunity.org/ius-release.rpm"
|
log "yum -y install https://centos6.iuscommunity.org/ius-release.rpm"
|
||||||
log "rpm --import /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY"
|
log "rpm --import /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY"
|
||||||
|
|
||||||
echo "## Installing httpd, PHP, MariaDB and other requirements.";
|
echo "* Installing httpd, PHP, MariaDB and other requirements.";
|
||||||
PACKAGES="httpd mariadb-server git unzip php71u php71u-mysqlnd php71u-bcmath php71u-cli php71u-common php71u-embedded php71u-gd php71u-mbstring php71u-mcrypt php71u-ldap php71u-json php71u-simplexml"
|
PACKAGES="httpd mariadb-server git unzip php71u php71u-mysqlnd php71u-bcmath php71u-cli php71u-common php71u-embedded php71u-gd php71u-mbstring php71u-mcrypt php71u-ldap php71u-json php71u-simplexml"
|
||||||
|
|
||||||
for p in $PACKAGES;do
|
for p in $PACKAGES;do
|
||||||
if isinstalled "$p"; then
|
if isinstalled "$p"; then
|
||||||
echo " ## $p already installed"
|
echo " * $p already installed"
|
||||||
else
|
else
|
||||||
echo -n " ## Installing $p ... "
|
echo " * Installing $p ... "
|
||||||
log "yum -y install $p"
|
log "yum -y install $p"
|
||||||
echo "";
|
|
||||||
fi
|
fi
|
||||||
done;
|
done;
|
||||||
|
|
||||||
echo -e "\n## Cloning Snipe-IT from github to the web directory.";
|
echo "* Cloning Snipe-IT from github to the web directory.";
|
||||||
|
|
||||||
log "git clone https://github.com/snipe/snipe-it $webdir/$name"
|
log "git clone https://github.com/snipe/snipe-it $webdir/$name"
|
||||||
|
|
||||||
# Make mariaDB start on boot and restart the daemon
|
# Make mariaDB start on boot and restart the daemon
|
||||||
echo "## Starting the MariaDB server.";
|
echo "* Starting the MariaDB server.";
|
||||||
chkconfig mysql on
|
chkconfig mysql on
|
||||||
/sbin/service mysql start
|
/sbin/service mysql start
|
||||||
|
|
||||||
echo "## Securing MariaDB server.";
|
echo "* Securing MariaDB server.";
|
||||||
/usr/bin/mysql_secure_installation
|
/usr/bin/mysql_secure_installation
|
||||||
|
|
||||||
echo "## Creating MariaDB Database/User."
|
echo "* Creating MariaDB Database/User."
|
||||||
echo "## Please Input your MariaDB root password: "
|
echo "* Please Input your MariaDB root password: "
|
||||||
mysql -u root -p --execute="CREATE DATABASE snipeit;GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
|
mysql -u root -p --execute="CREATE DATABASE snipeit;GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
|
||||||
|
|
||||||
#Create the new virtual host in Apache and enable rewrite
|
#Create the new virtual host in Apache and enable rewrite
|
||||||
echo "## Creating the new virtual host in Apache.";
|
echo "* Creating the new virtual host in Apache."
|
||||||
apachefile=/etc/httpd/conf.d/$name.conf
|
apachefile=/etc/httpd/conf.d/$name.conf
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -445,86 +457,84 @@ case $distro in
|
||||||
echo "</VirtualHost>"
|
echo "</VirtualHost>"
|
||||||
} >> "$apachefile"
|
} >> "$apachefile"
|
||||||
|
|
||||||
echo "## Setting up hosts file.";
|
echo "* Setting up hosts file.";
|
||||||
echo >> $hosts "127.0.0.1 $hostname $fqdn"
|
echo >> $hosts "127.0.0.1 $hostname $fqdn"
|
||||||
|
|
||||||
# Make apache start on boot and restart the daemon
|
# Make apache start on boot and restart the daemon
|
||||||
echo "## Starting the apache server.";
|
echo "* Starting the apache server.";
|
||||||
chkconfig httpd on
|
chkconfig httpd on
|
||||||
/sbin/service httpd start
|
/sbin/service httpd start
|
||||||
|
|
||||||
echo "## Configuring .env file."
|
echo "* Configuring .env file."
|
||||||
tzone=$(grep ZONE /etc/sysconfig/clock | tr -d '"' | sed 's/ZONE=//g');
|
tzone=$(grep ZONE /etc/sysconfig/clock | tr -d '"' | sed 's/ZONE=//g');
|
||||||
setenv
|
setenv
|
||||||
|
|
||||||
echo "## Installing and running composer."
|
echo "* Installing and running composer."
|
||||||
cd $webdir/$name
|
installcomposer
|
||||||
curl -sS https://getcomposer.org/installer | php
|
|
||||||
php composer.phar install --no-dev --prefer-source
|
|
||||||
|
|
||||||
|
echo "* Setting permissions."
|
||||||
perms
|
perms
|
||||||
chown -R apache:apache $webdir/$name
|
chown -R apache:apache $webdir/$name
|
||||||
|
|
||||||
/sbin/service iptables status >/dev/null 2>&1
|
/sbin/service iptables status >/dev/null 2>&1
|
||||||
if [ $? = 0 ]; then
|
if [ $? = 0 ]; then
|
||||||
#Open http/https port
|
echo "* Configuring iptables."
|
||||||
iptables -I INPUT 1 -p tcp -m tcp --dport 80 -j ACCEPT
|
iptables -I INPUT 1 -p tcp -m tcp --dport 80 -j ACCEPT
|
||||||
iptables -I INPUT 1 -p tcp -m tcp --dport 443 -j ACCEPT
|
iptables -I INPUT 1 -p tcp -m tcp --dport 443 -j ACCEPT
|
||||||
#Save iptables
|
|
||||||
service iptables save
|
service iptables save
|
||||||
fi
|
fi
|
||||||
|
|
||||||
service httpd restart
|
service httpd restart
|
||||||
|
|
||||||
echo "## Generating the application key."
|
echo "* Generating the application key."
|
||||||
php artisan key:generate --force
|
php artisan key:generate --force
|
||||||
|
|
||||||
echo "## Artisan Migrate."
|
echo "* Artisan Migrate."
|
||||||
php artisan migrate --force
|
php artisan migrate --force
|
||||||
|
|
||||||
elif [[ "$version" =~ ^7 ]]; then
|
elif [[ "$version" =~ ^7 ]]; then
|
||||||
##################################### Install for Centos/Redhat 7 ##############################################
|
##################################### Install for Centos/Redhat 7 ##############################################
|
||||||
webdir=/var/www/html
|
webdir=/var/www/html
|
||||||
|
|
||||||
echo -e "\n## Adding IUS, epel-release and MariaDB repositories.";
|
echo "* Adding IUS, epel-release and MariaDB repositories.";
|
||||||
log "yum -y install wget epel-release"
|
log "yum -y install wget epel-release"
|
||||||
log "yum -y install https://centos7.iuscommunity.org/ius-release.rpm"
|
log "yum -y install https://centos7.iuscommunity.org/ius-release.rpm"
|
||||||
log "rpm --import /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY"
|
log "rpm --import /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY"
|
||||||
|
|
||||||
echo "## Installing httpd, PHP, MariaDB and other requirements.";
|
echo "* Installing httpd, PHP, MariaDB and other requirements.";
|
||||||
PACKAGES="httpd mariadb-server git unzip php71u php71u-mysqlnd php71u-bcmath php71u-cli php71u-common php71u-embedded php71u-gd php71u-mbstring php71u-mcrypt php71u-ldap php71u-json php71u-simplexml"
|
PACKAGES="httpd mariadb-server git unzip php71u php71u-mysqlnd php71u-bcmath php71u-cli php71u-common php71u-embedded php71u-gd php71u-mbstring php71u-mcrypt php71u-ldap php71u-json php71u-simplexml"
|
||||||
|
|
||||||
for p in $PACKAGES;do
|
for p in $PACKAGES;do
|
||||||
if isinstalled "$p"; then
|
if isinstalled "$p"; then
|
||||||
echo " ## $p already installed"
|
echo " * $p already installed"
|
||||||
else
|
else
|
||||||
echo -n " ## Installing $p ... "
|
echo " * Installing $p ... "
|
||||||
log "yum -y install $p"
|
log "yum -y install $p"
|
||||||
echo "";
|
|
||||||
fi
|
fi
|
||||||
done;
|
done;
|
||||||
|
|
||||||
echo -e "\n## Cloning Snipe-IT from github to the web directory.";
|
echo "* Cloning Snipe-IT from github to the web directory.";
|
||||||
log "git clone https://github.com/snipe/snipe-it $webdir/$name"
|
log "git clone https://github.com/snipe/snipe-it $webdir/$name"
|
||||||
|
|
||||||
#Make mariaDB start on boot and restart the daemon
|
#Make mariaDB start on boot and restart the daemon
|
||||||
echo "## Starting the MariaDB server.";
|
echo "* Starting the MariaDB server.";
|
||||||
systemctl enable mariadb.service
|
systemctl enable mariadb.service
|
||||||
systemctl start mariadb.service
|
systemctl start mariadb.service
|
||||||
|
|
||||||
echo "## Securing MariaDB server.";
|
echo "* Securing MariaDB server.";
|
||||||
/usr/bin/mysql_secure_installation
|
/usr/bin/mysql_secure_installation
|
||||||
|
|
||||||
echo "## Creating MariaDB Database/User."
|
echo "* Creating MariaDB Database/User."
|
||||||
echo "## Please Input your MariaDB root password "
|
echo "* Please Input your MariaDB root password "
|
||||||
mysql -u root -p --execute="CREATE DATABASE snipeit;GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
|
mysql -u root -p --execute="CREATE DATABASE snipeit;GRANT ALL PRIVILEGES ON snipeit.* TO snipeit@localhost IDENTIFIED BY '$mysqluserpw';"
|
||||||
|
|
||||||
#TODO make sure the apachefile doesnt exist isnt already in there
|
#TODO make sure the apachefile doesnt exist isnt already in there
|
||||||
#Create the new virtual host in Apache and enable rewrite
|
#Create the new virtual host in Apache and enable rewrite
|
||||||
|
echo "* Creating the new virtual host in Apache."
|
||||||
apachefile="/etc/httpd/conf.d/$name.conf"
|
apachefile="/etc/httpd/conf.d/$name.conf"
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "## Creating the new virtual host in Apache.";
|
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
echo "LoadModule rewrite_module modules/mod_rewrite.so"
|
echo "LoadModule rewrite_module modules/mod_rewrite.so"
|
||||||
|
@ -544,45 +554,42 @@ case $distro in
|
||||||
} >> "$apachefile"
|
} >> "$apachefile"
|
||||||
|
|
||||||
#TODO make sure this isnt already in there
|
#TODO make sure this isnt already in there
|
||||||
echo "## Setting up hosts file.";
|
echo "* Setting up hosts file.";
|
||||||
echo >> $hosts "127.0.0.1 $hostname $fqdn"
|
echo >> $hosts "127.0.0.1 $hostname $fqdn"
|
||||||
|
|
||||||
echo "## Starting the apache server.";
|
echo "* Starting the apache server.";
|
||||||
# Make apache start on boot and restart the daemon
|
|
||||||
systemctl enable httpd.service
|
systemctl enable httpd.service
|
||||||
systemctl restart httpd.service
|
systemctl restart httpd.service
|
||||||
|
|
||||||
echo "## Configuring .env file."
|
echo "* Configuring .env file."
|
||||||
tzone=$(timedatectl | gawk -F'[: ]' ' $9 ~ /zone/ {print $11}');
|
tzone=$(timedatectl | gawk -F'[: ]' ' $9 ~ /zone/ {print $11}');
|
||||||
setenv
|
setenv
|
||||||
|
|
||||||
echo "## Installing and running composer."
|
echo "* Installing and running composer."
|
||||||
cd $webdir/$name
|
installcomposer
|
||||||
curl -sS https://getcomposer.org/installer | php
|
|
||||||
php composer.phar install --no-dev --prefer-source
|
|
||||||
|
|
||||||
#Set permissions
|
echo "* Setting permissions."
|
||||||
perms
|
perms
|
||||||
chown -R apache:apache $webdir/$name
|
chown -R apache:apache $webdir/$name
|
||||||
|
|
||||||
#Check if SELinux is enforcing
|
#Check if SELinux is enforcing
|
||||||
if [ "$(getenforce)" == "Enforcing" ]; then
|
if [ "$(getenforce)" == "Enforcing" ]; then
|
||||||
echo "## Configuring SELinux."
|
echo "* Configuring SELinux."
|
||||||
#Required for ldap integration
|
#Required for ldap integration
|
||||||
setsebool -P httpd_can_connect_ldap on
|
setsebool -P httpd_can_connect_ldap on
|
||||||
#Sets SELinux context type so that scripts running in the web server process are allowed read/write access
|
#Sets SELinux context type so that scripts running in the web server process are allowed read/write access
|
||||||
chcon -R -h -t httpd_sys_script_rw_t $webdir/$name/
|
chcon -R -h -t httpd_sys_script_rw_t $webdir/$name/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl restart httpd.service
|
log "systemctl restart httpd.service"
|
||||||
|
|
||||||
echo "## Generating the application key."
|
echo "* Generating the application key."
|
||||||
php artisan key:generate --force
|
php artisan key:generate --force
|
||||||
|
|
||||||
echo "## Artisan Migrate."
|
echo "* Artisan Migrate."
|
||||||
php artisan migrate --force
|
php artisan migrate --force
|
||||||
|
|
||||||
echo "## Creating scheduler cron."
|
echo "* Creating scheduler cron."
|
||||||
(crontab -l ; echo "* * * * * /usr/bin/php $webdir/$name/artisan schedule:run >> /dev/null 2>&1") | crontab -
|
(crontab -l ; echo "* * * * * /usr/bin/php $webdir/$name/artisan schedule:run >> /dev/null 2>&1") | crontab -
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -591,8 +598,58 @@ case $distro in
|
||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo ""
|
setupmail=default
|
||||||
echo " ***If you want mail capabilities, edit $webdir/$name/.env***"
|
until [[ $setupmail == "yes" ]] || [[ $setupmail == "no" ]]; do
|
||||||
|
echo -n " Q. Do you want to configure mail server settings? (y/n) "
|
||||||
|
read setupmail
|
||||||
|
|
||||||
|
case $setupmail in
|
||||||
|
[yY] | [yY][Ee][Ss] )
|
||||||
|
echo -n " Outgoing mailserver address:"
|
||||||
|
read mailhost
|
||||||
|
sed -i 's,^\(MAIL_HOST=\).*,\1'$mailhost',' $webdir/$name/.env
|
||||||
|
|
||||||
|
echo -n " Server port number:"
|
||||||
|
read mailport
|
||||||
|
sed -i 's,^\(MAIL_PORT=\).*,\1'$mailport',' $webdir/$name/.env
|
||||||
|
|
||||||
|
echo -n " Username:"
|
||||||
|
read mailusername
|
||||||
|
sed -i 's,^\(MAIL_USERNAME=\).*,\1'$mailusername',' $webdir/$name/.env
|
||||||
|
|
||||||
|
echo -n " Password:"
|
||||||
|
read mailpassword
|
||||||
|
sed -i 's,^\(MAIL_PASSWORD=\).*,\1'$mailpassword',' $webdir/$name/.env
|
||||||
|
|
||||||
|
echo -n " Encryption(null/TLS/SSL):"
|
||||||
|
read mailencryption
|
||||||
|
sed -i 's,^\(MAIL_ENCRYPTION=\).*,\1'$mailencryption',' $webdir/$name/.env
|
||||||
|
|
||||||
|
echo -n " From address:"
|
||||||
|
read mailfromaddr
|
||||||
|
sed -i 's,^\(MAIL_FROM_ADDR=\).*,\1'$mailfromaddr',' $webdir/$name/.env
|
||||||
|
|
||||||
|
echo -n " From name:"
|
||||||
|
read mailfromname
|
||||||
|
sed -i 's,^\(MAIL_FROM_NAME=\).*,\1'$mailfromname',' $webdir/$name/.env
|
||||||
|
|
||||||
|
echo -n " Reply to address:"
|
||||||
|
read mailreplytoaddr
|
||||||
|
sed -i 's,^\(MAIL_REPLYTO_ADDR=\).*,\1'$mailreplytoaddr',' $webdir/$name/.env
|
||||||
|
|
||||||
|
echo -n " Reply to name:"
|
||||||
|
read mailreplytoname
|
||||||
|
sed -i 's,^\(MAIL_REPLYTO_NAME=\).*,\1'$mailreplytoname',' $webdir/$name/.env
|
||||||
|
setupmail="yes"
|
||||||
|
;;
|
||||||
|
[nN] | [n|N][O|o] )
|
||||||
|
setupmail="no"
|
||||||
|
;;
|
||||||
|
*) echo " Invalid answer. Please type y or n"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo " ***Open http://$fqdn to login to Snipe-IT.***"
|
echo " ***Open http://$fqdn to login to Snipe-IT.***"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -601,4 +658,4 @@ echo "* Cleaning up..."
|
||||||
rm -f snipeit.sh
|
rm -f snipeit.sh
|
||||||
rm -f install.sh
|
rm -f install.sh
|
||||||
echo "* Finished!"
|
echo "* Finished!"
|
||||||
sleep 1
|
sleep 1
|
Loading…
Reference in a new issue