Make Samba and CMS optional in BashScripts/install-apache.sh
This commit is contained in:
parent
2cf9a8aba4
commit
50584cbf1b
@ -7,12 +7,15 @@ fi
|
|||||||
REALUSER=$(logname)
|
REALUSER=$(logname)
|
||||||
mkdir /home/$REALUSER/www 2>>install.log &
|
mkdir /home/$REALUSER/www 2>>install.log &
|
||||||
|
|
||||||
#apt install docker.io
|
|
||||||
|
|
||||||
apt update -qq 2>>install.log
|
apt update -qq 2>>install.log
|
||||||
apt install apache2 -y 2>>install.log &&
|
apt install apache2 -y 2>>install.log
|
||||||
apt install samba -y 2>>install.log &&
|
|
||||||
|
|
||||||
|
read -p "Would you like to install Samba? (Y/n)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Nn]$ ]]
|
||||||
|
then
|
||||||
|
echo Installing Samba...
|
||||||
|
apt install samba -y 2>>install.log &&
|
||||||
# Setting up Samba shares
|
# Setting up Samba shares
|
||||||
if ! grep -q "/home/$REALUSER/www" "/etc/samba/smb.conf"; then
|
if ! grep -q "/home/$REALUSER/www" "/etc/samba/smb.conf"; then
|
||||||
cat <<EOT >> "/etc/samba/smb.conf"
|
cat <<EOT >> "/etc/samba/smb.conf"
|
||||||
@ -76,9 +79,38 @@ ufw allow samba 2>>install.log
|
|||||||
if ! pdbedit "$REALUSER" &>/dev/null; then
|
if ! pdbedit "$REALUSER" &>/dev/null; then
|
||||||
sudo smbpasswd -a $REALUSER 2>>install.log
|
sudo smbpasswd -a $REALUSER 2>>install.log
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -p "Would you like to install uCMS site? (Y/n)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Nn]$ ]]
|
||||||
|
then
|
||||||
mkdir -p /var/www/cms/www 2>>install.log &&
|
mkdir -p /var/www/cms/www 2>>install.log &&
|
||||||
mkdir -p /var/www/cms/log 2>>install.log &&
|
mkdir -p /var/www/cms/log 2>>install.log &&
|
||||||
|
if [ ! -f "/etc/apache2/sites-enabled/cms.conf" ]; then
|
||||||
|
cat <<EOT > "/etc/apache2/sites-enabled/cms.conf"
|
||||||
|
# Listen 8090
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerAdmin webmaster@localhost
|
||||||
|
DocumentRoot /var/www/cms/www
|
||||||
|
ErrorLog /var/www/cms/log/error.log
|
||||||
|
CustomLog /var/www/cms/log/access.log combined
|
||||||
|
|
||||||
|
<Directory /var/www/cms/www>
|
||||||
|
Options Indexes FollowSymLinks MultiViews
|
||||||
|
DirectoryIndex index.html index.pl
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
<Files ~ "\.(pl|cgi)$">
|
||||||
|
AddHandler cgi-script .pl
|
||||||
|
Options +ExecCGI
|
||||||
|
</Files>
|
||||||
|
</VirtualHost>
|
||||||
|
EOT
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
chmod -R uga+rwx /home/$REALUSER/www/ 2>>install.log &&
|
chmod -R uga+rwx /home/$REALUSER/www/ 2>>install.log &&
|
||||||
chmod -R uga+rwx /var/www/ 2>>install.log &&
|
chmod -R uga+rwx /var/www/ 2>>install.log &&
|
||||||
# chmod -R 775 /var/www/
|
# chmod -R 775 /var/www/
|
||||||
@ -131,30 +163,6 @@ a2enmod ssl 2>>install.log &&
|
|||||||
a2enmod proxy 2>>install.log &&
|
a2enmod proxy 2>>install.log &&
|
||||||
a2enmod proxy_http 2>>install.log &&
|
a2enmod proxy_http 2>>install.log &&
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f "/etc/apache2/sites-enabled/cms.conf" ]; then
|
|
||||||
cat <<EOT > "/etc/apache2/sites-enabled/cms.conf"
|
|
||||||
# Listen 8090
|
|
||||||
<VirtualHost *:80>
|
|
||||||
ServerAdmin webmaster@localhost
|
|
||||||
DocumentRoot /var/www/cms/www
|
|
||||||
ErrorLog /var/www/cms/log/error.log
|
|
||||||
CustomLog /var/www/cms/log/access.log combined
|
|
||||||
|
|
||||||
<Directory /var/www/cms/www>
|
|
||||||
Options Indexes FollowSymLinks MultiViews
|
|
||||||
DirectoryIndex index.html index.pl
|
|
||||||
AllowOverride All
|
|
||||||
Require all granted
|
|
||||||
</Directory>
|
|
||||||
<Files ~ "\.(pl|cgi)$">
|
|
||||||
AddHandler cgi-script .pl
|
|
||||||
Options +ExecCGI
|
|
||||||
</Files>
|
|
||||||
</VirtualHost>
|
|
||||||
EOT
|
|
||||||
fi
|
|
||||||
|
|
||||||
systemctl restart apache2 2>>install.log &&
|
systemctl restart apache2 2>>install.log &&
|
||||||
|
|
||||||
echo 'Installation complete'
|
echo 'Installation complete'
|
Loading…
x
Reference in New Issue
Block a user