Difference between revisions of "SME Site Maker"
From SME Server
Jump to navigationJump to searchLine 14: | Line 14: | ||
---- | ---- | ||
− | |||
− | + | Code: | |
− | |||
− | |||
− | clear | + | #!/bin/bash |
− | echo "========================================================" | + | |
− | echo "= SME Site Maker Script =" | + | # Author: Normando Hall (PicsOne) |
− | echo "= =" | + | # Version: 1.0 |
− | echo "= This script will configure your SME webserver, and =" | + | # 06/06/2007 |
− | echo "= make the necesary directory to hold your site. =" | + | |
− | echo "= =" | + | clear |
− | echo "= No express or implied warranties are provided and its=" | + | echo "========================================================" |
− | echo "= usage is at your own risk. =" | + | echo "= SME Site Maker Script =" |
− | echo "= =" | + | echo "= =" |
− | echo "= If you feel confortable with the above then press =" | + | echo "= This script will configure your SME webserver, and =" |
− | echo "= enter if not press Ctrl+C to abort the configuration =" | + | echo "= make the necesary directory to hold your site. =" |
− | echo "= script. =" | + | echo "= =" |
− | echo "= =" | + | echo "= No express or implied warranties are provided and its=" |
− | echo "========================================================" | + | echo "= usage is at your own risk. =" |
− | read x | + | echo "= =" |
− | custom_httpd_dir=/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf | + | echo "= If you feel confortable with the above then press =" |
− | clear | + | echo "= enter if not press Ctrl+C to abort the configuration =" |
− | ######################### - Site ROOT - ##################################3 | + | echo "= script. =" |
− | f_root="" | + | echo "= =" |
− | ANSWER=1 | + | echo "========================================================" |
− | while [ $ANSWER = 1 ] | + | read x |
− | do | + | custom_httpd_dir=/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf |
− | + | clear | |
− | + | ######################### - Site ROOT - ##################################3 | |
− | + | f_root="" | |
− | + | ANSWER=1 | |
− | + | while [ $ANSWER = 1 ] | |
− | read files_root | + | do |
− | if [ "$files_root" != "" ] | + | clear |
− | then | + | echo " Please enter a directory name where you put the site files." |
− | f_root=/opt/$files_root | + | echo " The directory is created under /opt dir." |
− | if [ -d $f_root ] | + | echo " Example \"mySite\" without \" \". No include end or trailing slash" |
− | then | + | echo ":" |
− | + | read files_root | |
− | + | if [ "$files_root" != "" ] | |
− | + | then | |
− | + | f_root=/opt/$files_root | |
− | + | if [ -d $f_root ] | |
− | read YESNO | + | then |
− | case "$YESNO" in | + | clear |
− | "Y" | "y" ) | + | echo " This directory already exist. If you want to remove and all contents" |
− | YESNO=1 | + | echo " hit Y, or N to continue without change" |
− | rm -rf $f_root;; | + | echo " (Y/N/Enter)" |
− | "N" | "n" ) | + | echo ":" |
− | YESNO=2;; | + | read YESNO |
− | *) | + | case "$YESNO" in |
− | YESNO=2;; | + | "Y" | "y" ) |
− | esac | + | YESNO=1 |
− | fi | + | rm -rf $f_root;; |
− | ANSWER=0 | + | "N" | "n" ) |
+ | YESNO=2;; | ||
+ | *) | ||
+ | YESNO=2;; | ||
+ | esac | ||
+ | fi | ||
+ | ANSWER=0 | ||
+ | |||
+ | if [ "$YESNO" != "2" ] | ||
+ | then | ||
+ | mkdir -p $f_root | ||
+ | chown root.www $f_root | ||
+ | chmod 644 $f_root | ||
+ | fi | ||
+ | |||
+ | else | ||
+ | clear | ||
+ | echo | ||
+ | echo "You have not enter a directory name. Hit enter to try again" | ||
+ | read x | ||
+ | fi | ||
+ | done | ||
+ | #################### -ALIAS - ###################################### | ||
+ | clear | ||
+ | a_root="" | ||
+ | ANSWER=1 | ||
+ | while [ $ANSWER = 1 ] | ||
+ | do | ||
+ | clear | ||
+ | echo | ||
+ | echo "Please enter an alias name to access your site." | ||
+ | echo "Example \"wiki\" without \" \". No include end or trailing slash" | ||
+ | echo ":" | ||
+ | |||
+ | read alias_root | ||
+ | if [ "$alias_root" != "" ] | ||
+ | then | ||
+ | a_root=/$alias_root | ||
+ | ANSWER=0 | ||
+ | else | ||
+ | clear | ||
+ | echo | ||
+ | echo "You have not provide an alias name. Hit enter to try again" | ||
+ | read x | ||
+ | fi | ||
+ | done | ||
+ | ##################### - SSL - #################################### | ||
+ | clear | ||
+ | f_ssl="" | ||
+ | clear | ||
+ | echo | ||
+ | echo "Do you want to force SSL?" | ||
+ | echo "This is used to force to secure http (https)" | ||
+ | echo "(Y/N/Enter)" | ||
+ | echo ":" | ||
− | + | read YESNO | |
− | + | case "$YESNO" in | |
− | + | "Y" | "y" ) | |
− | + | f_ssl="1";; | |
− | + | "N" | "n" ) | |
− | + | f_ssl="0";; | |
− | + | *) | |
− | + | f_ssl="0";; | |
− | + | esac | |
− | + | ############################ - INDEX - ############################################ | |
− | + | clear | |
− | + | f_idx="" | |
− | + | clear | |
− | + | echo | |
− | ################### | + | echo "Do you want to allow directory index?" |
− | clear | + | echo "This is used to index a directory if no index.htm/l or index.php file is available" |
− | + | echo "(Y/N/Enter)" | |
− | + | echo ":" | |
− | + | read YESNO | |
− | + | case "$YESNO" in | |
− | + | "Y" | "y" ) | |
− | + | f_idx="1";; | |
− | + | "N" | "n" ) | |
− | + | f_idx="0";; | |
− | + | *) | |
− | + | f_idx="0";; | |
− | read | + | esac |
− | + | #################### - AllowOverride - ###################################### | |
− | + | clear | |
− | + | f_aov="" | |
− | + | clear | |
− | + | echo | |
− | + | echo "Do you want to set AllowOverride All?" | |
− | + | echo "This is used to allow process .htaccess files in your site dir" | |
− | + | echo "(Y/N/Enter)" | |
− | + | echo ":" | |
− | + | read YESNO | |
− | + | case "$YESNO" in | |
− | + | "Y" | "y" ) | |
− | clear | + | f_aov="1";; |
− | + | "N" | "n" ) | |
− | + | f_aov="0";; | |
− | + | *) | |
− | + | f_aov="0";; | |
− | + | esac | |
− | + | ####################### - Includes - ################################### | |
− | + | clear | |
− | + | f_inc="" | |
− | read YESNO | + | clear |
− | case "$YESNO" in | + | echo |
− | "Y" | "y" ) | + | echo "Do you want to allow includes?" |
− | + | echo "(Y/N/Enter)" | |
− | "N" | "n" ) | + | echo ":" |
− | + | read YESNO | |
− | *) | + | case "$YESNO" in |
− | + | "Y" | "y" ) | |
− | esac | + | f_inc="1";; |
− | + | "N" | "n" ) | |
− | clear | + | f_inc="0";; |
− | + | *) | |
− | + | f_inc="0";; | |
− | + | esac | |
− | + | ##################### - PHP - ##################################### | |
− | + | clear | |
− | + | php="" | |
− | + | clear | |
− | read YESNO | + | echo |
− | case "$YESNO" in | + | echo "Do you want to execute PHP?" |
− | "Y" | "y" ) | + | echo "(Y/N/Enter)" |
− | + | echo ":" | |
− | "N" | "n" ) | + | read YESNO |
− | + | case "$YESNO" in | |
− | *) | + | "Y" | "y" ) |
− | + | php="1";; | |
− | esac | + | "N" | "n" ) |
− | #################### - | + | php="0";; |
− | clear | + | *) |
− | + | php="0";; | |
− | + | esac | |
− | + | ||
− | + | if [ "$php" = "1" ] | |
− | + | then | |
− | + | clear | |
− | + | echo | |
− | read YESNO | + | echo "Do you want to allow_url_fopen?" |
− | case "$YESNO" in | + | echo "This allow open and access remote files in your php scripts" |
− | "Y" | "y" ) | + | echo "(Y/N/Enter)" |
− | + | echo ":" | |
− | "N" | "n" ) | + | read YESNO |
− | + | case "$YESNO" in | |
− | *) | + | "Y" | "y" ) |
− | + | f_fop="1";; | |
− | esac | + | "N" | "n" ) |
− | + | f_fop="0";; | |
− | + | *) | |
− | + | f_fop="0";; | |
− | + | esac | |
− | + | clear | |
− | + | echo | |
− | + | echo "If you have eaccelerator, want to enabled?" | |
− | + | echo "(Y/N/Enter)" | |
− | read YESNO | + | echo ":" |
− | case "$YESNO" in | + | read YESNO |
− | "Y" | "y" ) | + | case "$YESNO" in |
− | + | "Y" | "y" ) | |
− | "N" | "n" ) | + | f_eac="1";; |
− | + | "N" | "n" ) | |
− | *) | + | f_eac="0";; |
− | + | *) | |
− | esac | + | f_eac="0";; |
− | + | esac | |
− | + | clear | |
− | + | echo | |
− | + | echo "Do you want to allow register globals?" | |
− | + | echo "(Y/N/Enter)" | |
− | + | echo ":" | |
− | + | read YESNO | |
− | + | case "$YESNO" in | |
− | + | "Y" | "y" ) | |
− | + | f_rgl="1";; | |
− | + | "N" | "n" ) | |
− | + | f_rgl="0";; | |
− | + | *) | |
− | + | f_rgl="0";; | |
− | + | esac | |
− | + | fi | |
− | esac | + | ###################### - CGI - ####################################### |
− | + | clear | |
− | + | cgi="" | |
− | + | clear | |
− | + | echo | |
− | + | echo "Do you want to execute CGI?" | |
− | + | echo "(Y/N/Enter)" | |
− | + | echo ":" | |
− | + | read YESNO | |
− | + | case "$YESNO" in | |
− | read YESNO | + | "Y" | "y" ) |
− | case "$YESNO" in | + | cgi="1";; |
− | "Y" | "y" ) | + | "N" | "n" ) |
− | + | cgi="0";; | |
− | "N" | "n" ) | + | *) |
− | + | cgi="0";; | |
− | *) | + | esac |
− | + | ||
− | esac | + | if [ "$cgi" = "1" ] |
− | + | then | |
− | + | ANSWER=1 | |
− | + | while [ $ANSWER = 1 ] | |
− | + | do | |
− | + | clear | |
− | + | echo | |
− | + | echo "Please enter a directory name to hold your cgi scripts." | |
− | " | + | echo "If you don't enter a directory, assume you want to allow cgi scripts in $f_root root directory." |
− | + | echo "If you provide a directory, this is created under $f_root/your_cgi_dir directory" | |
− | "N" | + | echo ":" |
− | + | read cgi_root | |
− | + | if [ "$cgi_root" != "" ] | |
− | + | then | |
− | esac | + | c_root=$f_root/$cgi_root |
− | + | YESNO=1 | |
− | + | if [ -d $c_root ] | |
− | + | then | |
− | + | clear | |
− | + | echo "This directory already exist. If you want to remove and all contents" | |
− | + | echo "hit Y, or N to continue without change" | |
− | + | echo "(Y/N/Enter)" | |
− | + | echo ":" | |
− | + | read YESNO | |
− | " | + | case "$YESNO" in |
− | + | "Y" | "y" ) | |
− | + | YESNO=1 | |
− | + | rm -rf $c_root;; | |
− | + | "N" | "n" ) | |
− | + | YESNO=2;; | |
− | + | *) | |
− | + | YESNO=2;; | |
− | + | esac | |
− | + | fi | |
− | + | ANSWER=0 | |
− | + | ||
− | + | if [ "$YESNO" != "2" ] | |
− | + | then | |
− | read YESNO | + | mkdir -p $c_root |
− | case "$YESNO" in | + | chown root.www $c_root |
− | "Y" | "y" ) | + | chmod 777 $c_root |
− | + | fi | |
− | + | else | |
− | + | ANSWER=0 | |
− | *) | + | c_root=$f_root |
− | + | fi | |
− | esac | + | done |
− | + | ||
− | if [ "$ | + | if [ "$c_root" = "$f_root" ] |
− | then | + | then |
− | + | ca_root=$a_root | |
− | + | chown root.www $ca_root | |
− | + | chmod 777 $ca_root | |
− | + | else | |
− | + | clear | |
− | + | ###################### - CGI ALIAS -######################################### | |
− | + | ca_root="" | |
− | + | ANSWER=1 | |
− | + | while [ $ANSWER = 1 ] | |
− | + | do | |
− | + | clear | |
− | + | echo | |
− | + | echo "Please, provide a cgi alias." | |
− | + | echo ":" | |
− | + | read calias_root | |
− | + | if [ "$calias_root" != "" ] | |
− | + | then | |
− | + | ca_root=/$calias_root | |
− | + | ANSWER=0 | |
− | + | else | |
− | + | clear | |
− | + | echo | |
− | + | echo "You have not enter a cgi alias name. Hit enter to try again" | |
− | " | + | read x |
− | + | fi | |
− | + | done | |
− | " | + | fi |
− | + | fi | |
− | + | #################### - Configuration NAME - ############################################ | |
− | + | clear | |
− | + | c_name="" | |
− | + | ANSWER=1 | |
− | ANSWER=0 | + | while [ $ANSWER = 1 ] |
− | + | do | |
− | + | clear | |
− | + | echo | |
− | + | echo "Please enter a name for this configuration." | |
− | + | echo ":" | |
− | + | read conf_name | |
− | fi | + | if [ "$conf_name" != "" ] |
− | + | then | |
− | + | c_name=99SMESiteMaker_$conf_name | |
− | + | ANSWER=0 | |
− | fi | + | else |
− | + | clear | |
− | + | echo | |
− | + | echo "You have not provide a configuration name. Hit enter to try again" | |
− | + | read x | |
− | + | fi | |
− | + | done | |
− | + | ||
− | + | ||
− | + | ################ - Final Step - #################################### | |
− | ######### | + | c_file=$custom_httpd_dir/$c_name |
− | + | if [ -d $custom_httpd_dir ] | |
− | ANSWER=1 | + | then |
− | while [ $ANSWER = 1 ] | + | custom_httpd_dir=$custom_httpd_dir |
− | do | + | #Anyone know a negate if for check? = if [directory NOT exist $dir] |
− | + | else | |
− | + | mkdir -p $custom_httpd_dir | |
− | + | fi | |
− | + | fopt="" | |
− | read | + | touch $c_file |
− | if [ "$ | + | echo ' ' > $c_file |
− | then | + | echo "Alias $a_root $f_root" >> $c_file |
− | + | if [ "$cgi" = "1" ] | |
− | ANSWER=0 | + | then |
− | else | + | echo "ScriptAlias $ca_root $c_root" >> $c_file |
− | + | fi | |
− | + | echo "<Directory $f_root>" >> $c_file | |
− | + | if [ "$f_ssl" = "1" ] | |
− | read x | + | then |
− | fi | + | echo 'SSLRequireSSL on' >> $c_file |
− | done | + | #echo 'RequireSSL on' >> $c_file #for SME6 |
− | + | fi | |
− | + | if [ "$php" = "1" ] | |
− | + | then | |
− | + | echo 'AddType application/x-httpd-php .php .php3 .phtml' >> $c_file | |
− | c_name | + | fi |
− | + | if [ "$f_idx" = "1" ]||[ "$f_inc" = "1" ]||[ "$f_aov" = "1" ] | |
− | + | then | |
− | + | fopt="Options " | |
− | + | if [ "$f_idx" = "1" ] | |
− | + | then | |
− | + | fopt="$fopt Indexes " | |
− | + | fi | |
− | + | if [ "$f_inc" = "1" ] | |
− | if [ | + | then |
− | + | fopt="$fopt +Includes " | |
− | + | fi | |
− | + | if [ "$f_aov" = "1" ] | |
− | + | then | |
− | + | fopt="$fopt FollowSymLinks " | |
− | + | fi | |
− | + | echo "$fopt" >> $c_file | |
− | + | if [ "$f_aov" = "1" ] | |
− | + | then | |
− | + | echo 'AllowOverride all' >> $c_file | |
− | + | fi | |
− | + | fi | |
− | ## | + | echo 'order deny,allow' >> $c_file |
− | + | echo 'deny from all' >> $c_file | |
− | + | echo 'allow from all' >> $c_file | |
− | then | + | if [ "$php" = "1" ] |
− | + | then | |
− | + | ||
− | + | if [ "$f_fop" = "1" ] | |
− | + | then | |
− | + | echo 'php_flag register_globals on' >> $c_file | |
− | fopt="" | + | else |
− | + | echo 'php_flag register_globals off' >> $c_file | |
− | + | fi | |
− | + | ||
− | if [ "$ | + | if [ "$f_rgl" = "1" ] |
− | then | + | then |
− | + | echo 'php_admin_flag allow_url_fopen on' >> $c_file | |
− | fi | + | else |
− | + | echo 'php_admin_flag allow_url_fopen off' >> $c_file | |
− | if [ "$ | + | fi |
− | then | + | |
− | + | if [ "$f_eac" = "1" ] | |
− | + | then | |
− | + | echo 'php_admin_value eaccelerator.enable 1' >> $c_file | |
− | if [ "$ | + | fi |
− | then | + | |
− | echo ' | + | fi |
− | + | echo '</Directory>' >> $c_file | |
− | + | ||
− | then | + | clear |
− | + | # for debug only | |
− | + | # echo "$files_root" | |
− | + | # echo "$f_root" | |
− | + | # echo "$alias_root" | |
− | fi | + | # echo "$a_root" |
− | if [ "$ | + | # echo "$f_ssl" |
− | then | + | # echo "$f_idx" |
− | + | # echo "$f_aov" | |
− | + | # echo "$f_inc" | |
− | if [ "$ | + | # echo "$php" |
− | then | + | # echo "$f_fop" |
− | + | # echo "$f_eac" | |
− | + | # echo "$f_rgl" | |
− | echo | + | # echo "$cgi" |
− | + | # echo "$cgi_root" | |
− | + | # echo "$c_root" | |
− | echo ' | + | # echo "$calias_root" |
− | + | # echo "$ca_root" | |
− | + | # echo "$conf_name" | |
− | + | # echo "$c_name" | |
− | echo | + | # echo "$custom_httpd_dir" |
− | echo | + | # echo "$c_file" |
− | + | # echo "$fopt" | |
− | + | ||
− | + | expand-template /etc/httpd/conf/httpd.conf | |
− | + | /etc/init.d/httpd-e-smith restart | |
− | + | # /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf # For SME6 | |
− | echo | + | # service httpd restart # For SME6 |
− | + | echo "=====================================================" | |
− | echo | + | echo "= Installation of you site is complete. =" |
− | + | echo "= Now you can copy your site files under $f_root. =" | |
− | + | echo "= Access your site in http://your_domain/$alias_root=" | |
− | + | echo "=====================================================" | |
− | |||
− | echo | ||
− | |||
− | echo | ||
− | |||
− | |||
− | |||
− | |||
− | echo | ||
− | |||
− | |||
− | |||
− | echo | ||
− | |||
− | |||
− | |||
− | |||
− | # echo "$ | ||
− | # echo "$ | ||
− | |||
− | |||
− | # | ||
− | # | ||
− | # | ||
− | # | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | echo "=====================================================" | ||
− | |||
− |
Revision as of 00:00, 7 April 2007
SME Site Maker
This script is designed to help you when create a new web site under /opt directory.
If you improve or add new functions, please update this wiki page.
Your can download from here:
Untar and execute.
Enjoy.
Code:
#!/bin/bash # Author: Normando Hall (PicsOne) # Version: 1.0 # 06/06/2007 clear echo "========================================================" echo "= SME Site Maker Script =" echo "= =" echo "= This script will configure your SME webserver, and =" echo "= make the necesary directory to hold your site. =" echo "= =" echo "= No express or implied warranties are provided and its=" echo "= usage is at your own risk. =" echo "= =" echo "= If you feel confortable with the above then press =" echo "= enter if not press Ctrl+C to abort the configuration =" echo "= script. =" echo "= =" echo "========================================================" read x custom_httpd_dir=/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf clear ######################### - Site ROOT - ##################################3 f_root="" ANSWER=1 while [ $ANSWER = 1 ] do clear echo " Please enter a directory name where you put the site files." echo " The directory is created under /opt dir." echo " Example \"mySite\" without \" \". No include end or trailing slash" echo ":" read files_root if [ "$files_root" != "" ] then f_root=/opt/$files_root if [ -d $f_root ] then clear echo " This directory already exist. If you want to remove and all contents" echo " hit Y, or N to continue without change" echo " (Y/N/Enter)" echo ":" read YESNO case "$YESNO" in "Y" | "y" ) YESNO=1 rm -rf $f_root;; "N" | "n" ) YESNO=2;; *) YESNO=2;; esac fi ANSWER=0 if [ "$YESNO" != "2" ] then mkdir -p $f_root chown root.www $f_root chmod 644 $f_root fi else clear echo echo "You have not enter a directory name. Hit enter to try again" read x fi done #################### -ALIAS - ###################################### clear a_root="" ANSWER=1 while [ $ANSWER = 1 ] do clear echo echo "Please enter an alias name to access your site." echo "Example \"wiki\" without \" \". No include end or trailing slash" echo ":" read alias_root if [ "$alias_root" != "" ] then a_root=/$alias_root ANSWER=0 else clear echo echo "You have not provide an alias name. Hit enter to try again" read x fi done ##################### - SSL - #################################### clear f_ssl="" clear echo echo "Do you want to force SSL?" echo "This is used to force to secure http (https)" echo "(Y/N/Enter)" echo ":"
read YESNO case "$YESNO" in "Y" | "y" ) f_ssl="1";; "N" | "n" ) f_ssl="0";; *) f_ssl="0";; esac ############################ - INDEX - ############################################ clear f_idx="" clear echo echo "Do you want to allow directory index?" echo "This is used to index a directory if no index.htm/l or index.php file is available" echo "(Y/N/Enter)" echo ":" read YESNO case "$YESNO" in "Y" | "y" ) f_idx="1";; "N" | "n" ) f_idx="0";; *) f_idx="0";; esac #################### - AllowOverride - ###################################### clear f_aov="" clear echo echo "Do you want to set AllowOverride All?" echo "This is used to allow process .htaccess files in your site dir" echo "(Y/N/Enter)" echo ":" read YESNO case "$YESNO" in "Y" | "y" ) f_aov="1";; "N" | "n" ) f_aov="0";; *) f_aov="0";; esac ####################### - Includes - ################################### clear f_inc="" clear echo echo "Do you want to allow includes?" echo "(Y/N/Enter)" echo ":" read YESNO case "$YESNO" in "Y" | "y" ) f_inc="1";; "N" | "n" ) f_inc="0";; *) f_inc="0";; esac ##################### - PHP - ##################################### clear php="" clear echo echo "Do you want to execute PHP?" echo "(Y/N/Enter)" echo ":" read YESNO case "$YESNO" in "Y" | "y" ) php="1";; "N" | "n" ) php="0";; *) php="0";; esac if [ "$php" = "1" ] then clear echo echo "Do you want to allow_url_fopen?" echo "This allow open and access remote files in your php scripts" echo "(Y/N/Enter)" echo ":" read YESNO case "$YESNO" in "Y" | "y" ) f_fop="1";; "N" | "n" ) f_fop="0";; *) f_fop="0";; esac clear echo echo "If you have eaccelerator, want to enabled?" echo "(Y/N/Enter)" echo ":" read YESNO case "$YESNO" in "Y" | "y" ) f_eac="1";; "N" | "n" ) f_eac="0";; *) f_eac="0";; esac clear echo echo "Do you want to allow register globals?" echo "(Y/N/Enter)" echo ":" read YESNO case "$YESNO" in "Y" | "y" ) f_rgl="1";; "N" | "n" ) f_rgl="0";; *) f_rgl="0";; esac fi ###################### - CGI - ####################################### clear cgi="" clear echo echo "Do you want to execute CGI?" echo "(Y/N/Enter)" echo ":" read YESNO case "$YESNO" in "Y" | "y" ) cgi="1";; "N" | "n" ) cgi="0";; *) cgi="0";; esac if [ "$cgi" = "1" ] then ANSWER=1 while [ $ANSWER = 1 ] do clear echo echo "Please enter a directory name to hold your cgi scripts." echo "If you don't enter a directory, assume you want to allow cgi scripts in $f_root root directory." echo "If you provide a directory, this is created under $f_root/your_cgi_dir directory" echo ":" read cgi_root if [ "$cgi_root" != "" ] then c_root=$f_root/$cgi_root YESNO=1 if [ -d $c_root ] then clear echo "This directory already exist. If you want to remove and all contents" echo "hit Y, or N to continue without change" echo "(Y/N/Enter)" echo ":" read YESNO case "$YESNO" in "Y" | "y" ) YESNO=1 rm -rf $c_root;; "N" | "n" ) YESNO=2;; *) YESNO=2;; esac fi ANSWER=0 if [ "$YESNO" != "2" ] then mkdir -p $c_root chown root.www $c_root chmod 777 $c_root fi else ANSWER=0 c_root=$f_root fi done if [ "$c_root" = "$f_root" ] then ca_root=$a_root chown root.www $ca_root chmod 777 $ca_root else clear ###################### - CGI ALIAS -######################################### ca_root="" ANSWER=1 while [ $ANSWER = 1 ] do clear echo echo "Please, provide a cgi alias." echo ":" read calias_root if [ "$calias_root" != "" ] then ca_root=/$calias_root ANSWER=0 else clear echo echo "You have not enter a cgi alias name. Hit enter to try again" read x fi done fi fi #################### - Configuration NAME - ############################################ clear c_name="" ANSWER=1 while [ $ANSWER = 1 ] do clear echo echo "Please enter a name for this configuration." echo ":" read conf_name if [ "$conf_name" != "" ] then c_name=99SMESiteMaker_$conf_name ANSWER=0 else clear echo echo "You have not provide a configuration name. Hit enter to try again" read x fi done ################ - Final Step - #################################### c_file=$custom_httpd_dir/$c_name if [ -d $custom_httpd_dir ] then custom_httpd_dir=$custom_httpd_dir #Anyone know a negate if for check? = if [directory NOT exist $dir] else mkdir -p $custom_httpd_dir fi fopt="" touch $c_file echo ' ' > $c_file echo "Alias $a_root $f_root" >> $c_file if [ "$cgi" = "1" ] then echo "ScriptAlias $ca_root $c_root" >> $c_file fi echo "<Directory $f_root>" >> $c_file if [ "$f_ssl" = "1" ] then echo 'SSLRequireSSL on' >> $c_file #echo 'RequireSSL on' >> $c_file #for SME6 fi if [ "$php" = "1" ] then echo 'AddType application/x-httpd-php .php .php3 .phtml' >> $c_file fi if [ "$f_idx" = "1" ]||[ "$f_inc" = "1" ]||[ "$f_aov" = "1" ] then fopt="Options " if [ "$f_idx" = "1" ] then fopt="$fopt Indexes " fi if [ "$f_inc" = "1" ] then fopt="$fopt +Includes " fi if [ "$f_aov" = "1" ] then fopt="$fopt FollowSymLinks " fi echo "$fopt" >> $c_file if [ "$f_aov" = "1" ] then echo 'AllowOverride all' >> $c_file fi fi echo 'order deny,allow' >> $c_file echo 'deny from all' >> $c_file echo 'allow from all' >> $c_file if [ "$php" = "1" ] then if [ "$f_fop" = "1" ] then echo 'php_flag register_globals on' >> $c_file else echo 'php_flag register_globals off' >> $c_file fi if [ "$f_rgl" = "1" ] then echo 'php_admin_flag allow_url_fopen on' >> $c_file else echo 'php_admin_flag allow_url_fopen off' >> $c_file fi if [ "$f_eac" = "1" ] then echo 'php_admin_value eaccelerator.enable 1' >> $c_file fi fi echo '</Directory>' >> $c_file clear # for debug only # echo "$files_root" # echo "$f_root" # echo "$alias_root" # echo "$a_root" # echo "$f_ssl" # echo "$f_idx" # echo "$f_aov" # echo "$f_inc" # echo "$php" # echo "$f_fop" # echo "$f_eac" # echo "$f_rgl" # echo "$cgi" # echo "$cgi_root" # echo "$c_root" # echo "$calias_root" # echo "$ca_root" # echo "$conf_name" # echo "$c_name" # echo "$custom_httpd_dir" # echo "$c_file" # echo "$fopt" expand-template /etc/httpd/conf/httpd.conf /etc/init.d/httpd-e-smith restart # /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf # For SME6 # service httpd restart # For SME6 echo "=====================================================" echo "= Installation of you site is complete. =" echo "= Now you can copy your site files under $f_root. =" echo "= Access your site in http://your_domain/$alias_root=" echo "====================================================="