Skip to content

Commit a05558e

Browse files
committed
fix(lefthook): fix scripts errors
1 parent 4433da1 commit a05558e

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/lefthook/install.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source ./utils.sh
44

55
LEFTHOOK_VERSION=${VERSION:-"latest"}
6-
INSTALL_DIRECTLY_FROM_GITHUB_RELEASE=${INSTALLDIRECTLYFROMGITHUBRELEASE:-"false"}
6+
INSTALL_DIRECTLY_FROM_GITHUB_RELEASE=${INSTALLDIRECTLYFROMGITHUBRELEASE:-"true"}
77
GITHUB_REPO=https://github.com/evilmartians/lefthook
88

99
# Exit immediately if a command exits with a non-zero status.
@@ -80,14 +80,16 @@ install_from_package_manager() {
8080
apt-get install -y --no-install-recommends lefthook=${latest_version}
8181
}
8282

83-
# Install curl, ca-certificates, git if missing
83+
# Install curl if missing
8484
check_packages curl ca-certificates
85-
if ! type git > /dev/null 2>&1; then
86-
check_packages git
87-
fi
8885

8986
# Install Lefthook
9087
if [ "${INSTALL_DIRECTLY_FROM_GITHUB_RELEASE}" = "true" ]; then
88+
# Install git if missing
89+
if ! type git > /dev/null 2>&1; then
90+
check_packages git
91+
fi
92+
9193
install_from_github
9294
else
9395
install_from_package_manager

src/lefthook/utils.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ apt_get_update() {
1010
check_packages() {
1111
if ! dpkg -s "$@" > /dev/null 2>&1; then
1212
apt_get_update
13-
apt-get -y --no-install-recommends "$@"
13+
echo "Installing $@..."
14+
apt-get install -y --no-install-recommends $@
1415
fi
1516
}
1617

0 commit comments

Comments
 (0)