Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghcup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Janfel
ghcup
Commits
c19f69d4
Verified
Commit
c19f69d4
authored
5 years ago
by
Julian Ospald
Browse files
Options
Downloads
Plain Diff
Merge branch 'zsh-detection'
parents
6afec909
70341316
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bootstrap-haskell
+38
-27
38 additions, 27 deletions
bootstrap-haskell
with
38 additions
and
27 deletions
bootstrap-haskell
+
38
−
27
View file @
c19f69d4
...
...
@@ -96,39 +96,50 @@ if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
echo
"You may want to source '
$GHCUP_INSTALL_BASE_PREFIX
/.ghcup/env' in your shell"
echo
"configuration to do so (e.g. ~/.bashrc)."
if
[
-f
"
$HOME
/.bashrc"
]
;
then
GHCUP_PROFILE_FILE
=
"
$HOME
/.bashrc"
elif
[
-f
"
$HOME
/.bash_profile"
]
;
then
GHCUP_PROFILE_FILE
=
"
$HOME
/.bash_profile"
else
# most complaints we get are from mac users who
# need assistance of setting up their shell, so suggest
# to create .bash_profile, which is a good guess
GHCUP_PROFILE_FILE
=
"
$HOME
/.bash_profile"
fi
if
[
-f
"
${
GHCUP_PROFILE_FILE
}
"
]
;
then
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
""
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"Detected
\"
${
GHCUP_PROFILE_FILE
}
\"
on your system..."
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"If you want ghcup to automatically fix your
\"
${
GHCUP_PROFILE_FILE
}
\"
to include the required PATH variable"
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"answer with YES, otherwise with NO and press ENTER."
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
""
elif
[
-n
"
${
BASH
}
"
]
;
then
# only suggest to create .bash_profile if we are in a bash shell
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
""
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"Detected bash shell on your system..."
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"If you want ghcup to automatically create
\"
${
GHCUP_PROFILE_FILE
}
\"
and include the required PATH variable"
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"answer with YES, otherwise with NO and press ENTER."
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
""
else
exit
0
fi
case
$SHELL
in
*
/zsh
)
# login shell is zsh
GHCUP_PROFILE_FILE
=
"
$HOME
/.zshrc"
MY_SHELL
=
"zsh"
;;
*
/bash
)
# login shell is bash
if
[
-f
"
$HOME
/.bashrc"
]
;
then
# bashrc is not sourced by default, so assume it isn't if file does not exist
GHCUP_PROFILE_FILE
=
"
$HOME
/.bashrc"
else
GHCUP_PROFILE_FILE
=
"
$HOME
/.bash_profile"
fi
MY_SHELL
=
"bash"
;;
*
/sh
)
# login shell is sh, but might be a symlink to bash or zsh
if
[
-n
"
${
BASH
}
"
]
;
then
if
[
-f
"
$HOME
/.bashrc"
]
;
then
# bashrc is not sourced by default, so assume it isn't if file does not exist
GHCUP_PROFILE_FILE
=
"
$HOME
/.bashrc"
else
GHCUP_PROFILE_FILE
=
"
$HOME
/.bash_profile"
fi
MY_SHELL
=
"bash"
elif
[
-n
"
${
ZSH_VERSION
}
"
]
;
then
GHCUP_PROFILE_FILE
=
"
$HOME
/.zshrc"
MY_SHELL
=
"zsh"
else
exit
0
fi
;;
*
)
exit
0
;;
esac
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
""
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"Detected
${
MY_SHELL
}
shell on your system..."
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"If you want ghcup to automatically add the required PATH variable to
\"
${
GHCUP_PROFILE_FILE
}
\"
"
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"answer with YES, otherwise with NO and press ENTER."
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
""
while
true
;
do
read
-r
next_answer </dev/tty
case
$next_answer
in
[
Yy]
*
)
echo
"source
$
GHCUP_INSTALL_BASE_PREFIX
/.ghcup/env"
>>
"
${
GHCUP_PROFILE_FILE
}
"
echo
"
[ -f
\"\$
{GHCUP_INSTALL_BASE_PREFIX:=
\$
HOME}/.ghcup/env
\"
] &&
source
\"\$
{
GHCUP_INSTALL_BASE_PREFIX
:=
\$
HOME}
/.ghcup/env
\"
"
>>
"
${
GHCUP_PROFILE_FILE
}
"
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"OK!
${
GHCUP_PROFILE_FILE
}
has been modified. Restart your terminal for the changes to take effect,"
printf
"
\\
033[0;35m%s
\\
033[0m
\\
n"
"or type
\"
source
${
GHCUP_INSTALL_BASE_PREFIX
}
/.ghcup/env
\"
to apply them in your current terminal session."
exit
0
;;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment