forked from dotnet/templating
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·69 lines (51 loc) · 1.82 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
#!/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 $REPOROOT/harderreset.sh
echo Creating directory structure...
mkdir dev
mkdir dev/BuiltIns
$REPOROOT/build.sh -c $DN3B -r $RID
echo Importing built in templates...
cp -r "$DN3BASEDIR/template_feed/"* "$DN3BASEDIR/dev/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/dev/dotnet-new3"
sudo ln -s "$DN3BASEDIR/dev/dotnet-new3" /usr/local/bin/dotnet-new3
fi
cd $CWD
echo dotnet new3 is ready!