]> git.ipfire.org Git - thirdparty/systemd.git/blob - tools/git-setup.sh
mkosi: Make system dependencies conditional on format
[thirdparty/systemd.git] / tools / git-setup.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 set -eu
4
5 cd "${MESON_SOURCE_ROOT:?}"
6
7 if [ -e .git ]; then
8 git config submodule.recurse true
9 git config fetch.recurseSubmodules on-demand
10 git config push.recurseSubmodules no
11 fi
12
13 ret=2
14
15 if [ -f .git/hooks/pre-commit.sample ] && [ ! -f .git/hooks/pre-commit ]; then
16 cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit
17 chmod +x .git/hooks/pre-commit
18 echo 'Activated pre-commit hook'
19 ret=0
20 fi
21
22 if [ ! -f .git/hooks/post-rewrite ]; then
23 cp -p tools/git-submodule-update-hook.sh .git/hooks/post-rewrite
24 echo 'Activated post-rewrite hook'
25 ret=0
26 fi
27
28 if [ ! -f .git/hooks/post-checkout ]; then
29 cp -p tools/git-submodule-update-hook.sh .git/hooks/post-checkout
30 echo 'Activated post-checkout hook'
31 ret=0
32 fi
33
34 exit $ret