style: check more shell scripts.

We were missing a few here so add them. Also, fix the changes in
`on-create-command.sh` that this catches.
This commit is contained in:
Mike McQuaid 2022-11-09 17:29:38 +00:00
parent eaf887656f
commit a92c9eed82
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
2 changed files with 18 additions and 11 deletions

View File

@ -5,8 +5,9 @@ set -e
sudo chmod -R g-w,o-w /home/linuxbrew sudo chmod -R g-w,o-w /home/linuxbrew
# everything below is too slow to do unless prebuilding so skip it # everything below is too slow to do unless prebuilding so skip it
CODESPACES_ACTION_NAME="$(cat /workspaces/.codespaces/shared/environment-variables.json | jq -r '.ACTION_NAME')" CODESPACES_ACTION_NAME="$(jq --raw-output '.ACTION_NAME' /workspaces/.codespaces/shared/environment-variables.json)"
if [ "$CODESPACES_ACTION_NAME" != "createPrebuildTemplate" ]; if [[ "${CODESPACES_ACTION_NAME}" != "createPrebuildTemplate" ]]
then
echo "Skipping slow items, not prebuilding." echo "Skipping slow items, not prebuilding."
exit 0 exit 0
fi fi
@ -22,18 +23,23 @@ brew cleanup
# install some useful development things # install some useful development things
sudo apt-get update sudo apt-get update
APT_GET_INSTALL="openssh-server zsh"
apt_get_install() {
sudo apt-get install -y \
-o Dpkg::Options::=--force-confdef \
-o Dpkg::Options::=--force-confnew \
"$@"
}
apt_get_install \
openssh-server \
zsh
# Ubuntu 18.04 doesn't include zsh-autosuggestions # Ubuntu 18.04 doesn't include zsh-autosuggestions
if ! grep -q "Ubuntu 18.04" /etc/issue &>/dev/null if ! grep -q "Ubuntu 18.04" /etc/issue &>/dev/null
then then
APT_GET_INSTALL="$APT_GET_INSTALL zsh-autosuggestions" apt_get_install zsh-autosuggestions
fi fi
sudo apt-get install -y \
-o Dpkg::Options::=--force-confdef \
-o Dpkg::Options::=--force-confnew \
$APT_GET_INSTALL
# Start the SSH server so that `gh cs ssh` works. # Start the SSH server so that `gh cs ssh` works.
sudo service ssh start sudo service ssh start

View File

@ -262,12 +262,13 @@ module Homebrew
HOMEBREW_BREW_FILE, HOMEBREW_BREW_FILE,
HOMEBREW_REPOSITORY/"completions/bash/brew", HOMEBREW_REPOSITORY/"completions/bash/brew",
HOMEBREW_REPOSITORY/"Dockerfile", HOMEBREW_REPOSITORY/"Dockerfile",
*HOMEBREW_LIBRARY.glob("Homebrew/*.sh"), *HOMEBREW_REPOSITORY.glob(".devcontainer/**/*.sh"),
*HOMEBREW_LIBRARY.glob("Homebrew/**/*.sh").reject { |path| path.to_s.include?("/vendor/") },
*HOMEBREW_LIBRARY.glob("Homebrew/shims/**/*").map(&:realpath).uniq *HOMEBREW_LIBRARY.glob("Homebrew/shims/**/*").map(&:realpath).uniq
.reject(&:directory?) .reject(&:directory?)
.reject { |path| path.basename.to_s == "cc" } .reject { |path| path.basename.to_s == "cc" }
.select do |path| .select do |path|
%r{^#! ?/bin/(?:ba)?sh( |$)}.match?(path.read(13)) || path.extname == ".sh" %r{^#! ?/bin/(?:ba)?sh( |$)}.match?(path.read(13))
end, end,
*HOMEBREW_LIBRARY.glob("Homebrew/{dev-,}cmd/*.sh"), *HOMEBREW_LIBRARY.glob("Homebrew/{dev-,}cmd/*.sh"),
*HOMEBREW_LIBRARY.glob("Homebrew/{cask/,}utils/*.sh"), *HOMEBREW_LIBRARY.glob("Homebrew/{cask/,}utils/*.sh"),