Fixed script for apache2.4
authorRafał Długołęcki <kontakt@dlugolecki.net.pl>
Mon, 19 Aug 2013 12:35:07 +0000 (14:35 +0200)
committerRafał Długołęcki <kontakt@dlugolecki.net.pl>
Mon, 19 Aug 2013 12:35:07 +0000 (14:35 +0200)
prj-site-make

index 741783cf35f7513b52f56267ceaf6618a9dfb16b..d346be7b3291fc27c104ea528b3c86b7fa67cd64 100755 (executable)
@@ -4,7 +4,8 @@ sql_user = rdlugoleck_${name}
 $(eval sql_password := $(shell pwgen -1 -s 50))
 apache_sites = '/etc/apache2/sites-available'
 project_dir = `pwd`/${name}
-host = ${name}.localhost
+host = ${name}
+host_conf = ${name}.conf
 
 help:
        echo "Usage: prj-site OPERATION NAME [type] "
@@ -37,13 +38,13 @@ create-permissions: create-directories
        echo "> Setting group permissions of {project}/www to www-data, need root permissions to do that."
        sudo chgrp -R www-data ${project_dir}/www
 
-${apache_sites}/${host}:
+${apache_sites}/${host_conf}:
        echo "> Creating project's site configuration"
-       sudo cp ${apache_sites}/dummy.localhost ${apache_sites}/${host}
+       sudo cp ${apache_sites}/dummy.conf ${apache_sites}/${host_conf}
 
-create-vhost: ${apache_sites}/${host
-       sudo sed -e "s/dummy/${name}/g" -i ${apache_sites}/${host}
-       sudo sed -e "s@/var/www/${name}@${project_dir}/www@" -i ${apache_sites}/${host}
+create-vhost: ${apache_sites}/${host_conf}
+       sudo sed -e "s/dummy/${name}/g" -i ${apache_sites}/${host_conf}
+       sudo sed -e "s@/var/www/${name}@${project_dir}/www@" -i ${apache_sites}/${host_conf}
        sudo a2ensite ${host}
        sudo service apache2 reload
 
@@ -54,14 +55,14 @@ remove-directories:
        sudo rm -r ${project_dir}
 
 remove-vhost:
-       if test -f ${apache_sites}/${host}; then \
+       if test -f ${apache_sites}/${host_conf}; then \
          echo "> Removing apache configuration file"; \
-         sudo rm ${apache_sites}/${host}; \
+         sudo rm ${apache_sites}/${host_conf}; \
        fi;
 
 enable: enable-${type}
        echo "[+] Enabling ${name}"
-       if test -f /etc/apache2/sites-available/${host}; then \
+       if test -f ${apache_sites}/${host_conf}; then \
                echo "> Enabling project's vhost..."; \
          sudo a2ensite ${host}; \
          sudo service apache2 reload; \
@@ -103,7 +104,7 @@ symfony2: create-directories create-vhost
        cd ${project_dir} && php composer.phar install
        chmod -R 777 ${project_dir}/app/cache
        chmod -R 777 ${project_dir}/app/logs
-       sudo sed -e "s@${project_dir}/www@${project_dir}/web@" -i ${apache_sites}/${host}
+       sudo sed -e "s@${project_dir}/www@${project_dir}/web@" -i ${apache_sites}/${host_conf}
 
 create-drupal: create-directories
        echo "[+] Drupal installation begins..."