forked from rscustom/rocksmith-custom-song-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprebuild.sh
32 lines (31 loc) · 822 Bytes
/
prebuild.sh
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
#!/bin/bash
solution=$1
toolkitver=$2
echo Checking for .git/HEAD...
rev=nongit
if [ -e "$solution/.git/HEAD" ]
then
echo Reading .git/HEAD...
head=$(<"$solution/.git/HEAD")
if [ ${head::4} == "ref:" ]
then
echo Reading .git/${head:5}...
if [ -e "$solution/.git/${head:5}" ]; then commit=$(<"$solution/.git/${head:5}"); fi
else
commit=$head
fi
if [ -n "$commit" ]
then
echo Found commit: $commit
rev=${commit::8}
else
echo Unable to find commit
fi
fi
echo Reading ToolkitVersion.cs_dist...
origstr=00000000
cp -f "${toolkitver}_dist" "$toolkitver"
echo Writing ToolkitVersion.cs...
sed -ie "s/$origstr/$rev/g" "$toolkitver"
echo Done
#exit /b 0