@@ -138,7 +138,7 @@ install_ghcup() {
138
138
curl --proto ' =https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_MINIMAL=1 sh
139
139
source " $( dirname " ${GHCUP_BIN} " ) /env"
140
140
# make sure we use the vanilla channel for installing binaries
141
- # see https://github.com/haskell/ghcup-metadata/pull/166#issuecomment-1893075575
141
+ # see https://github.com/haskell/ghcup-metadata/pull/166#issuecomment-1893075575
142
142
ghcup config set url-source https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-vanilla-0.0.8.yaml
143
143
ghcup install cabal --set " ${BOOTSTRAP_HASKELL_CABAL_VERSION} "
144
144
fi
@@ -207,3 +207,32 @@ mktempdir() {
207
207
;;
208
208
esac
209
209
}
210
+
211
+ # "Inspired" from GHC GitLab CI
212
+ # https://gitlab.haskell.org/ghc/ghc/-/blob/214b2b6916f2d016ab9db0b766060e7828bb47a0/.gitlab/ci.sh#L60
213
+ setup_locale () {
214
+ # BSD grep terminates early with -q, consequently locale -a will get a
215
+ # SIGPIPE and the pipeline will fail with pipefail.
216
+ shopt -o -u pipefail
217
+ if locale -a | grep -q C.UTF-8; then
218
+ # Debian
219
+ export LANG=C.UTF-8
220
+ elif locale -a | grep -q C.utf8; then
221
+ # Fedora calls it this
222
+ export LANG=C.utf8
223
+ elif locale -a | grep -q en_US.UTF-8; then
224
+ # Centos doesn't have C.UTF-8
225
+ export LANG=en_US.UTF-8
226
+ elif locale -a | grep -q en_US.utf8; then
227
+ # Centos doesn't have C.UTF-8
228
+ export LANG=en_US.utf8
229
+ else
230
+ error " Failed to find usable locale"
231
+ info " Available locales:"
232
+ locale -a
233
+ fail " No usable locale, aborting..."
234
+ fi
235
+ info " Using locale $LANG ..."
236
+ export LC_ALL=$LANG
237
+ shopt -o -s pipefail
238
+ }
0 commit comments