git.git update: Customizable push URL and ctags script URL
[girocco.git] / install.sh
blob5d53d94176325f1c645a8eaedec79787a61131d9
1 #!/bin/sh
2 # The Girocco installation script
3 # We will OVERWRITE basedir!
5 set -e
7 # What Config should we use?
8 [ -n "$GIROCCO_CONF" ] || GIROCCO_CONF=Girocco::Config
9 echo "*** Initializing using $GIROCCO_CONF..."
11 # First run Girocco::Config consistency checks
12 perl -I. -M$GIROCCO_CONF -e ''
14 . jobs/shlib.sh
17 echo "*** Setting up basedir..."
18 rm -r "$cfg_basedir"
19 mkdir -p "$cfg_basedir"
20 cp -a Girocco gitweb html jobs toolbox apache.conf update-hook "$cfg_basedir"
22 # Put the correct Config in place
23 [ "$GIROCCO_CONF" = "Girocco::Config" ] || cp "$(echo "$GIROCCO_CONF" | sed 's#::#/#g; s/$/.pm/')" "$cfg_basedir/Girocco/Config.pm"
26 if [ -n "$cfg_mirror" ]; then
27 echo "*** Setting up mirror queue..."
28 mkdir -p "$cfg_mqueuedir"
29 chown "$cgi_user"."$cfg_owning_group" "$cfg_mqueuedir" || echo "WARNING: Cannot chown $cgi_user.$cfg_owning_group $cfg_mqueuedir"
30 chmod 02775 "$cfg_mqueuedir" || echo "WARNING: Cannot chmod 02775 $cfg_mqueuedir"
32 echo "!!! Note that your $cfg_git_bin must know git-mirror; git.git submodule has it but I won't automagically include it"
36 echo "*** Setting up repository root..."
37 mkdir -p "$cfg_reporoot"
38 chown ."$cfg_owning_group" "$cfg_reporoot" || echo "WARNING: Cannot chgrp $cfg_owning_group $cfg_reporoot"
39 chmod a+rwx,g+s,o+t "$cfg_reporoot" || echo "WARNING: Cannot chmod $cfg_reporoot properly"
42 if [ -n "$cfg_chrooted" ]; then
43 echo "*** Setting up chroot jail for pushing..."
44 echo "ERROR: I don't know how to set up a chroot yet!" >&2
48 echo "*** Setting up jail configuration (project database)..."
49 mkdir -p "$cfg_chroot" "$cfg_chroot/etc"
50 touch "$cfg_chroot/etc/passwd" "$cfg_chroot/etc/group"
51 chown "$cgi_user"."$cfg_owning_group" "$cfg_chroot/etc" "$cfg_chroot/etc/passwd" "$cfg_chroot/etc/group" ||
52 echo "WARNING: Cannot chown $cgi_user.$cfg_owning_group the files"
53 chmod 0775 "$cfg_chroot/etc" || echo "WARNING: Cannot chmod 0775 $cfg_chroot/etc"
54 chmod 0664 "$cfg_chroot/etc/passwd" "$cfg_chroot/etc/group" || echo "WARNING: Cannot chmod 0664 the files"
57 echo "*** Setting up gitweb from git.git..."
58 if [ ! -f git.git/Makefile ]; then
59 echo "ERROR: git.git is not checked out! Did you _REALLY_ read INSTALL?" >&2
60 exit 1;
62 mkdir -p "$cfg_webroot" "$cfg_cgiroot"
63 (cd git.git && make gitweb/gitweb.cgi && cp gitweb/gitweb.cgi "$cfg_cgiroot" \
64 && cp gitweb/*.png gitweb/*.css gitweb/*.js "$cfg_webroot")
67 echo "*** Setting up git-browser from git-browser.git..."
68 if [ ! -f git-browser.git/git-browser.cgi ]; then
69 echo "ERROR: git-browser.git is not checked out! Did you _REALLY_ read INSTALL?" >&2
70 exit 1;
72 mkdir -p "$cfg_webroot"/git-browser "$cfg_cgiroot"
73 (cd git-browser.git && cp git-browser.cgi "$cfg_cgiroot" \
74 && cp -r *.html *.js *.css js.lib/ JSON/ "$cfg_webroot"/git-browser)
75 ln -sf "$cfg_webroot/git-browser/JSON" "$cfg_cgiroot"
76 cat >"$cfg_cgiroot"/git-browser.conf <<EOT
77 gitbin: $cfg_git_bin
78 warehouse: $cfg_reporoot
79 EOT
80 cat >"$cfg_webroot"/git-browser/GitConfig.js <<EOT
81 cfg_gitweb_url="$cfg_gitweburl/"
82 cfg_browsercgi_url="$cfg_webadmurl/git-browser.cgi"
83 EOT
86 echo "*** Setting up our part of the website..."
87 mkdir -p "$cfg_webroot" "$cfg_cgiroot"
88 cp cgi/*.cgi gitweb/gitweb_config.perl "$cfg_cgiroot"
89 ln -fs "$cfg_basedir"/Girocco "$cfg_cgiroot"
90 cp gitweb/indextext.html "$cfg_webroot"