This repository has been archived by the owner on May 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathinstall-racket.sh
executable file
·140 lines (120 loc) · 4.81 KB
/
install-racket.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash
#
# In the Travis CI environment `#!/bin/bash` won't suffice (it's here
# to make shellcheck happy and for convenience when using this script
# locally).
#
# Instead .travis.yml should pipe this script to bash (not to sh).
set -e
if [[ "$RACKET_MINIMAL" = "1" ]]; then
MIN="minimal-"
else
MIN=""
fi
if [[ "$RACKET_NATIPKG" = "1" ]]; then
RACKET_NATIPKG="-natipkg"
else
RACKET_NATIPKG=""
fi
if [[ "$RACKET_CS" = "1" ]]; then
RACKET_CS="-cs"
else
RACKET_CS=""
fi
# If this section seems like a mess, it is, because reasons:
#
# - The download URL naming conventions have changed over the years.
#
# - The Linux version name has changed over the years.
#
# - From time to time a Racket download server has gone offline, in
# which case this file has been "hot fixed". In the absence of any
# clear resolution signal ("you can resume using the original
# server"), the hot fix remains in place (until maybe someday it
# needs to be hot fixed).
#
# On the one hand, it sucks. On the other hand, a large part of the
# "added value" of this repo that it deals with the suckage so that
# ordinary users need not. They can supply names for Racket versions
# and variants using a consistent naming scheme, and we'll try to make
# it work.
DL_BASE="https://www.cs.utah.edu/plt/installers"
MIRROR_DL_BASE="https://mirror.racket-lang.org/installers"
# In theory either NWU or Utah should work for downloading snapshot
# a.k.a. HEAD builds. In practice, it varies from time to time.
## HEAD_BASE="https://plt.eecs.northwestern.edu/snapshots/current"
HEAD_BASE="https://www.cs.utah.edu/plt/snapshots/current"
if [[ "$RACKET_VERSION" = "HEADBC" ]]; then
if [[ "$RACKET_MINIMAL" = "1" ]]; then
URL="${HEAD_BASE}/installers/racket-minimal-current-x86_64-linux-precise-bc.sh"
else
URL="${HEAD_BASE}/installers/racket-current-x86_64-linux-precise-bc.sh"
fi
elif [[ "$RACKET_VERSION" = "HEADCS" || "$RACKET_VERSION" = "HEAD" ]]; then
if [[ "$RACKET_MINIMAL" = "1" ]]; then
URL="${HEAD_BASE}/installers/racket-minimal-current-x86_64-linux-xenial.sh"
else
URL="${HEAD_BASE}/installers/racket-current-x86_64-linux-xenial.sh"
fi
elif [[ "$RACKET_VERSION" = 5.3* ]]; then
if [[ "$RACKET_MINIMAL" = "1" ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-textual/racket-textual-${RACKET_VERSION}-bin-x86_64-linux-debian-squeeze.sh"
else
URL="${DL_BASE}/${RACKET_VERSION}/racket/racket-${MIN}${RACKET_VERSION}-bin-x86_64-linux-debian-squeeze.sh"
fi
elif [[ "$RACKET_VERSION" = "RELEASE" ]]; then
URL="https://pre-release.racket-lang.org/installers/racket-${MIN}current-x86_64-linux${RACKET_NATIPKG}.sh"
elif [[ "$RACKET_VERSION" = "RELEASECS" ]]; then
URL="https://pre-release.racket-lang.org/installers/racket-${MIN}current-x86_64-linux${RACKET_NATIPKG}-cs.sh"
elif [[ "$RACKET_VERSION" = 5.9* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux-ubuntu-quantal.sh"
elif [[ "$RACKET_VERSION" = 6.[0-4] ]] || [[ "$RACKET_VERSION" = 6.[0-4].[0-9] ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux-ubuntu-precise.sh"
elif [[ "$RACKET_VERSION" = 6.* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux${RACKET_NATIPKG}.sh"
elif [[ "$RACKET_VERSION" = 7.* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux${RACKET_NATIPKG}${RACKET_CS}.sh"
elif [[ "$RACKET_VERSION" = 8.* ]]; then
URL="${MIRROR_DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux${RACKET_NATIPKG}${RACKET_CS}.sh"
else
echo "ERROR: Unsupported version ${RACKET_VERSION}"
exit 1
fi
printf "%-25s" "${MIN}${RACKET_VERSION}${RACKET_NATIPKG}${RACKET_CS}"
echo "@ ${URL}"
if curl -I -L "$URL" 2>&1 | grep 404.Not.Found ; then
echo "Installer not available"
if [[ "$RACKET_VERSION" = "HEAD" ]]; then
echo "Did the build fail? Check the logs at ${HEAD_BASE}/log/"
fi
exit 1
fi
if [ -n "$TEST" ]; then
exit 0
fi
# Older .travis.yml files don't set $RACKET_DIR (the Racket install
# directory) explicitly and expect it to be /usr/racket.
if [[ "$RACKET_DIR" = "" ]]; then
RACKET_DIR=/usr/racket
fi
INSTALLER="./racket-${MIN}${RACKET_VERSION}.sh"
echo "Downloading $URL to $INSTALLER:"
curl -L -o "$INSTALLER" "$URL"
echo "Making $INSTALLER executable:"
chmod u+rx "$INSTALLER"
# Only use sudo if installing to /usr
if [[ "$RACKET_DIR" = /usr* ]]; then
RUN_INSTALLER="sudo ${INSTALLER}"
else
RUN_INSTALLER="${INSTALLER}"
fi
echo "Running $RUN_INSTALLER to install Racket:"
$RUN_INSTALLER <<EOF
no
"$RACKET_DIR"
EOF
if [[ "$RACKET_MINIMAL" = "1" ]]; then
echo "Minimal Racket: Installing packages for raco test..."
${RACKET_DIR}/bin/raco pkg install --auto --scope installation rackunit-lib compiler-lib
fi
exit 0