This is an awful hack.
[girocco.git] / install.sh
blob08793bb87ed021a901708e21f41d2389b523f15e
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 . ./shlib.sh
17 echo "*** Setting up basedir..."
18 rm -fr "$cfg_basedir"
19 mkdir -p "$cfg_basedir"
20 cp -a Girocco jobd taskd gitweb html jobs toolbox hooks apache.conf shlib.sh "$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 echo "*** Preprocessing scripts..."
27 perl -I. -M$GIROCCO_CONF -i -pe 's/\@basedir\@/"$Girocco::Config::basedir"/g' "$cfg_basedir"/jobs/*.sh "$cfg_basedir"/jobd/*.sh "$cfg_basedir"/taskd/*.sh "$cfg_basedir"/gitweb/*.sh "$cfg_basedir"/shlib.sh "$cfg_basedir"/hooks/*
30 if [ -n "$cfg_mirror" ]; then
31 echo "--- Remember to start $cfg_basedir/taskd/taskd.pl"
33 if [ -n "$cfg_push" -a "$cfg_permission_control" = "Group" ]; then
34 echo "--- Recommended crontab for root:"
35 echo "*/2 * * * * /usr/bin/nice -n 18 /root/fixupcheck.sh # adjust frequency based on number of repos"
37 echo "--- Also remember to either start $cfg_basedir/jobd/jobd.sh, or add this"
38 echo "--- to the crontab of $cfg_mirror_user (adjust frequency on number of repos):"
39 echo "*/30 * * * * /usr/bin/nice -n 18 $cfg_basedir/jobd/jobd.sh -q --all-once"
42 echo "*** Setting up repository root..."
43 mkdir -p "$cfg_reporoot"
44 if [ "$cfg_owning_group" ]; then
45 chown ."$cfg_owning_group" "$cfg_reporoot" || echo "WARNING: Cannot chgrp $cfg_owning_group $cfg_reporoot"
47 chmod a+rwx,g+s,o+t "$cfg_reporoot" || echo "WARNING: Cannot chmod $cfg_reporoot properly"
50 if [ -n "$cfg_chrooted" ]; then
51 echo "*** Setting up chroot jail for pushing..."
52 if [ "$(id -u)" -eq 0 ]; then
53 ./jailsetup.sh
54 else
55 echo "WARNING: Skipping jail setup, not root"
60 echo "*** Setting up jail configuration (project database)..."
61 mkdir -p "$cfg_chroot" "$cfg_chroot/etc"
62 touch "$cfg_chroot/etc/passwd" "$cfg_chroot/etc/group"
63 owngroup=""
64 [ -z "$cfg_owning_group" ] || owngroup=".$cfg_owning_group"
65 chown "$cfg_cgi_user""$owngroup" "$cfg_chroot/etc" ||
66 echo "WARNING: Cannot chown $cfg_cgi_user.$cfg_owning_group the files"
67 chmod 02775 "$cfg_chroot/etc" || echo "WARNING: Cannot chmod 02775 $cfg_chroot/etc"
70 echo "*** Setting up gitweb from git.git..."
71 if [ ! -f git.git/Makefile ]; then
72 echo "ERROR: git.git is not checked out! Did you _REALLY_ read INSTALL?" >&2
73 exit 1;
77 ######## THIS NEEDS TO BE CHANGED ###########
78 echo "******* APPLYING A GODAWFUL HACK. *******"
79 patch -s -p0 -i mongo-crazy-gitweb-caching-hack.diff
80 #############################################
82 mkdir -p "$cfg_webroot" "$cfg_cgiroot"
83 (cd git.git && make --quiet gitweb/gitweb.cgi && cp gitweb/gitweb.cgi "$cfg_cgiroot" \
84 && cp gitweb/*.png gitweb/*.css gitweb/*.js "$cfg_webroot")
87 echo "*** Setting up git-browser from git-browser.git..."
88 if [ ! -f git-browser.git/git-browser.cgi ]; then
89 echo "ERROR: git-browser.git is not checked out! Did you _REALLY_ read INSTALL?" >&2
90 exit 1;
92 mkdir -p "$cfg_webroot"/git-browser "$cfg_cgiroot"
93 (cd git-browser.git && cp git-browser.cgi "$cfg_cgiroot" \
94 && cp -r *.html *.js *.css js.lib/ JSON/ "$cfg_webroot"/git-browser)
95 ln -sf "$cfg_webroot/git-browser/JSON" "$cfg_cgiroot"
96 cat >"$cfg_cgiroot"/git-browser.conf <<EOT
97 gitbin: $cfg_git_bin
98 warehouse: $cfg_reporoot
99 EOT
100 cat >"$cfg_webroot"/git-browser/GitConfig.js <<EOT
101 cfg_gitweb_url="$cfg_gitweburl/"
102 cfg_browsercgi_url="$cfg_webadmurl/git-browser.cgi"
106 echo "*** Setting up darcs-fast-export from bzr-fastimport.git..."
107 if [ ! -d bzr-fastimport.git/exporters/darcs/ ]; then
108 echo "ERROR: bzr-fastimport.git is not checked out! Did you _REALLY_ read INSTALL?" >&2
109 exit 1;
111 mkdir -p "$cfg_basedir"/bin
112 cp bzr-fastimport.git/exporters/darcs/darcs-fast-export "$cfg_basedir"/bin
115 echo "*** Setting up our part of the website..."
116 mkdir -p "$cfg_webroot" "$cfg_cgiroot"
117 cp cgi/*.cgi gitweb/gitweb_config.perl "$cfg_cgiroot"
118 ln -fs "$cfg_basedir"/Girocco "$cfg_cgiroot"
119 [ -z "$cfg_webreporoot" ] || { rm -f "$cfg_webreporoot" && ln -s "$cfg_reporoot" "$cfg_webreporoot"; }
120 cp gitweb/indextext.html "$cfg_webroot"
121 mv "$cfg_basedir"/html/*.css "$cfg_basedir"/html/*.js "$cfg_webroot"
122 cp mootools.js "$cfg_webroot"
123 cp htaccess "$cfg_webroot/.htaccess"
124 cat gitweb/gitweb.css >>"$cfg_webroot"/gitweb.css