2 # The Girocco installation script
3 # We will OVERWRITE basedir!
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 ''
17 echo "*** Setting up basedir..."
19 mkdir
-p "$cfg_basedir"
20 cp -a Girocco gitweb html
jobs toolbox apache.conf shlib.sh 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 echo "*** Preprocessing scripts..."
27 perl
-I.
-M$GIROCCO_CONF -i -pe 's/\@basedir\@/"$Girocco::Config::basedir"/g' "$cfg_basedir"/jobs
/*.sh
"$cfg_basedir"/shlib.sh
"$cfg_basedir"/update-hook
30 if [ -n "$cfg_mirror" ]; then
31 echo "*** Setting up mirror queue..."
32 mkdir
-p "$cfg_mqueuedir/to-clone" "$cfg_mqueuedir/cloning"
33 chown
"$cgi_mirror_user".
"$cfg_owning_group" "$cfg_mqueuedir/to-clone" "$cfg_mqueuedir/cloning" ||
34 echo "WARNING: Cannot chown $cgi_mirror_user.$cfg_owning_group the mirroring directories"
35 chmod 02775 "$cfg_mqueuedir/to-clone" "$cfg_mqueuedir/cloning" ||
36 echo "WARNING: Cannot chmod 02775 the mirroring directories"
38 if [ ! -x "$($cfg_git_bin --exec-path)/git-mirror" ]; then
39 echo "ERROR: Your $cfg_git_bin does not know about git-mirror; git.git submodule has it but you need to install it manually"
41 echo "--- Recommended crontab for $cfg_mirror_user:"
42 echo "*/1 * * * * /usr/bin/nice -n 18 $cfg_basedir/jobs/clonecheck.sh"
43 echo "*/10 * * * * /usr/bin/nice -n 18 $cfg_basedir/jobs/updatecheck.sh # adjust frequency based on number of repos"
44 elif [ "$cfg_permission_control" = "Group" ]; then
45 echo "--- Recommended crontab for root:"
46 echo "*/2 * * * * /usr/bin/nice -n 18 /root/fixupcheck.sh # adjust frequency based on number of repos"
50 echo "*** Setting up repository root..."
51 mkdir
-p "$cfg_reporoot"
52 chown .
"$cfg_owning_group" "$cfg_reporoot" ||
echo "WARNING: Cannot chgrp $cfg_owning_group $cfg_reporoot"
53 chmod a
+rwx
,g
+s
,o
+t
"$cfg_reporoot" ||
echo "WARNING: Cannot chmod $cfg_reporoot properly"
56 if [ -n "$cfg_chrooted" ]; then
57 echo "*** Setting up chroot jail for pushing..."
58 echo "ERROR: I don't know how to set up a chroot yet!" >&2
62 echo "*** Setting up jail configuration (project database)..."
63 mkdir
-p "$cfg_chroot" "$cfg_chroot/etc"
64 chown
"$cgi_user".
"$cfg_owning_group" "$cfg_chroot/etc" ||
65 echo "WARNING: Cannot chown $cgi_user.$cfg_owning_group the files"
66 chmod 02775 "$cfg_chroot/etc" ||
echo "WARNING: Cannot chmod 02775 $cfg_chroot/etc"
69 echo "*** Setting up gitweb from git.git..."
70 if [ ! -f git.git
/Makefile
]; then
71 echo "ERROR: git.git is not checked out! Did you _REALLY_ read INSTALL?" >&2
74 mkdir
-p "$cfg_webroot" "$cfg_cgiroot"
75 (cd git.git
&& make --quiet gitweb
/gitweb.cgi
&& cp gitweb
/gitweb.cgi
"$cfg_cgiroot" \
76 && cp gitweb
/*.png gitweb
/*.css gitweb
/*.js
"$cfg_webroot")
79 echo "*** Setting up git-browser from git-browser.git..."
80 if [ ! -f git-browser.git
/git-browser.cgi
]; then
81 echo "ERROR: git-browser.git is not checked out! Did you _REALLY_ read INSTALL?" >&2
84 mkdir
-p "$cfg_webroot"/git-browser
"$cfg_cgiroot"
85 (cd git-browser.git
&& cp git-browser.cgi
"$cfg_cgiroot" \
86 && cp -r *.html
*.js
*.css js.lib
/ JSON
/ "$cfg_webroot"/git-browser
)
87 ln -sf "$cfg_webroot/git-browser/JSON" "$cfg_cgiroot"
88 cat >"$cfg_cgiroot"/git-browser.conf
<<EOT
90 warehouse: $cfg_reporoot
92 cat >"$cfg_webroot"/git-browser
/GitConfig.js
<<EOT
93 cfg_gitweb_url="$cfg_gitweburl/"
94 cfg_browsercgi_url="$cfg_webadmurl/git-browser.cgi"
98 echo "*** Setting up our part of the website..."
99 mkdir
-p "$cfg_webroot" "$cfg_cgiroot"
100 cp cgi
/*.cgi gitweb
/gitweb_config.perl
"$cfg_cgiroot"
101 ln -fs "$cfg_basedir"/Girocco
"$cfg_cgiroot"
102 cp gitweb
/indextext.html
"$cfg_webroot"