diff --git a/bin/gitbarrerepos.sh b/bin/gitbarrerepos.sh index 057d73c..92689d1 100755 --- a/bin/gitbarrerepos.sh +++ b/bin/gitbarrerepos.sh @@ -4,6 +4,15 @@ # get the current position _cwd="$(pwd)" +echo -e '\033[35m + _______ __ + / ____(_) /_ + / / __/ / __/ +/ /_/ / / /_ +\____/_/\__/ +\033[0m' +echo -e "\033[35;1mCreate new git barre repos and deploy script\033[0m" + while [ "$_bare_name" = "" ] do diff --git a/bin/lemp.sh b/bin/lemp.sh index 6197bff..d757592 100755 --- a/bin/lemp.sh +++ b/bin/lemp.sh @@ -1,6 +1,6 @@ #!/bin/sh -echo '\033[35m +echo -e '\033[35m __ / /__ ____ ___ ____ / / _ \/ __ `__ \/ __ \ @@ -8,16 +8,16 @@ echo '\033[35m /_/\___/_/ /_/ /_/ .___/ /_/ \033[0m' -echo "\033[35;1mLEMP server (Nginx Mysql Php-fpm) \033[0m" +echo -e "\033[35;1mLEMP server (Nginx Mysql Php-fpm) \033[0m" if [ "$EUID" -ne 0 ]; then - echo "Please run as root" + echo -e "Please run as root" exit fi sleep 2 -echo '\033[35m +echo -e '\033[35m __ ___ __ / |/ /_ ___________ _/ / / /|_/ / / / / ___/ __ `/ / @@ -25,29 +25,29 @@ echo '\033[35m /_/ /_/\__, /____/\__, /_/ /____/ /_/ \033[0m' -echo "\033[35;1minstalling Mysql \033[0m" +echo -e "\033[35;1minstalling Mysql \033[0m" sleep 3 apt-get --yes --force-yes install mariadb-server mysql_secure_installation systemctl enable mariadb.service systemctl restart mariadb.service -echo "\033[92;1mmysql installed\033[Om" +echo -e "\033[92;1mmysql installed\033[Om" -echo '\033[35m +echo -e '\033[35m ____ __ ______ / __ \/ / / / __ \ / /_/ / /_/ / /_/ / / ____/ __ / ____/ /_/ /_/ /_/_/ \033[0m' -echo "\033[35;1mInstalling PHP 7.0 \033[0m" +echo -e "\033[35;1mInstalling PHP 7.0 \033[0m" 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 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 -echo "Configuring PHP" +echo -e "Configuring PHP" mkdir /var/log/php chown www-data /var/log/php @@ -56,16 +56,16 @@ cp "$_cwd"/assets/logrotate-php /etc/logrotate.d/php systemctl enable php7.0-fpm systemctl start php7.0-fpm -# echo "Installing memecached" +# echo -e "Installing memecached" # replaced by redis # apt-get --yes --force-yes install memcached # sed -i "s/-m\s64/-m 128/g" /etc/memcached.conf # # systemctl start memcached -echo "\033[92;1mphp installed\033[Om" +echo -e "\033[92;1mphp installed\033[Om" -echo '\033[35m +echo -e '\033[35m _ __ _ / | / /___ _(_)___ _ __ / |/ / __ `/ / __ \| |/_/ @@ -73,7 +73,7 @@ echo '\033[35m /_/ |_/\__, /_/_/ /_/_/|_| /____/ \033[0m' -echo "\033[35;1mInstalling Nginx \033[0m" +echo -e "\033[35;1mInstalling Nginx \033[0m" sleep 3 apt-get --yes --force-yes install nginx mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.ori @@ -81,9 +81,9 @@ cp "$_cwd"/assets/default.nginxconf /etc/nginx/sites-available/default systemctl enable nginx systemctl restart nginx -echo "\033[92;1mNginx installed\033[Om" +echo -e "\033[92;1mNginx installed\033[Om" -echo '\033[35m +echo -e '\033[35m __ __ ___ ___ __ _ ____ / /_ ____ / |/ /_ __/ | ____/ /___ ___ (_)___ / __ \/ __ \/ __ \/ /|_/ / / / / /| |/ __ / __ `__ \/ / __ \ @@ -91,38 +91,38 @@ echo '\033[35m / .___/_/ /_/ .___/_/ /_/\__, /_/ |_\__,_/_/ /_/ /_/_/_/ /_/ /_/ /_/ /____/ \033[0m' -echo "\033[35;1mInstalling phpMyAdmin \033[0m" +echo -e "\033[35;1mInstalling phpMyAdmin \033[0m" apt-get --yes --force-yes install phpmyadmin ln -s /usr/share/phpmyadmin /var/www/html/ # cp "$_cwd"/assets/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf # ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf -# echo "\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/" # cp "$_cwd"/assets/phpmyadmin_htaccess > /usr/share/phpmyadmin/.htaccess # echo -n "define a user name for phpmyadmin : " # read un # htpasswd -c /etc/phpmyadmin/.htpasswd $un # service apache2 restart -echo "\033[92;1mphpMyAdmin installed\033[Om" -echo "\033[92;1mYou can access it at yourip/phpmyadmin\033[Om" +echo -e "\033[92;1mphpMyAdmin installed\033[Om" +echo -e "\033[92;1mYou can access it at yourip/phpmyadmin\033[Om" -echo '\033[35m +echo -e '\033[35m ____ ___ / __ \___ ____/ (_)____ / /_/ / _ \/ __ / / ___/ / _, _/ __/ /_/ / (__ ) /_/ |_|\___/\__,_/_/____/ \033[0m' -echo "\033[35;1mInstalling Redis \033[0m" +echo -e "\033[35;1mInstalling Redis \033[0m" sleep 3 apt-get --yes --force-yes install redis-server php-redis systemctl enable redis-server systemctl restart redis-server -echo "\033[92;1mRedis installed\033[Om" +echo -e "\033[92;1mRedis installed\033[Om" -echo '\033[35m +echo -e '\033[35m ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ @@ -130,39 +130,39 @@ echo '\033[35m \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ \033[0m' -echo "\033[35;1mInstalling Composer \033[0m" +echo -e "\033[35;1mInstalling Composer \033[0m" sleep 3 export COMPOSER_HOME=/usr/local/composer curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -echo "\033[92;1mComposer installed\033[Om" +echo -e "\033[92;1mComposer installed\033[Om" -echo '\033[35m +echo -e '\033[35m ____ __ / __ \_______ _______/ /_ / / / / ___/ / / / ___/ __ \ / /_/ / / / /_/ (__ ) / / / /_____/_/ \__,_/____/_/ /_/ \033[0m' -echo "\033[35;1mInstalling Drush and DrupalConsole\033[0m" +echo -e "\033[35;1mInstalling Drush and DrupalConsole\033[0m" sleep 3 curl https://drupalconsole.com/installer -L -o /usr/local/bin/drupal chmod +x /usr/local/bin/drupal curl https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar -L -o /usr/local/bin/drush chmod +x /usr/local/bin/drush -echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om" +echo -e "\033[92;1mDrush and DrupalConsoleinstalled\033[Om" # TODO supervising -# echo '\033[35m +# echo -e '\033[35m # __ ___ _ __ __ __ ___ _ # / |/ /__ ___ (_) /_ _/_/ / |/ /_ _____ (_)__ # / /|_/ / _ \/ _ \/ / __/ _/_/ / /|_/ / // / _ \/ / _ \ # /_/ /_/\___/_//_/_/\__/ /_/ /_/ /_/\_,_/_//_/_/_//_/ # \033[0m' -# echo "\033[35;1mInstalling Munin \033[0m" +# echo -e "\033[35;1mInstalling Munin \033[0m" # sleep 3 # # https://www.howtoforge.com/tutorial/server-monitoring-with-munin-and-monit-on-debian/ # apt-get --yes --force-yes install munin munin-node munin-plugins-extra @@ -199,9 +199,9 @@ echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om" # # service apache2 restart # service munin-node restart -# echo "\033[92;1mMunin installed\033[Om" +# echo -e "\033[92;1mMunin installed\033[Om" # -# echo "\033[35;1mInstalling Monit \033[0m" +# echo -e "\033[35;1mInstalling Monit \033[0m" # sleep 3 # # https://www.howtoforge.com/tutorial/server-monitoring-with-munin-and-monit-on-debian/2/ # apt-get --yes --force-yes install monit @@ -220,7 +220,7 @@ echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om" # sed -i 's/PASSWD_TO_REPLACE/$passwda/g' /etc/monit/monitrc # passok=1 # else -# echo "pass words don't match, please try again" +# echo -e "pass words don't match, please try again" # fi # done # @@ -228,21 +228,21 @@ echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om" # sed -i "s/server1\.example\.com/$HOSTNAME/g" /etc/monit/monitrc # # mkdir /var/www/html/monit -# echo "hello" > /var/www/html/monit/token +# echo -e "hello" > /var/www/html/monit/token # # service monit start # -# echo "\033[92;1mMonit installed\033[Om" +# echo -e "\033[92;1mMonit installed\033[Om" -# echo '\033[35m +# echo -e '\033[35m # ___ __ __ # / |_ _______/ /_____ _/ /_ # / /| | | /| / / ___/ __/ __ `/ __/ # / ___ | |/ |/ (__ ) /_/ /_/ / /_ # /_/ |_|__/|__/____/\__/\__,_/\__/ # \033[0m' -# echo "\033[35;1mInstalling Awstat \033[0m" +# echo -e "\033[35;1mInstalling Awstat \033[0m" # sleep 3 # apt-get --yes --force-yes install awstats # # Configure AWStats @@ -252,4 +252,4 @@ echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om" # fi # # Disable Awstats from executing every 10 minutes. Put a hash in front of any line. # sed -i 's/^[^#]/#&/' /etc/cron.d/awstats -# echo "\033[92;1mAwstat installed\033[Om" +# echo -e "\033[92;1mAwstat installed\033[Om" diff --git a/bin/user.sh b/bin/user.sh index 8d0837d..817ec98 100755 --- a/bin/user.sh +++ b/bin/user.sh @@ -1,13 +1,13 @@ #!/bin/sh -echo '\033[35m +echo -e '\033[35m __ _______ __________ / / / / ___// ____/ __ \ / / / /\__ \/ __/ / /_/ / / /_/ /___/ / /___/ _, _/ \____//____/_____/_/ |_| \033[0m' -echo "\033[35;1mCreate new user (you will be asked a user name and a password) \033[0m" +echo -e "\033[35;1mCreate new user (you will be asked a user name and a password) \033[0m" if [ "$EUID" -ne 0 ]; then echo "Please run as root" @@ -45,4 +45,4 @@ groupadd admin usermod -a -G admin "$user" # allow admin group to su dpkg-statoverride --update --add root admin 4750 /bin/su -echo "\033[92;1muser $user configured\033[Om" +echo -e "\033[92;1muser $user configured\033[Om" diff --git a/bin/vhost.sh b/bin/vhost.sh index 9c5b891..072b0e4 100755 --- a/bin/vhost.sh +++ b/bin/vhost.sh @@ -1,12 +1,12 @@ -echo '\033[35m +echo -e '\033[35m __ __ _ __/ /_ ____ _____/ /_ | | / / __ \/ __ \/ ___/ __/ | |/ / / / / /_/ (__ ) /_ |___/_/ /_/\____/____/\__/ \033[0m' -echo "\033[35;1mNginx VHOST install \033[0m" +echo -e "\033[35;1mNginx VHOST install \033[0m" while [ "$vh" != "y" ] && [ "$vh" != "n" ] do echo -n "Should we install a vhost? [y|n] " @@ -38,8 +38,8 @@ if [ "$vh" = "y" ]; then # ask for let's encrypt while [ "$_letsencrypt" != "yes" ] && [ "$_letsencrypt" != "no" ] do - echo "Let's encrypt" - echo "Let's encrypt needs a public registered domain name with proper DNS records ( A records or CNAME records for subdomains pointing to your server)." + echo -e "Let's encrypt" + echo -e "Let's encrypt needs a public registered domain name with proper DNS records ( A records or CNAME records for subdomains pointing to your server)." echo -n "Should we install let's encrypt certificate with $_domain? [yes|no] " read _letsencrypt done @@ -53,7 +53,7 @@ if [ "$vh" = "y" ]; then # TODO renewing touch /var/spool/crontab/root crontab -l > mycron - echo "0 3 * * * certbot renew --pre-hook 'systemctl stop nginx' --post-hook 'systemctl start nginx' --cert-name $_domain" >> mycron + echo -e "0 3 * * * certbot renew --pre-hook 'systemctl stop nginx' --post-hook 'systemctl start nginx' --cert-name $_domain" >> mycron crontab mycron rm mycron fi @@ -105,14 +105,14 @@ if [ "$vh" = "y" ]; then user="" fi else - echo "user $user doesn't exists, you must provide an existing user" + echo -e "user $user doesn't exists, you must provide an existing user" user="" fi fi done fi - echo "shortcut will be installed for '$user'"; + echo -e "shortcut will be installed for '$user'"; sleep 3 mkdir /home/"$user"/www/ @@ -120,14 +120,14 @@ if [ "$vh" = "y" ]; then ln -s /var/www/"$_domain" /home/"$user"/www/"$_domain" else - echo 'no shortcut installed' + echo -e 'no shortcut installed' fi # activate the vhost ln -s /etc/nginx/sites-available/"$_domain".conf /etc/nginx/sites-enabled/"$_domain".conf # restart nginx systemctl restart nginx - echo "\033[92;1mvhost $_domain configured\033[Om" + echo -e "\033[92;1mvhost $_domain configured\033[Om" else - echo "Vhost installation aborted" + echo -e "Vhost installation aborted" fi diff --git a/install-debian-server.sh b/install-debian-server.sh index 3821d94..050d02e 100755 --- a/install-debian-server.sh +++ b/install-debian-server.sh @@ -5,7 +5,7 @@ # http://web-74.com/blog/reseaux/gerer-le-deploiement-facilement-avec-git/ # -echo '\033[35m +echo -e '\033[35m ____ __ _ _____ / __ \___ / /_ (_)___ _____ / ___/___ ______ _____ _____ / / / / _ \/ __ \/ / __ `/ __ \ \__ \/ _ \/ ___/ | / / _ \/ ___/ @@ -13,10 +13,10 @@ echo '\033[35m /_____/\___/_.___/_/\__,_/_/ /_/ /____/\___/_/ |___/\___/_/ \033[0m' -echo "\033[35;1mThis script has been tested only on Linux Debian 9 \033[0m" +echo -e "\033[35;1mThis script has been tested only on Linux Debian 9 \033[0m" if [ "$EUID" -ne 0 ]; then - echo "Please run as root" + echo -e "Please run as root" exit fi @@ -24,7 +24,7 @@ echo -n "Should we start? [Y|n] " read yn yn=${yn:-y} if [ "$yn" != "y" ]; then - echo "aborting script!" + echo -e "aborting script!" exit fi @@ -48,7 +48,7 @@ done if [ "$securssh" = "yes" ]; then . bin/ssh.sh else - echo 'root user can still conect through ssh' + echo -e 'root user can still conect through ssh' fi @@ -58,7 +58,7 @@ yn=${yn:-y} if [ "$yn" = "y" ]; then . bin/ftp.sh else - echo 'ftp server not installed' + echo -e 'ftp server not installed' fi while [ "$lemp" != "yes" ] && [ "$lemp" != "no" ] @@ -69,7 +69,7 @@ done if [ "$lemp" = "yes" ]; then . bin/lemp.sh else - echo 'lemp server not installed' + echo -e 'lemp server not installed' fi . bin/vhost.sh @@ -77,7 +77,7 @@ fi . bin/dotfiles.sh . bin/autoupdate.sh -# echo '\033[35m +# echo -e '\033[35m # ______________ _______ # /_ __/ ____/ |/ / __ \ # / / / __/ / /|_/ / /_/ / @@ -107,7 +107,7 @@ fi # mount -t tmpfs -o rw,noexec,nosuid tmpfs /tmp # chmod 1777 /tmp -# echo "tmpfs /tmp tmpfs rw,noexec,nosuid 0 0" >> /etc/fstab +# echo -e "tmpfs /tmp tmpfs rw,noexec,nosuid 0 0" >> /etc/fstab # # Restore /tmp # cp -Rpf /tmpbackup/* /tmp/ >/dev/null 2>&1 @@ -140,11 +140,11 @@ fi -echo '\033[35m +echo -e '\033[35m __ ___ ____ ____/ / / _ \/ __ \/ __ / / __/ / / / /_/ / \___/_/ /_/\__,_/ \033[0m' -echo "\033[35;1m* * script done * * \033[0m" +echo -e "\033[35;1m* * script done * * \033[0m"