@@ -85,28 +85,13 @@ sudocmd() {
8585 $( command -v sudo) " $@ "
8686}
8787
88- # Adds the FPCo key to the keyring and adds the given repo to the apt sources
89- add_apt_repo () {
90- echo " $1 " | sudocmd tee /etc/apt/sources.list.d/fpco.list > /dev/null
91- sudocmd apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 575159689BEFB442
92- }
93-
9488# Install dependencies for distros that use Apt
9589apt_install_dependencies () {
9690 info " Installing dependencies..."
9791 info " "
9892 apt_get_install_pkgs " $@ "
9993}
10094
101- # Install Stack package on for distros that use Apt
102- apt_update_and_install () {
103- sudocmd apt-get update ${QUIET: +-qq}
104- apt_get_install_pkgs stack
105- post_install_separator
106- info " Installed 'stack' package."
107- info " "
108- }
109-
11095# Attempts an install on Ubuntu via apt, if possible
11196# Expects the version (in Major.Minor format, with any sub-minor removed)
11297# as the first and only argument
@@ -119,46 +104,22 @@ do_ubuntu_install() {
119104 }
120105
121106 if is_64_bit ; then
122- case " $1 " in
123- 16.10)
124- add_apt_repo ' deb http://download.fpcomplete.com/ubuntu yakkety main'
125- apt_update_and_install
126- ;;
127- 16.04)
128- add_apt_repo ' deb http://download.fpcomplete.com/ubuntu xenial main'
129- apt_update_and_install
130- ;;
131- 15.10)
132- add_apt_repo ' deb http://download.fpcomplete.com/ubuntu wily main'
133- apt_update_and_install
134- ;;
135- 14.04)
136- add_apt_repo ' deb http://download.fpcomplete.com/ubuntu trusty main'
137- apt_update_and_install
138- ;;
139- 12.04)
140- add_apt_repo ' deb http://download.fpcomplete.com/ubuntu precise main'
141- apt_update_and_install
142- ;;
143- * )
144- install_dependencies
145- info " "
146- info " No packages available for Ubuntu $1 , using generic bindist..."
147- info " "
148- install_64bit_standard_binary
149- ;;
150- esac
107+ install_dependencies
108+ info " "
109+ info " Using generic bindist..."
110+ info " "
111+ install_64bit_static_binary
151112 else
152113 install_dependencies
153114 info " "
154- info " No packages available for 32-bit Ubuntu $1 , using generic bindist..."
115+ info " Using generic bindist..."
155116 info " "
156117 install_32bit_standard_binary
157118 fi
158119
159120}
160121
161- # Attempts an install on Debian via apt, if possible
122+ # Attempts an install on Debian.
162123# Expects the single-number version as the first and only argument
163124# If the version of Debian is unsupported, it attempts to copy the binary
164125# and install the necessary dependencies explicitly.
@@ -168,125 +129,71 @@ do_debian_install() {
168129 }
169130
170131 if is_64_bit ; then
171- case " $1 " in
172- 8* )
173- add_apt_repo ' deb http://download.fpcomplete.com/debian jessie main'
174- apt_update_and_install
175- ;;
176- 7* )
177- add_apt_repo ' deb http://download.fpcomplete.com/debian wheezy main'
178- apt_update_and_install
179- ;;
180- * )
181- install_dependencies
182- info " "
183- info " No packages available for Debian $1 , using generic bindist..."
184- info " "
185- install_64bit_standard_binary
186- ;;
187- esac
132+ install_dependencies
133+ info " "
134+ info " Using generic bindist..."
135+ info " "
136+ install_64bit_static_binary
188137 else
189138 install_dependencies
190139 info " "
191- info " No packages available for 32-bit Debian $1 , using generic bindist..."
140+ info " Using generic bindist..."
192141 info " "
193142 install_32bit_standard_binary
194143 fi
195144}
196145
197- # Attempts an install on Fedora via dnf, if possible
146+ # Attempts an install on Fedora.
198147# Expects the single-number version as the first and only argument
199148# If the version of Fedora is unsupported, it attempts to copy the binary
200149# and install the necessary dependencies explicitly.
201150do_fedora_install () {
202151 install_dependencies () {
203152 dnf_install_pkgs perl make automake gcc gmp-devel libffi zlib xz tar
204153 }
205- dnf_install_stack () {
206- dnf_install_pkgs stack
207- post_install_separator
208- info " Installed 'stack' package."
209- info " "
210- }
211154
212155 if is_64_bit ; then
213- check_dl_tools
214- case " $1 " in
215- " 24" * )
216- dl_to_stdout https://download.fpcomplete.com/fedora/24/fpco.repo | sudocmd tee /etc/yum.repos.d/fpco.repo > /dev/null
217- dnf_install_stack
218- ;;
219- " 23" * )
220- dl_to_stdout https://download.fpcomplete.com/fedora/23/fpco.repo | sudocmd tee /etc/yum.repos.d/fpco.repo > /dev/null
221- dnf_install_stack
222- ;;
223- " 22" * )
224- dl_to_stdout https://download.fpcomplete.com/fedora/22/fpco.repo | sudocmd tee /etc/yum.repos.d/fpco.repo > /dev/null
225- dnf_install_stack
226- ;;
227- * )
228- install_dependencies " $1 "
229- info " "
230- info " No packages available for Fedora $1 , using generic bindist..."
231- info " "
232- install_64bit_standard_binary
233- ;;
234- esac
156+ install_dependencies " $1 "
157+ info " "
158+ info " Using generic bindist..."
159+ info " "
160+ install_64bit_static_binary
235161 else
236162 install_dependencies " $1 "
237163 info " "
238- info " No packages available for 32-bit Fedora $1 , using generic bindist..."
164+ info " Using generic bindist..."
239165 info " "
240166 install_32bit_standard_binary
241167 fi
242168}
243169
244- # Attempts an install on CentOS via yum, if possible
170+ # Attempts an install on CentOS.
245171# Expects the single-number version as the first and only argument
246172# If the version of CentOS is unsupported, it attempts to copy the binary
247173# and install the necessary dependencies explicitly.
248174do_centos_install () {
249175 install_dependencies () {
250176 yum_install_pkgs perl make automake gcc gmp-devel libffi zlib xz tar
251177 }
252- install_package () {
253- yum_install_pkgs stack
254- post_install_separator
255- info " Installed 'stack' package."
256- info " "
257- }
258178
259179 if is_64_bit ; then
260- check_dl_tools
261- case " $1 " in
262- " 7" |" 7." * )
263- dl_to_stdout https://download.fpcomplete.com/centos/7/fpco.repo | sudocmd tee /etc/yum.repos.d/fpco.repo > /dev/null
264- install_package
265- ;;
266- " 6" |" 6." * )
267- dl_to_stdout https://download.fpcomplete.com/centos/6/fpco.repo | sudocmd tee /etc/yum.repos.d/fpco.repo > /dev/null
268- install_package
269- ;;
270- * )
271- install_dependencies
272- info " "
273- info " No packages available for CentOS/RHEL $1 , using generic bindist..."
274- info " "
275- install_64bit_standard_binary
276- ;;
277- esac
180+ install_dependencies
181+ info " "
182+ info " Using generic bindist..."
183+ info " "
184+ install_64bit_static_binary
278185 else
279186 install_dependencies
280187 case " $1 " in
281188 " 6" )
282189 info " "
283- info " No packages available for 32-bit CentOS/RHEL $1 , using genergic libgmp4 bindist..."
190+ info " Using genergic libgmp4 bindist..."
284191 info " "
285192 install_32bit_gmp4_linked_binary
286193 ;;
287194 * )
288195 info " "
289- info " No packages available for 32-bit CentOS/RHEL $1 , using generic bindist..."
196+ info " Using generic bindist..."
290197 info " "
291198 install_32bit_standard_binary
292199 ;;
@@ -298,20 +205,9 @@ do_centos_install() {
298205# If 'brew' exists, installs using Homebrew. Otherwise, installs
299206# the generic bindist.
300207do_osx_install () {
301- # if has_brew ; then
302- # info "Since you have 'brew', installing using Homebrew."
303- # info ""
304- # brew update
305- # brew install haskell-stack
306- # post_install_separator
307- # info "Installed Homebrew 'haskell-stack' formula."
308- # info ""
309- # else
310- # info "Since you do not have 'brew', using generic bindist..."
311- info " Using generic bindist..."
312- info " "
313- install_64bit_osx_binary
314- # fi
208+ info " Using generic bindist..."
209+ info " "
210+ install_64bit_osx_binary
315211 info " NOTE: You may need to run 'xcode-select --install' to set"
316212 info " up the Xcode command-line tools, which Stack uses."
317213 info " "
@@ -338,9 +234,9 @@ do_alpine_install() {
338234 }
339235 install_dependencies
340236 if is_64_bit ; then
341- install_64bit_static_binary
237+ install_64bit_static_binary
342238 else
343- install_32bit_standard_binary
239+ die " Sorry, there is currently no 32-bit Alpine Linux binary available. "
344240 fi
345241}
346242
@@ -351,7 +247,7 @@ do_sloppy_install() {
351247 info " bindist..."
352248 info " "
353249 if is_64_bit ; then
354- install_64bit_standard_binary
250+ install_64bit_static_binary
355251 else
356252 install_32bit_standard_binary
357253 fi
@@ -542,10 +438,6 @@ install_32bit_standard_binary() {
542438 install_from_bindist " linux-i386"
543439}
544440
545- install_64bit_standard_binary () {
546- install_from_bindist " linux-x86_64"
547- }
548-
549441install_64bit_static_binary () {
550442 install_from_bindist " linux-x86_64-static"
551443}
@@ -562,7 +454,7 @@ install_64bit_freebsd_binary() {
562454 install_from_bindist " freebsd-x86_64"
563455}
564456
565- # Attempt to install packages using whichever of apt-get, dnf, or yum is
457+ # Attempt to install packages using whichever of apt-get, dnf, yum, or apk is
566458# available.
567459try_install_pkgs () {
568460 if has_apt_get ; then
0 commit comments