forked from dotnet/templating
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·70 lines (53 loc) · 2.11 KB
/
setup.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
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
65
66
67
68
69
70
#!/bin/bash
RID="$( dotnet --info | egrep -e 'RID:' | egrep -o -e ':.*' | egrep -o -e '[^:]+' | egrep -o -e '(\w|\.|-)+' )"
OS="$( echo "$RID" | egrep -o -e .*- | egrep -o -e [^-]+ )"
ARCH="$( echo "$RID" | egrep -o -e -.* | egrep -o -e [^-]+ )"
REPOROOT="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
if [ "$OS" == "ubuntu.16.04" ]; then
OS="ubuntu.14.04"
SPECIAL_OS="YES"
fi
if [ "$SPECIAL_OS" == "YES" ]; then
RID="$OS-$ARCH"
fi
echo "Using RID: $RID"
echo "Using OS: $OS"
CWD="$( pwd )"
if [ ! "$OS" == "osx.10.11" ]; then
DN3BASEDIR0="$( realpath ${BASH_SOURCE[0]} )"
else
DN3BASEDIR0=$BASH_SOURCE[0]
fi
DN3BASEDIR1="$( dirname $DN3BASEDIR0 )"
DN3BASEDIR="$( cd $DN3BASEDIR1 && pwd )"
if [ -z $DN3B ]; then
DN3B="Debug"; export DN3B
fi
cd "$DN3BASEDIR"
echo Using build configuration "$DN3B"
/bin/bash harderreset.sh
echo Creating directory structure...
mkdir "src/dotnet-new3/bin"
mkdir "src/dotnet-new3/bin/$DN3B"
mkdir "src/dotnet-new3/bin/$DN3B/netcoreapp1.0"
mkdir "src/dotnet-new3/bin/$DN3B/netcoreapp1.0/$RID"
mkdir "src/dotnet-new3/bin/$DN3B/netcoreapp1.0/$RID/BuiltIns"
$REPOROOT/build.sh -c $DN3B
echo Importing built in templates...
cp -r "$DN3BASEDIR/template_feed/"* "$DN3BASEDIR/src/dotnet-new3/bin/$DN3B/netcoreapp1.0/$RID/BuiltIns/"
echo Done!
if [ ! -L /usr/local/bin/setup.sh ]; then
echo "Creating symbolic link /usr/local/bin/setup.sh -> $DN3BASEDIR/setup.sh"
sudo ln -s "$DN3BASEDIR/setup.sh" /usr/local/bin/setup.sh
fi
echo You can now use setup.sh from anywhere to rebuild dotnet new3
if [ ! -L /usr/local/bin/harderreset.sh ]; then
echo "Creating symbolic link /usr/local/bin/harderreset.sh -> $DN3BASEDIR/harderreset.sh"
sudo ln -s "$DN3BASEDIR/harderreset.sh" /usr/local/bin/harderreset.sh
fi
echo You can now use harderreset.sh from anywhere to delete dotnet new3 artifacts
if [ ! -L /usr/local/bin/dotnet-new3 ]; then
echo "Creating symbolic link /usr/local/bin/dotnet-new3 -> $DN3BASEDIR/src/dotnet-new3/bin/$DN3B/netcoreapp1.0/$RID/dotnet-new3"
sudo ln -s "$DN3BASEDIR/src/dotnet-new3/bin/$DN3B/netcoreapp1.0/$RID/dotnet-new3" /usr/local/bin/dotnet-new3
fi
echo dotnet new3 is ready!