-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathb2code-local
executable file
·61 lines (53 loc) · 1.53 KB
/
b2code-local
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# check for help option
if [ "$1" = "--help" -o "$1" = "-h" -o "$1" = "-?" ]; then
echo
echo "Usage: `basename $0` [--light]"
echo
echo "- This command converts a directory with a local+central setup"
echo " to a fully local setup."
echo "- If the --light option is used a local light release is set up."
echo
exit 0
fi
# check for light option
LIGHT=0
if [ "$1" = "--light" ]; then
LIGHT=1
shift
fi
# check number of arguments
if [ $# -gt 0 ]; then
echo "Usage: `basename $0` [--light]" 1>&2
exit 1
fi
# check that we are in a local release directory
if [ ! -f .release ]; then
echo "Error: not in a local release directory" 1>&2
exit 1
fi
# check that we have a setup with central release
RELEASE=`cat .release`
if [ "${RELEASE}" = "head" ]; then
echo "Error: the current directory already contains a fully local release" 1>&2
exit 1
fi
# update .release and sparse checkout file
echo "head" > .release
if [ "${LIGHT}" == "1" ]; then
echo "/.light" >> .git/info/sparse-checkout
git checkout -- .light
rm -f .git/info/sparse-checkout
ln -s ${PWD}/.light .git/info/sparse-checkout
else
echo "/*" >> .git/info/sparse-checkout
for PACKAGE in ${BELLE2_EXCLUDE_PACKAGES}; do
echo "!/${PACKAGE}/" >> .git/info/sparse-checkout
done
fi
# remove links to central release directory and check out all packages
rm -rf .externals site_scons
git checkout
# inform user about successful completion
echo "The directory ${PWD} was converted to a fully local release."
echo "-> update the environment: b2setup"