jailsetup.sh: provide minimal Girocco ssh client config
[girocco/readme.git] / hooks / pre-auto-gc
blob5d3c66eb51d7a243b0cf42af41143a08cf6e6ef1
1 #!/bin/sh
3 # Prevent any gc --auto from taking place
4 # And make $Girocco::Config::autogchack happen
6 # Beware, we MAY be running in a chroot!
8 # If GIROCCO_SUPPRESS_AUTO_GC_UPDATE immediately exit suppressing auto gc
9 [ "${GIROCCO_SUPPRESS_AUTO_GC_UPDATE:-0}" = "0" ] || exit 1
11 # If we're in the chroot immediately exit suppressing auto gc
12 [ -x @perlbin@ ] || exit 1
14 . @basedir@/shlib.sh
16 set -e
18 # Make sure the current directory is where we expect to be
19 [ "${GIT_DIR+set}" != "set" ] || cd "${GIT_DIR:-.}" || exit 1
20 case "${PWD%/*}" in */worktrees)
21 # Gah!
23 # But it COULD just be a coincidence...
24 [ -s commondir ] && [ -s HEAD ] &&
25 _cmndir= && read -r _cmndir <commondir 2>/dev/null &&
26 [ -n "$_cmndir" ] && [ -d "$_cmndir" ]
27 then
28 # ...it is not, fix it!
29 cd "$_cmndir" || exit 1
31 esac
32 [ "${GIT_DIR+set}" != "set" ] || GIT_DIR="."
34 # Get out of the mob
35 case "$PWD" in *?/mob)
36 cd ..
37 GIROCCO_PERSONAL_MOB=1
38 esac
40 umask 002
42 # just in case
43 check_and_set_needsgc
45 _shlib_done=1
46 unset GIROCCO_SUPPRESS_AUTO_GC_UPDATE
47 . "$cfg_basedir/jobd/generate-auto-gc-update.sh"
48 generate_auto_gc_update
50 exit 1