This repository has been archived by the owner on Dec 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit
executable file
·64 lines (59 loc) · 1.87 KB
/
init
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
62
63
64
#!/bin/sh
nld() {
[ -d $1 -a ! -L $1 ] && [ -n "$(ls $1)" ]
}
maybemkdir() {
if [ -L $1 ]; then rm $1; fi
if [ ! -d $1 ]; then mkdir $1; fi
}
if ( (nld SpongeForge/SpongeCommon && nld SpongeCommon) \
|| (nld SpongeForge/SpongeCommon && nld SpongeVanilla/SpongeCommon) \
|| (nld SpongeCommon && nld SpongeVanilla/SpongeCommon) )
then
echo ERROR: Conflict between SpongeCommon clones.
echo "Please remove all but one of the following directories (this script will create symbolic links between them for you):"
if [ -d SpongeCommon ]; then echo - SpongeCommon; fi
if [ -d SpongeForge/SpongeCommon ]; then echo - SpongeForge/SpongeCommon; fi
if [ -d SpongeVanilla/SpongeCommon ]; then echo - SpongeVanilla/SpongeCommon; fi
exit 1
fi
if [ ! -d SpongeCommon ]
then
if [ -d SpongeForge ]
then
mv SpongeForge/SpongeCommon SpongeCommon
ln -s ../SpongeCommon SpongeForge/SpongeCommon
elif [ -d SpongeVanilla ]
then
mv SpongeVanilla/SpongeCommon SpongeCommon
ln -s ../SpongeCommon SpongeVanilla/SpongeCommon
else
echo Please place a checkout of SpongeForge, SpongeVanilla, or SpongeCommon in the current directory.
exit 1
fi
fi
if [ ! -d SpongeForge ]
then
git clone https://github.com/SpongePowered/SpongeForge.git
fi
cd SpongeForge
maybemkdir SpongeCommon
git config --local submodule.SpongeCommon.path ../SpongeCommon
cd ..
if [ ! -d SpongeVanilla ]
then
echo Cloning SpongeVanilla...
git clone https://github.com/SpongePowered/SpongeVanilla.git
fi
cd SpongeVanilla
maybemkdir SpongeCommon
git config --local submodule.SpongeCommon.path ../SpongeCommon
cd ..
maybemkdir .git/scripts
ln -sf init .git/scripts/post-checkout
maybemkdir gradle
ln -sf ../SpongeCommon/gradle/wrapper gradle/wrapper
ln -sf SpongeCommon/gradlew gradlew
ln -sf SpongeCommon/gradlew.bat gradlew.bat
cp -f gitmodules .gitmodules
echo Initialized checkout of all Sponge repositories.