Skip to content

Commit 6091059

Browse files
committed
Merge branch 'issue-1050'
2 parents c07d28e + 1b9b386 commit 6091059

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed

scripts/bootstrap/bootstrap-haskell

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,127 @@ find_shell() {
468468
esac
469469
}
470470

471+
ask_base_channel() {
472+
if [ -n "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
473+
return 0
474+
fi
475+
echo "-------------------------------------------------------------------------------"
476+
warn ""
477+
warn "GHCup provides different binary distribution \"channels\". These are collections of tools"
478+
warn "and may differ in purpose and philosophy. First, we select the base channel."
479+
warn ""
480+
while true; do
481+
482+
warn "[S] Skip [D] Default (GHCup maintained) [V] Vanilla (Upstream maintained) [?] Help (default is \"Skip\")."
483+
warn ""
484+
485+
read -r bashrc_answer </dev/tty
486+
487+
case $bashrc_answer in
488+
[Ss]* | "")
489+
return 0
490+
;;
491+
[Dd]*)
492+
return 1
493+
;;
494+
[Vv]*)
495+
return 2
496+
;;
497+
*)
498+
echo "Possible choices are:"
499+
echo
500+
echo "[S]kip - Do nothing and leave GHCup config as is"
501+
echo "[D]efault - The default channel maintained by GHCup developers"
502+
echo " (receives QA and support from GHCup and may provide"
503+
echo " unofficial bindists for lesser supported platforms)"
504+
echo "[V]anilla - Only contains unchanged upstream binary distributions"
505+
echo " (is updated with newer releases faster since it receives no GHCup QA)"
506+
echo
507+
echo "Selecting Default or Vanilla will overwrite any pre-existing channel"
508+
echo "config you might have (if you've previously installed GHCup)."
509+
echo
510+
echo "Please make your choice and press ENTER."
511+
;;
512+
esac
513+
done
514+
515+
unset bashrc_answer
516+
}
517+
518+
ask_prerelease_channel() {
519+
if [ -n "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
520+
return 0
521+
fi
522+
echo "-------------------------------------------------------------------------------"
523+
524+
warn ""
525+
warn "Do you also want to enable the pre-releases channel, getting acces to."
526+
warn "alpha, betas and release candidates?"
527+
warn ""
528+
warn "[N] No [Y] Yes [?] Help (default is \"N\")."
529+
while true; do
530+
531+
read -r bashrc_answer </dev/tty
532+
533+
case $bashrc_answer in
534+
[Nn]* | "")
535+
return 0
536+
;;
537+
[Yy]*)
538+
return 1
539+
;;
540+
*)
541+
echo "Possible choices are:"
542+
echo
543+
echo "N - No, don't enable prereleases (default)"
544+
echo "Y - Yes, enable prereleases"
545+
echo
546+
echo "Please make your choice and press ENTER."
547+
;;
548+
esac
549+
done
550+
551+
unset bashrc_answer
552+
}
553+
554+
ask_cross_channel() {
555+
if [ -n "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
556+
return 0
557+
fi
558+
while true; do
559+
echo "-------------------------------------------------------------------------------"
560+
561+
warn ""
562+
warn "Do you also want to enable the cross channel, getting acces to"
563+
warn "experimental GHCJS, WASM, etc.?"
564+
warn ""
565+
warn "[N] No [Y] Yes [?] Help (default is \"N\")."
566+
warn ""
567+
568+
read -r bashrc_answer </dev/tty
569+
570+
case $bashrc_answer in
571+
[Nn]* | "")
572+
return 0
573+
;;
574+
[Yy]*)
575+
return 1
576+
;;
577+
*)
578+
echo "Possible choices are:"
579+
echo
580+
echo "N - No, don't enable cross (default)"
581+
echo "Y - Yes, enable prereleases"
582+
echo
583+
echo "Please make your choice and press ENTER."
584+
;;
585+
esac
586+
done
587+
588+
unset bashrc_answer
589+
}
590+
591+
471592
# Ask user if they want to adjust the bashrc.
472593
ask_bashrc() {
473594
if [ -n "${BOOTSTRAP_HASKELL_ADJUST_BASHRC}" ] ; then
@@ -830,6 +951,16 @@ if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
830951
read -r answer </dev/tty
831952
fi
832953

954+
if [ -z "${BOOTSTRAP_HASKELL_MINIMAL}" ] ; then
955+
ask_base_channel
956+
ask_base_channel_answer=$?
957+
if [ $ask_base_channel_answer != 0 ] ; then
958+
ask_prerelease_channel
959+
ask_prerelease_channel_answer=$?
960+
ask_cross_channel
961+
ask_cross_channel_answer=$?
962+
fi
963+
fi
833964
ask_bashrc
834965
ask_bashrc_answer=$?
835966
ask_cabal_config_init
@@ -865,6 +996,30 @@ if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
865996
read -r answer </dev/tty
866997
fi
867998

999+
case $ask_base_channel_answer in
1000+
1)
1001+
_eghcup config set url-source GHCupURL
1002+
;;
1003+
2)
1004+
_eghcup config set url-source vanilla
1005+
;;
1006+
*) ;;
1007+
esac
1008+
1009+
case $ask_prerelease_channel_answer in
1010+
1)
1011+
_eghcup config add-release-channel prereleases
1012+
;;
1013+
*) ;;
1014+
esac
1015+
1016+
case $ask_cross_channel_answer in
1017+
1)
1018+
_eghcup config add-release-channel cross
1019+
;;
1020+
*) ;;
1021+
esac
1022+
8681023
if [ -z "${BOOTSTRAP_HASKELL_MINIMAL}" ] ; then
8691024
eghcup --cache install ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}"
8701025

0 commit comments

Comments
 (0)