Browse Source

made configshell usable as a module call

Nathaniel van Diepen 9 years ago
parent
commit
f978563253
1 changed files with 22 additions and 15 deletions
  1. 22 15
      configshell

+ 22 - 15
configshell

@@ -33,29 +33,36 @@ addsite(){
 		fi;
 		mkdir -p "$path";
 		echo "<VirtualHost *:80>
-		ServerName $2
-		DocumentRoot $path
-		<Directory $path>
-			Options +ExecCGI +Indexes +FollowSymLinks +MultiViews
-			AllowOverride All
-			RewriteEngine On
-			Order allow,deny
-			allow from all
-		</Directory>
-		ErrorLog ${APACHE_LOG_DIR}/error.log
-		CustomLog ${APACHE_LOG_DIR}/access.log combined
-		ServerAdmin [email protected]
-	</VirtualHost>" > /etc/apache2/sites-available/$1.conf;
+	ServerName $2
+	DocumentRoot $path
+	<Directory $path>
+		Options +ExecCGI +Indexes +FollowSymLinks +MultiViews
+		AllowOverride All
+		RewriteEngine On
+		Order allow,deny
+		allow from all
+	</Directory>
+	ErrorLog ${APACHE_LOG_DIR}/error.log
+	CustomLog ${APACHE_LOG_DIR}/access.log combined
+	ServerAdmin [email protected]
+</VirtualHost>" > /etc/apache2/sites-available/$1.conf;
 		echo "Created site $1 ($2) at $path";
 		a2ensite $1;
 		sudo service apache2 reload;
 	fi;
 }
 while true; do
-	echo -ne "$c_bold$(whoami)@$(pwd)>$c_norm ";
-	read input;
+	if [[ "$@" == "" ]];then
+		echo -ne "$c_bold$(whoami)@$(pwd)>$c_norm ";
+		read input;
+	else
+		input="$@";
+	fi;
 	case "$input" in
 		*)
 			eval "$input";
 	esac;
+	if [[ "$@" != "" ]];then
+		exit;
+	fi;
 done;