install.sh: Properly setup the mqueuedir
[girocco/susan.git] / install.sh
blobffef3eb5170fb497b140e2cf8b87d1b79020dc15
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/to-clone" "$cfg_mqueuedir/cloning"
29 chown "$cgi_user"."$cfg_owning_group" "$cfg_mqueuedir/to-clone" "$cfg_mqueuedir/cloning" ||
30 echo "WARNING: Cannot chown $cgi_user.$cfg_owning_group the mirroring directories"
31 chmod 02775 "$cfg_mqueuedir/to-clone" "$cfg_mqueuedir/cloning" ||
32 echo "WARNING: Cannot chmod 02775 the mirroring directories"
34 echo "!!! Note that your $cfg_git_bin must know git-mirror; git.git submodule has it but I won't automagically include it"
38 echo "*** Setting up repository root..."
39 mkdir -p "$cfg_reporoot"
40 chown ."$cfg_owning_group" "$cfg_reporoot" || echo "WARNING: Cannot chgrp $cfg_owning_group $cfg_reporoot"
41 chmod a+rwx,g+s,o+t "$cfg_reporoot" || echo "WARNING: Cannot chmod $cfg_reporoot properly"
44 if [ -n "$cfg_chrooted" ]; then
45 echo "*** Setting up chroot jail for pushing..."
46 echo "ERROR: I don't know how to set up a chroot yet!" >&2
50 echo "*** Setting up jail configuration (project database)..."
51 mkdir -p "$cfg_chroot" "$cfg_chroot/etc"
52 touch "$cfg_chroot/etc/passwd" "$cfg_chroot/etc/group"
53 chown "$cgi_user"."$cfg_owning_group" "$cfg_chroot/etc" "$cfg_chroot/etc/passwd" "$cfg_chroot/etc/group" ||
54 echo "WARNING: Cannot chown $cgi_user.$cfg_owning_group the files"
55 chmod 0775 "$cfg_chroot/etc" || echo "WARNING: Cannot chmod 0775 $cfg_chroot/etc"
56 chmod 0664 "$cfg_chroot/etc/passwd" "$cfg_chroot/etc/group" || echo "WARNING: Cannot chmod 0664 the files"
59 echo "*** Setting up gitweb from git.git..."
60 if [ ! -f git.git/Makefile ]; then
61 echo "ERROR: git.git is not checked out! Did you _REALLY_ read INSTALL?" >&2
62 exit 1;
64 mkdir -p "$cfg_webroot" "$cfg_cgiroot"
65 (cd git.git && make gitweb/gitweb.cgi && cp gitweb/gitweb.cgi "$cfg_cgiroot" \
66 && cp gitweb/*.png gitweb/*.css gitweb/*.js "$cfg_webroot")
69 echo "*** Setting up git-browser from git-browser.git..."
70 if [ ! -f git-browser.git/git-browser.cgi ]; then
71 echo "ERROR: git-browser.git is not checked out! Did you _REALLY_ read INSTALL?" >&2
72 exit 1;
74 mkdir -p "$cfg_webroot"/git-browser "$cfg_cgiroot"
75 (cd git-browser.git && cp git-browser.cgi "$cfg_cgiroot" \
76 && cp -r *.html *.js *.css js.lib/ JSON/ "$cfg_webroot"/git-browser)
77 ln -sf "$cfg_webroot/git-browser/JSON" "$cfg_cgiroot"
78 cat >"$cfg_cgiroot"/git-browser.conf <<EOT
79 gitbin: $cfg_git_bin
80 warehouse: $cfg_reporoot
81 EOT
82 cat >"$cfg_webroot"/git-browser/GitConfig.js <<EOT
83 cfg_gitweb_url="$cfg_gitweburl/"
84 cfg_browsercgi_url="$cfg_webadmurl/git-browser.cgi"
85 EOT
88 echo "*** Setting up our part of the website..."
89 mkdir -p "$cfg_webroot" "$cfg_cgiroot"
90 cp cgi/*.cgi gitweb/gitweb_config.perl "$cfg_cgiroot"
91 ln -fs "$cfg_basedir"/Girocco "$cfg_cgiroot"
92 cp gitweb/indextext.html "$cfg_webroot"