1
1
#! /bin/sh
2
2
3
- # halt execution immediately on failure
4
- # note there are some scenarios in which this will not exit;
5
- # see https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
6
- # for additional details
3
+ # Halt execution immediately on failure.
4
+ # Note there are some scenarios in which this will not exit; see
5
+ # https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
6
+ # for additional details.
7
7
set -e
8
8
9
9
is_ci=
10
10
for i in " $@ " ; do
11
11
case " $i " in
12
12
-y)
13
13
is_ci=true
14
- shift # past argument=value
14
+ shift # Past argument=value
15
15
;;
16
16
esac
17
17
done
18
18
19
- # in non-ci scenarios, advertise what we will be doing and
20
- # give user the option to exit
19
+ # In non-ci scenarios, advertise what we will be doing and
20
+ # give user the option to exit.
21
21
if [ -z $is_ci ]; then
22
22
echo " This script will download, compile, and install Git Credential Manager to:
23
23
@@ -47,7 +47,7 @@ install_shared_packages() {
47
47
48
48
local shared_packages=" git curl"
49
49
for package in $shared_packages ; do
50
- # ensure we don't stomp on existing installations
50
+ # Ensure we don't stomp on existing installations.
51
51
if [ ! -z $( which $package ) ]; then
52
52
continue
53
53
fi
@@ -66,19 +66,19 @@ ensure_dotnet_installed() {
66
66
chmod +x ./dotnet-install.sh
67
67
bash -c " ./dotnet-install.sh"
68
68
69
- # since we have to run the dotnet install script with bash, dotnet isn't added
70
- # to the process PATH, so we manually add it here
69
+ # Since we have to run the dotnet install script with bash, dotnet isn't
70
+ # added to the process PATH, so we manually add it here.
71
71
cd ~
72
72
export DOTNET_ROOT=$( pwd) /.dotnet
73
73
add_to_PATH $DOTNET_ROOT
74
74
fi
75
75
}
76
76
77
77
verify_existing_dotnet_installation () {
78
- # get initial pieces of installed sdk version(s)
78
+ # Get initial pieces of installed sdk version(s).
79
79
sdks=$( dotnet --list-sdks | cut -c 1-3)
80
80
81
- # if we have a supported version installed, return
81
+ # If we have a supported version installed, return.
82
82
supported_dotnet_versions=" 6.0"
83
83
for v in $supported_dotnet_versions ; do
84
84
if [ $( echo $sdks | grep " $v " ) ]; then
@@ -90,7 +90,7 @@ verify_existing_dotnet_installation() {
90
90
add_to_PATH () {
91
91
for directory; do
92
92
if [ ! -d " $directory " ]; then
93
- continue ; # skip nonexistent directory
93
+ continue ; # Skip nonexistent directory.
94
94
fi
95
95
case " :$PATH :" in
96
96
* " :$directory :" * )
@@ -112,8 +112,8 @@ apt_install() {
112
112
113
113
sudo_cmd=
114
114
115
- # if the user isn't root, we need to use `sudo` for certain commands
116
- # (e.g. installing packages)
115
+ # If the user isn't root, we need to use `sudo` for certain commands
116
+ # (e.g. installing packages).
117
117
if [ -z " $sudo_cmd " ]; then
118
118
if [ ` id -u` != 0 ]; then
119
119
sudo_cmd=sudo
@@ -127,7 +127,7 @@ case "$distribution" in
127
127
$sudo_cmd apt update
128
128
install_shared_packages apt install
129
129
130
- # install dotnet packages and dependencies if needed
130
+ # Install dotnet packages and dependencies if needed.
131
131
if [ -z " $( verify_existing_dotnet_installation) " ]; then
132
132
# First try to use native feeds (Ubuntu 22.04 and later).
133
133
if ! apt_install dotnet6; then
@@ -154,15 +154,15 @@ case "$distribution" in
154
154
$sudo_cmd apt update
155
155
install_shared_packages apt install
156
156
157
- # install dotnet packages and dependencies
157
+ # Install dotnet packages and dependencies.
158
158
$sudo_cmd apt install libc6 libgcc1 libgssapi-krb5-2 libssl1.1 libstdc++6 zlib1g libicu66 -y
159
159
ensure_dotnet_installed
160
160
;;
161
161
fedora | centos | rhel)
162
162
$sudo_cmd dnf update -y
163
163
install_shared_packages dnf install
164
164
165
- # install dotnet/gcm dependencies
165
+ # Install dotnet/GCM dependencies.
166
166
$sudo_cmd dnf install krb5-libs libicu openssl-libs zlib findutils which bash -y
167
167
168
168
ensure_dotnet_installed
@@ -171,7 +171,7 @@ case "$distribution" in
171
171
$sudo_cmd apk update
172
172
install_shared_packages apk add
173
173
174
- # install dotnet/gcm dependencies
174
+ # Install dotnet/GCM dependencies.
175
175
$sudo_cmd apk add icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib which bash coreutils gcompat
176
176
177
177
ensure_dotnet_installed
@@ -182,7 +182,7 @@ case "$distribution" in
182
182
;;
183
183
esac
184
184
185
- # detect if the script is part of a full source checkout or standalone instead
185
+ # Detect if the script is part of a full source checkout or standalone instead.
186
186
script_path=" $( cd " $( dirname " $0 " ) " && pwd) "
187
187
toplevel_path=" ${script_path%/ src/ linux/ Packaging.Linux} "
188
188
if [ " z$script_path " = " z$toplevel_path " ] || [ ! -f " $toplevel_path /Git-Credential-Manager.sln" ]; then
0 commit comments