3 # ----------------------------------------------------------------------
4 # please do not even LOOK at this file without reading doc/http.mkd
5 # ----------------------------------------------------------------------
7 die
() { echo "$@"; exit 1; }
9 # scare the sh*t out of people who run it blindly
10 [ -f /tmp
/gitolite-smart-http-test-OK
] ||
{
13 # lots of disk activity
14 find / >/dev
/null
2>/dev
/null
15 # and it he's still clueless, God bless!
16 echo 'root file system erased successfully. Goodbye and God bless!'
20 # ----------------------------------------------------------------------
21 # are we *BSD or Linux?
22 uname_s
=`uname -s` # could be Linux or FreeBSD or some other BSD
23 if [ "$uname_s" = "Linux" ]
30 # ----------------------------------------------------------------------
33 [ $EUID = 0 ] || die
"you must run this as root"
35 # delete any existing apache conf for gitolite
36 $lnx rm /etc
/httpd
/conf.d
/gitolite.conf
37 $bsd rm /usr
/local
/etc
/apache24
/Includes
/gitolite.conf
39 # build your "home within a home"
41 $bsd rm -rf /tmp
/usr.share.httpd
42 $bsd mkdir
-p /tmp
/usr.share.httpd
43 $bsd chown www
:www
/tmp
/usr.share.httpd
44 $bsd cd /tmp
/usr.share.httpd
48 export GITOLITE_HTTP_HOME
=$PWD/gitolite-home
50 # get the gitolite sources
52 git clone
/tmp
/gitolite.git gitolite-source
53 # NOTE: I use a bare repo in /tmp for convenience; you'd use
54 # 'git://github.com/sitaramc/gitolite'
56 # make the bin directory, and add it to PATH
58 mkdir
$GITOLITE_HTTP_HOME/bin
59 .
/install -ln $GITOLITE_HTTP_HOME/bin
60 export PATH
=$PATH:$GITOLITE_HTTP_HOME/bin
62 # come back to base, then run setup. Notice that you have to point HOME to
63 # the right place, even if it is just for this command
64 cd $GITOLITE_HTTP_HOME
65 HOME
=$GITOLITE_HTTP_HOME gitolite setup
-a admin
67 # insert some essential lines at the beginning of the rc file
68 echo '$ENV{PATH} .= ":$ENV{GITOLITE_HTTP_HOME}/bin";' >> 1
74 $lnx chown
-R apache
:apache
$GITOLITE_HTTP_HOME
75 $bsd chown
-R www
:www
$GITOLITE_HTTP_HOME
77 # create the apache config. Note the trailing slashes on the 2 ScriptAlias
78 # lines. (The second one is optional for most sites). NOTE: you also need to
79 # give the AuthUserFile a better name/location than what I have below.
81 SetEnv GIT_PROJECT_ROOT $GITOLITE_HTTP_HOME/repositories
82 ScriptAlias /git/ $GITOLITE_HTTP_HOME/gitolite-source/src/gitolite-shell/
83 ScriptAlias /gitmob/ $GITOLITE_HTTP_HOME/gitolite-source/src/gitolite-shell/
84 SetEnv GITOLITE_HTTP_HOME $GITOLITE_HTTP_HOME
85 SetEnv GIT_HTTP_EXPORT_ALL
89 AuthName "Private Git Access"
91 AuthUserFile $GITOLITE_HTTP_HOME/gitolite-http-authuserfile
94 $lnx mv 1 /etc
/httpd
/conf.d
/gitolite.conf
95 $bsd mv 1 /usr
/local
/etc
/apache24
/Includes
/gitolite.conf
97 # NOTE: this is for testing only
98 htpasswd
-bc $GITOLITE_HTTP_HOME/gitolite-http-authuserfile admin admin
99 map
"htpasswd -b $GITOLITE_HTTP_HOME/gitolite-http-authuserfile % %" u
{1.
.6}
100 $lnx chown apache
:apache
$GITOLITE_HTTP_HOME/gitolite-http-authuserfile
101 $bsd chown www
:www
$GITOLITE_HTTP_HOME/gitolite-http-authuserfile
103 # restart httpd to make it pick up all the new stuff
104 $lnx service httpd restart
105 $bsd /usr
/local
/etc
/rc.d
/apache24 restart