Skip to content

Commit

Permalink
install from source: clean up comments
Browse files Browse the repository at this point in the history
Update comments in the install from source script so that:

1. Sentences begin with capital letters.
2. Sentences end with punctuation.
3. Comments are within 80 characters per line.
  • Loading branch information
ldennington committed Aug 18, 2022
1 parent 1244544 commit 0e43350
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/linux/Packaging.Linux/install-from-source.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/bin/sh

# halt execution immediately on failure
# note there are some scenarios in which this will not exit;
# see https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# for additional details
# Halt execution immediately on failure.
# Note there are some scenarios in which this will not exit; see
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# for additional details.
set -e

is_ci=
for i in "$@"; do
case "$i" in
-y)
is_ci=true
shift # past argument=value
shift # Past argument=value
;;
esac
done

# in non-ci scenarios, advertise what we will be doing and
# give user the option to exit
# In non-ci scenarios, advertise what we will be doing and
# give user the option to exit.
if [ -z $is_ci ]; then
echo "This script will download, compile, and install Git Credential Manager to:
Expand Down Expand Up @@ -47,7 +47,7 @@ install_shared_packages() {

local shared_packages="git curl"
for package in $shared_packages; do
# ensure we don't stomp on existing installations
# Ensure we don't stomp on existing installations.
if [ ! -z $(which $package) ]; then
continue
fi
Expand All @@ -66,19 +66,19 @@ ensure_dotnet_installed() {
chmod +x ./dotnet-install.sh
bash -c "./dotnet-install.sh"

# since we have to run the dotnet install script with bash, dotnet isn't added
# to the process PATH, so we manually add it here
# Since we have to run the dotnet install script with bash, dotnet isn't
# added to the process PATH, so we manually add it here.
cd ~
export DOTNET_ROOT=$(pwd)/.dotnet
add_to_PATH $DOTNET_ROOT
fi
}

verify_existing_dotnet_installation() {
# get initial pieces of installed sdk version(s)
# Get initial pieces of installed sdk version(s).
sdks=$(dotnet --list-sdks | cut -c 1-3)

# if we have a supported version installed, return
# If we have a supported version installed, return.
supported_dotnet_versions="6.0"
for v in $supported_dotnet_versions; do
if [ $(echo $sdks | grep "$v") ]; then
Expand All @@ -90,7 +90,7 @@ verify_existing_dotnet_installation() {
add_to_PATH () {
for directory; do
if [ ! -d "$directory" ]; then
continue; # skip nonexistent directory
continue; # Skip nonexistent directory.
fi
case ":$PATH:" in
*":$directory:"*)
Expand All @@ -110,8 +110,8 @@ apt_install() {

sudo_cmd=

# if the user isn't root, we need to use `sudo` for certain commands
# (e.g. installing packages)
# If the user isn't root, we need to use `sudo` for certain commands
# (e.g. installing packages).
if [ -z "$sudo_cmd" ]; then
if [ `id -u` != 0 ]; then
sudo_cmd=sudo
Expand All @@ -135,18 +135,18 @@ case "$distribution" in
fi

if $useMicrosoftFeed; then
# add dotnet package repository/signing key
# Add dotnet package repository/signing key.
$sudo_cmd apt update && $sudo_cmd apt install wget -y
curl -LO https://packages.microsoft.com/config/"$distribution"/"$version"/packages-microsoft-prod.deb
$sudo_cmd dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

# proactively install tzdata to prevent prompts
# Proactively install tzdata to prevent prompts.
export DEBIAN_FRONTEND=noninteractive
$sudo_cmd apt install -y --no-install-recommends tzdata
fi

# install dotnet packages and dependencies if needed
# Install dotnet packages and dependencies if needed.
if [ -z "$(verify_existing_dotnet_installation)" ]; then
$sudo_cmd apt update
# First try to install via native feeds (Ubuntu 22.04 and later).
Expand Down Expand Up @@ -174,15 +174,15 @@ case "$distribution" in
$sudo_cmd apt update
install_shared_packages apt install

# install dotnet packages and dependencies
# Install dotnet packages and dependencies.
$sudo_cmd apt install libc6 libgcc1 libgssapi-krb5-2 libssl1.1 libstdc++6 zlib1g libicu66 -y
ensure_dotnet_installed
;;
fedora | centos | rhel)
$sudo_cmd dnf update -y
install_shared_packages dnf install

# install dotnet/gcm dependencies
# Install dotnet/GCM dependencies.
$sudo_cmd dnf install krb5-libs libicu openssl-libs zlib findutils which bash -y

ensure_dotnet_installed
Expand All @@ -191,7 +191,7 @@ case "$distribution" in
$sudo_cmd apk update
install_shared_packages apk add

# install dotnet/gcm dependencies
# Install dotnet/GCM dependencies.
$sudo_cmd apk add icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib which bash coreutils gcompat

ensure_dotnet_installed
Expand All @@ -202,7 +202,7 @@ case "$distribution" in
;;
esac

# detect if the script is part of a full source checkout or standalone instead
# Detect if the script is part of a full source checkout or standalone instead.
script_path="$(cd "$(dirname "$0")" && pwd)"
toplevel_path="${script_path%/src/linux/Packaging.Linux}"
if [ "z$script_path" = "z$toplevel_path" ] || [ ! -f "$toplevel_path/Git-Credential-Manager.sln" ]; then
Expand Down

0 comments on commit 0e43350

Please sign in to comment.