fixed assets path every where

This commit is contained in:
Bachir Soussi Chiadmi 2018-04-07 16:13:19 +02:00
parent 0be97f397c
commit 540d964935
6 changed files with 76 additions and 14 deletions

View File

@ -14,6 +14,18 @@ if [ "$EUID" -ne 0 ]; then
exit exit
fi fi
# get the current position
_cwd="$(pwd)"
# check for assets forlder
_assets="$_cwd/assets"
if [ ! -d "$_assets" ]; then
_assets="$_cwd/../assets"
if [ ! -d "$_assets" ]; then
echo "!! can't find assets directory !!"
exit
fi
fi
# http://www.sycha.com/lamp-setup-debian-linux-apache-mysql-php#anchor13 # http://www.sycha.com/lamp-setup-debian-linux-apache-mysql-php#anchor13
sleep 2 sleep 2
apt-get --yes --force-yes install exim4 apt-get --yes --force-yes install exim4
@ -53,7 +65,7 @@ if [ "$installdkim" = "y" ]; then
chown root:Debian-exim /etc/exim4/dkim/"$domain"-private.pem chown root:Debian-exim /etc/exim4/dkim/"$domain"-private.pem
chmod 440 /etc/exim4/dkim/"$domain"-private.pem chmod 440 /etc/exim4/dkim/"$domain"-private.pem
cp "$_cwd"/assets/exima4_dkim.conf /etc/exim4/conf.d/main/00_local_macros cp "$_assets"/exima4_dkim.conf /etc/exim4/conf.d/main/00_local_macros
sed -ir "s/DOMAIN_TO_CHANGE/$domain/g" /etc/exim4/conf.d/main/00_local_macros sed -ir "s/DOMAIN_TO_CHANGE/$domain/g" /etc/exim4/conf.d/main/00_local_macros
sed -ir "s/DATE_TO_CHANGE/$selector/g" /etc/exim4/conf.d/main/00_local_macros sed -ir "s/DATE_TO_CHANGE/$selector/g" /etc/exim4/conf.d/main/00_local_macros

View File

@ -21,6 +21,9 @@ apt-get --yes --force-yes install ufw
# ufw allow ssh # knockd will open the ssh port # ufw allow ssh # knockd will open the ssh port
ufw allow http ufw allow http
ufw allow https ufw allow https
# TODO ask for allowing ssh for some ip
ufw enable ufw enable
ufw status verbose ufw status verbose
echo "\033[92;1mufw installed and firwall configured\033[Om" echo "\033[92;1mufw installed and firwall configured\033[Om"

View File

@ -15,6 +15,17 @@ if [ "$EUID" -ne 0 ]
exit exit
fi fi
# get the current position
_cwd="$(pwd)"
# check for assets forlder
_assets="$_cwd/assets"
if [ ! -d "$_assets" ]; then
_assets="$_cwd/../assets"
if [ ! -d "$_assets" ]; then
echo "!! can't find assets directory !!"
exit
fi
fi
echo "installing proftpd" echo "installing proftpd"
apt-get --yes --force-yes install proftpd apt-get --yes --force-yes install proftpd
@ -32,7 +43,7 @@ fi
done done
echo "Configuring proftpd" echo "Configuring proftpd"
cp "$_cwd"/assets/proftpd.conf /etc/proftpd/conf.d/"$_server_name".conf cp "$_assets"/proftpd.conf /etc/proftpd/conf.d/"$_server_name".conf
sed -ir "s/example/$_server_name/g" /etc/proftpd/conf.d/"$_server_name".conf sed -ir "s/example/$_server_name/g" /etc/proftpd/conf.d/"$_server_name".conf
ufw allow ftp ufw allow ftp

View File

@ -9,10 +9,22 @@ echo -e '\033[35m
/ ____(_) /_ / ____(_) /_
/ / __/ / __/ / / __/ / __/
/ /_/ / / /_ / /_/ / / /_
\____/_/\__/ \____/_/\__/
\033[0m' \033[0m'
echo -e "\033[35;1mCreate new git barre repos and deploy script\033[0m" echo -e "\033[35;1mCreate new git barre repos and deploy script\033[0m"
# get the current position
_cwd="$(pwd)"
# check for assets forlder
_assets="$_cwd/assets"
if [ ! -d "$_assets" ]; then
_assets="$_cwd/../assets"
if [ ! -d "$_assets" ]; then
echo "!! can't find assets directory !!"
exit
fi
fi
while [ "$_bare_name" = "" ] while [ "$_bare_name" = "" ]
do do
@ -56,9 +68,9 @@ git init --bare
# add deploy script # add deploy script
if [ "$_drupal" = "yes" ]; then if [ "$_drupal" = "yes" ]; then
cp "$_cwd"/assets/deploy-drupal.sh "$_prod_folder_path"/deploy.sh cp "$_assets"/deploy-drupal.sh "$_prod_folder_path"/deploy.sh
else else
cp "$_cwd"/assets/deploy-simple.sh "$_prod_folder_path"/deploy.sh cp "$_assets"/deploy-simple.sh "$_prod_folder_path"/deploy.sh
fi fi
# setup git repo on site folder # setup git repo on site folder
@ -69,8 +81,8 @@ git remote add origin /home/"$USER"/git-repositories/"$_bare_name".git
# create hooks that will update the site repo # create hooks that will update the site repo
cd ~ cd ~
cp "$_cwd"/assets/git-pre-receive /home/"$USER"/git-repositories/"$_bare_name".git/hooks/pre-receive cp "$_assets"/git-pre-receive /home/"$USER"/git-repositories/"$_bare_name".git/hooks/pre-receive
cp "$_cwd"/assets/git-post-receive /home/"$USER"/git-repositories/"$_bare_name".git/hooks/post-receive cp "$_assets"/git-post-receive /home/"$USER"/git-repositories/"$_bare_name".git/hooks/post-receive
sed -ir "s/PRODDIR=\"www\"/PRODDIR=$_prod_folder_path/g" /home/"$USER"/git-repositories/"$_bare_name".git/hooks/pre-receive sed -ir "s/PRODDIR=\"www\"/PRODDIR=$_prod_folder_path/g" /home/"$USER"/git-repositories/"$_bare_name".git/hooks/pre-receive
sed -ir "s/PRODDIR=\"www\"/PRODDIR=$_prod_folder_path/g" /home/"$USER"/git-repositories/"$_bare_name".git/hooks/post-receive sed -ir "s/PRODDIR=\"www\"/PRODDIR=$_prod_folder_path/g" /home/"$USER"/git-repositories/"$_bare_name".git/hooks/post-receive

View File

@ -16,11 +16,23 @@ if [ "$EUID" -ne 0 ]; then
exit exit
fi fi
# get the current position
_cwd="$(pwd)"
# check for assets forlder
_assets="$_cwd/assets"
if [ ! -d "$_assets" ]; then
_assets="$_cwd/../assets"
if [ ! -d "$_assets" ]; then
echo "!! can't find assets directory !!"
exit
fi
fi
sleep 2 sleep 2
apt-get --yes --force-yes install knockd apt-get --yes --force-yes install knockd
mv /etc/knockd.conf /etc/knockd.conf.ori mv /etc/knockd.conf /etc/knockd.conf.ori
cp "$_cwd"/assets/knockd.conf /etc/knockd.conf cp "$_assets"/knockd.conf /etc/knockd.conf
echo -n "define a sequence number for opening ssh (as 7000,8000,9000) : " echo -n "define a sequence number for opening ssh (as 7000,8000,9000) : "
read sq read sq
sed -i "s/7000,8000,9000/$sq/g" /etc/knockd.conf sed -i "s/7000,8000,9000/$sq/g" /etc/knockd.conf

View File

@ -15,6 +15,18 @@ if [ "$EUID" -ne 0 ]; then
exit exit
fi fi
# get the current position
_cwd="$(pwd)"
# check for assets forlder
_assets="$_cwd/assets"
if [ ! -d "$_assets" ]; then
_assets="$_cwd/../assets"
if [ ! -d "$_assets" ]; then
echo "!! can't find assets directory !!"
exit
fi
fi
sleep 2 sleep 2
echo -e '\033[35m echo -e '\033[35m
@ -45,13 +57,13 @@ sleep 3
apt-get --yes --force-yes install php7.0-fpm php7.0-mysql php7.0-opcache php7.0-curl php7.0-mbstring php7.0-zip php7.0-xml php7.0-gd php7.0-mcrypt php-memcached apt-get --yes --force-yes install php7.0-fpm php7.0-mysql php7.0-opcache php7.0-curl php7.0-mbstring php7.0-zip php7.0-xml php7.0-gd php7.0-mcrypt php-memcached
mv /etc/php/7.0/fpm/php.ini /etc/php/7.0/fpm/php.ini.back mv /etc/php/7.0/fpm/php.ini /etc/php/7.0/fpm/php.ini.back
cp "$_cwd"/assets/php-fpm.ini /etc/php/7.0/fpm/php.ini cp "$_assets"/php-fpm.ini /etc/php/7.0/fpm/php.ini
echo -e "Configuring PHP" echo -e "Configuring PHP"
mkdir /var/log/php mkdir /var/log/php
chown www-data /var/log/php chown www-data /var/log/php
cp "$_cwd"/assets/logrotate-php /etc/logrotate.d/php cp "$_assets"/logrotate-php /etc/logrotate.d/php
systemctl enable php7.0-fpm systemctl enable php7.0-fpm
systemctl start php7.0-fpm systemctl start php7.0-fpm
@ -77,7 +89,7 @@ echo -e "\033[35;1mInstalling Nginx \033[0m"
sleep 3 sleep 3
apt-get --yes --force-yes install nginx apt-get --yes --force-yes install nginx
mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.ori mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.ori
cp "$_cwd"/assets/default.nginxconf /etc/nginx/sites-available/default cp "$_assets"/default.nginxconf /etc/nginx/sites-available/default
systemctl enable nginx systemctl enable nginx
systemctl restart nginx systemctl restart nginx
@ -94,12 +106,12 @@ echo -e '\033[35m
echo -e "\033[35;1mInstalling phpMyAdmin \033[0m" echo -e "\033[35;1mInstalling phpMyAdmin \033[0m"
apt-get --yes --force-yes install phpmyadmin apt-get --yes --force-yes install phpmyadmin
ln -s /usr/share/phpmyadmin /var/www/html/ ln -s /usr/share/phpmyadmin /var/www/html/
# cp "$_cwd"/assets/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf # cp "$_assets"/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf
# ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf # ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
# echo -e "\033[35;1msecuring phpMyAdmin \033[0m" # echo -e "\033[35;1msecuring phpMyAdmin \033[0m"
# sed -i "s/DirectoryIndex index.php/DirectoryIndex index.php\nAllowOverride all/" # sed -i "s/DirectoryIndex index.php/DirectoryIndex index.php\nAllowOverride all/"
# cp "$_cwd"/assets/phpmyadmin_htaccess > /usr/share/phpmyadmin/.htaccess # cp "$_assets"/phpmyadmin_htaccess > /usr/share/phpmyadmin/.htaccess
# echo -n "define a user name for phpmyadmin : " # echo -n "define a user name for phpmyadmin : "
# read un # read un
# htpasswd -c /etc/phpmyadmin/.htpasswd $un # htpasswd -c /etc/phpmyadmin/.htpasswd $un
@ -206,7 +218,7 @@ echo -e "\033[92;1mDrush and DrupalConsoleinstalled\033[Om"
# # https://www.howtoforge.com/tutorial/server-monitoring-with-munin-and-monit-on-debian/2/ # # https://www.howtoforge.com/tutorial/server-monitoring-with-munin-and-monit-on-debian/2/
# apt-get --yes --force-yes install monit # apt-get --yes --force-yes install monit
# # TODO setup monit rc # # TODO setup monit rc
# cat "$_cwd"/assets/monitrc > /etc/monit/monitrc # cat "$_assets"/monitrc > /etc/monit/monitrc
# #
# # TODO setup webaccess # # TODO setup webaccess
# passok=0 # passok=0