forked from fsprojects/Paket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·44 lines (31 loc) · 1.03 KB
/
install.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
#!/usr/bin/env bash
if [ "$(id -u)" != "0" ]; then
echo "This local installation of Paket requires root privileges. Please run script as root (i.e. using 'sudo')." 1>&2
exit 1
fi
TMP=/tmp/paket/src
LIB=/usr/local/lib
BIN=/usr/local/bin
LATEST=$(curl -s -G -d '$filter=Id%20eq%20'"'"'Paket'"'"'%20and%20IsPrerelease%20eq%20false&$orderby=LastUpdated%20desc&$top=1' "http://www.nuget.org/api/v2/Packages()" | sed -n 's;.*src="\([^"]*\).*;\1;p')
if [ ! "$LATEST" ]; then
echo "Could not find a paket source on nuget.org. Please check your internet connection and access to http://www.nuget.org."
exit 1
fi
echo "Installing $LATEST ..."
rm -rf $TMP
mkdir -p $TMP
curl -L $LATEST -o $TMP/paket.zip
unzip -qq -o -d $TMP/ $TMP/paket.zip
rm -rf $LIB/paket
install -d $LIB/paket
for f in $TMP/tools/*; do
install $f $LIB/paket/
done
rm -rf $BIN/paket
cat >> $BIN/paket <<EOF
#!/usr/bin/env bash
exec mono $LIB/paket/paket.exe "\$@"
EOF
chmod a+x $BIN/paket
echo "Paket installation successful. Type 'paket' for more information'"
exit 0