Skip to content

Commit

Permalink
test: Test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
MAHDTech committed Jul 20, 2023
1 parent 6f46db6 commit 60aa455
Showing 1 changed file with 37 additions and 13 deletions.
50 changes: 37 additions & 13 deletions nix/oci/tanzu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ in
"/usr/local"
"/usr/local/bin"
"/usr/share/"
"/usr/share/bash-completion"
"/var"
"/var/run"
];
Expand Down Expand Up @@ -239,6 +240,36 @@ in
EOF
chmod +x /etc/profile
# Bash completion
cat << 'EOF' > /etc/profile.d/bash_completion.sh
#! /usr/bin/env bash
# Check for interactive bash and that we haven't already been sourced.
if [ "x''${BASH_VERSION-}" != x -a "x''${PS1-}" != x -a "x''${BASH_COMPLETION_VERSINFO-}" = x ];
then
# Check for recent enough version of bash.
if [ "''${BASH_VERSINFO[0]}" -gt 4 ] ||
[ "''${BASH_VERSINFO[0]}" -eq 4 -a "''${BASH_VERSINFO[1]}" -ge 2 ];
then
[ -r "''${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] &&
. "''${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ];
then
# Source completion code.
. /usr/share/bash-completion/bash_completion
fi
fi
fi
# Enable bash-completion the Nix way.
if shopt -q progcomp &>/dev/null;
then
export BASH_COMPLETION_ENABLED="TRUE"
. "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh"
fi
EOF
chmod +x /etc/profile.d/bash_completion.sh
# Default user .bashrc
mkdir --parents /etc/skel
cat << 'EOF' > /etc/skel/.bashrc
Expand All @@ -256,8 +287,8 @@ in
. "''${HOME}/.profile"
fi
# shellcheck disable=SC1090
source <(/bin/starship init bash --print-full-init)
# shellcheck disable=SC1090
source <(/bin/starship init bash --print-full-init)
fi
EOF
Expand Down Expand Up @@ -296,8 +327,8 @@ in
fi
fi
# The rules that define whether the CLI has been "initialized" are:
# We need more than one check due to bind mounts.
# The rules that define whether the CLI has been "initialized" are:
if [[ -f "''${HOME}/.config/tanzu/config.yaml" ]];
then
if [[ -d "''${HOME}/.config/tanzu/tkg" ]];
Expand Down Expand Up @@ -382,14 +413,7 @@ in
done
fi
# Enable bash-completion
if shopt -q progcomp &>/dev/null;
then
BASH_COMPLETION_ENABLED="TRUE"
. "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh"
fi
# Binaries with bash completions
# Binaries we need to source manual bash completions from.
declare -r BINS=(
clusterctl
helm
Expand All @@ -407,7 +431,6 @@ in
echo "Loading bash completions into current shell..."
for BIN in "''${BINS[@]}";
do
echo "Loading bash completion for ''${BIN}"
source <(''${BIN} completion bash) || {
echo "Failed to source bash completion for ''${BIN}, skipping."
}
Expand All @@ -422,6 +445,7 @@ in
# Create a wrapper entrypoint
cat << 'EOF' > /usr/local/bin/entrypoint.sh
#! /usr/bin/env bash
clear
# Launch an interactive shell session.
Expand Down Expand Up @@ -470,10 +494,10 @@ in
esac
done
clear
figlet "Goodbye!"
exit 0
EOF
chmod +x "/usr/local/bin/entrypoint.sh"
Expand Down

0 comments on commit 60aa455

Please sign in to comment.