提交 5dc6411e 编写于 作者: J Junio C Hamano

Merge branch 'instaweb' of git://bogomips.org/git-svn

* 'instaweb' of git://bogomips.org/git-svn:
  git-instaweb: Check that correct config file exists for (re)start
  git-instaweb: Move all actions at the end of script
  git-instaweb: Use $conf, not $fqgitdir/gitweb/httpd.conf
  git-instaweb: Extract configuring web server into configure_httpd
...@@ -51,8 +51,8 @@ OPTIONS ...@@ -51,8 +51,8 @@ OPTIONS
start:: start::
--start:: --start::
Start the httpd instance and exit. This does not generate Start the httpd instance and exit. Regenerate configuration files
any of the configuration files for spawning a new instance. as necessary for spawning a new instance.
stop:: stop::
--stop:: --stop::
...@@ -62,8 +62,8 @@ stop:: ...@@ -62,8 +62,8 @@ stop::
restart:: restart::
--restart:: --restart::
Restart the httpd instance and exit. This does not generate Restart the httpd instance and exit. Regenerate configuration files
any of the configuration files for spawning a new instance. as necessary for spawning a new instance.
CONFIGURATION CONFIGURATION
------------- -------------
......
...@@ -27,6 +27,7 @@ httpd="$(git config --get instaweb.httpd)" ...@@ -27,6 +27,7 @@ httpd="$(git config --get instaweb.httpd)"
root="$(git config --get instaweb.gitwebdir)" root="$(git config --get instaweb.gitwebdir)"
port=$(git config --get instaweb.port) port=$(git config --get instaweb.port)
module_path="$(git config --get instaweb.modulepath)" module_path="$(git config --get instaweb.modulepath)"
action="browse"
conf="$GIT_DIR/gitweb/httpd.conf" conf="$GIT_DIR/gitweb/httpd.conf"
...@@ -98,12 +99,18 @@ start_httpd () { ...@@ -98,12 +99,18 @@ start_httpd () {
# here $httpd should have a meaningful value # here $httpd should have a meaningful value
resolve_full_httpd resolve_full_httpd
mkdir -p "$fqgitdir/gitweb/$httpd_only"
conf="$fqgitdir/gitweb/$httpd_only.conf"
# generate correct config file if it doesn't exist
test -f "$conf" || configure_httpd
test -f "$fqgitdir/gitweb/gitweb_config.perl" || gitweb_conf
# don't quote $full_httpd, there can be arguments to it (-f) # don't quote $full_httpd, there can be arguments to it (-f)
case "$httpd" in case "$httpd" in
*mongoose*|*plackup*) *mongoose*|*plackup*)
#These servers don't have a daemon mode so we'll have to fork it #These servers don't have a daemon mode so we'll have to fork it
$full_httpd "$fqgitdir/gitweb/httpd.conf" & $full_httpd "$conf" &
#Save the pid before doing anything else (we'll print it later) #Save the pid before doing anything else (we'll print it later)
pid=$! pid=$!
...@@ -117,7 +124,7 @@ $pid ...@@ -117,7 +124,7 @@ $pid
EOF EOF
;; ;;
*) *)
$full_httpd "$fqgitdir/gitweb/httpd.conf" $full_httpd "$conf"
if test $? != 0; then if test $? != 0; then
echo "Could not execute http daemon $httpd." echo "Could not execute http daemon $httpd."
exit 1 exit 1
...@@ -148,17 +155,13 @@ while test $# != 0 ...@@ -148,17 +155,13 @@ while test $# != 0
do do
case "$1" in case "$1" in
--stop|stop) --stop|stop)
stop_httpd action="stop"
exit 0
;; ;;
--start|start) --start|start)
start_httpd action="start"
exit 0
;; ;;
--restart|restart) --restart|restart)
stop_httpd action="restart"
start_httpd
exit 0
;; ;;
-l|--local) -l|--local)
local=true local=true
...@@ -587,33 +590,54 @@ our \$projects_list = \$projectroot; ...@@ -587,33 +590,54 @@ our \$projects_list = \$projectroot;
EOF EOF
} }
gitweb_conf configure_httpd() {
case "$httpd" in
resolve_full_httpd *lighttpd*)
mkdir -p "$fqgitdir/gitweb/$httpd_only" lighttpd_conf
;;
*apache2*|*httpd*)
apache2_conf
;;
webrick)
webrick_conf
;;
*mongoose*)
mongoose_conf
;;
*plackup*)
plackup_conf
;;
*)
echo "Unknown httpd specified: $httpd"
exit 1
;;
esac
}
case "$httpd" in case "$action" in
*lighttpd*) stop)
lighttpd_conf stop_httpd
;; exit 0
*apache2*|*httpd*)
apache2_conf
;;
webrick)
webrick_conf
;; ;;
*mongoose*) start)
mongoose_conf start_httpd
exit 0
;; ;;
*plackup*) restart)
plackup_conf stop_httpd
;; start_httpd
*) exit 0
echo "Unknown httpd specified: $httpd"
exit 1
;; ;;
esac esac
gitweb_conf
resolve_full_httpd
mkdir -p "$fqgitdir/gitweb/$httpd_only"
conf="$fqgitdir/gitweb/$httpd_only.conf"
configure_httpd
start_httpd start_httpd
url=http://127.0.0.1:$port url=http://127.0.0.1:$port
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册