Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ale5000-git committed Jul 16, 2024
1 parent d3f435a commit 9262989
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
last_command="${_}" # IMPORTANT: This line must be at the start of the script before any other command otherwise it will not work

set -e
# shellcheck disable=SC3040,SC3041,SC2015
# shellcheck disable=SC3040,SC3041,SC2015 # Ignore: In POSIX sh, set option xxx is undefined. / In POSIX sh, set flag -X is undefined. / C may run when A is true.
{
# Unsupported set options may cause the shell to exit (even without set -e), so first try them in a subshell to avoid this issue
(set -o posix 2> /dev/null) && set -o posix || true
(set +H 2> /dev/null) && set +H || true
(set -o pipefail 2> /dev/null) && set -o pipefail || true
(set 2> /dev/null -o posix) && set -o posix || true
(set 2> /dev/null +H) && set +H || true
(set 2> /dev/null -o pipefail) && set -o pipefail || true
}

cat << 'LICENSE'
Expand Down
8 changes: 4 additions & 4 deletions cmdline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# shellcheck enable=all

set -u
# shellcheck disable=SC3040,SC3041,SC2015
# shellcheck disable=SC3040,SC3041,SC2015 # Ignore: In POSIX sh, set option xxx is undefined. / In POSIX sh, set flag -X is undefined. / C may run when A is true.
{
# Unsupported set options may cause the shell to exit (even without set -e), so first try them in a subshell to avoid this issue
(set -o posix 2> /dev/null) && set -o posix || true
(set +H 2> /dev/null) && set +H || true
(set -o pipefail 2> /dev/null) && set -o pipefail || true
(set 2> /dev/null -o posix) && set -o posix || true
(set 2> /dev/null +H) && set +H || true
(set 2> /dev/null -o pipefail) && set -o pipefail || true
}

if test "${A5K_FUNCTIONS_INCLUDED:-false}" = 'false'; then
Expand Down
20 changes: 17 additions & 3 deletions includes/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

if test "${A5K_FUNCTIONS_INCLUDED:-false}" = 'false'; then readonly A5K_FUNCTIONS_INCLUDED='true'; fi

# shellcheck disable=SC3040,SC2015 # Ignore: In POSIX sh, set option xxx is undefined. / C may run when A is true.
(set 2> /dev/null -o pipefail) && set -o pipefail || true

export LANG='en_US.UTF-8'
export TZ='UTC'

Expand Down Expand Up @@ -567,6 +564,13 @@ remove_from_path()
{
local _path

if test "${PLATFORM:?}" = 'win' && test "${PATHSEP:?}" = ':' && command 1> /dev/null -v 'cygpath'; then
# Only on Bash under Windows
local _single_path
_single_path="$(cygpath -u -- "${1:?}")" || ui_error 'Unable to convert a path in remove_from_path()'
set -- "${_single_path:?}"
fi

if _path="$(printf '%s\n' "${PATH-}" | tr -- "${PATHSEP:?}" '\n' | grep -v -x -F -e "${1:?}" | tr -- '\n' "${PATHSEP:?}")" && _path="${_path%"${PATHSEP:?}"}"; then
PATH="${_path?}"
fi
Expand Down Expand Up @@ -711,6 +715,16 @@ init_cmdline()
export DIRECTORY_SEPARATOR='/'
}

if test "${DO_INIT_CMDLINE:-0}" != '0'; then
# shellcheck disable=SC3040,SC3041,SC2015 # Ignore: In POSIX sh, set option xxx is undefined. / In POSIX sh, set flag -X is undefined. / C may run when A is true.
{
# Unsupported set options may cause the shell to exit (even without set -e), so first try them in a subshell to avoid this issue
(set 2> /dev/null -o posix) && set -o posix || true
(set 2> /dev/null +H) && set +H || true
(set 2> /dev/null -o pipefail) && set -o pipefail || true
}
fi

# Set environment variables
PLATFORM="$(detect_os)"
PATHSEP=':'
Expand Down

0 comments on commit 9262989

Please sign in to comment.