File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " Lefthook" ,
33 "id" : " lefthook" ,
4- "version" : " 1.0.1 " ,
4+ "version" : " 1.0.2 " ,
55 "documentationURL" : " http://github.com/omoxyz/devcontainer-features/tree/main/src/lefthook" ,
66 "description" : " Install Lefthook fast polyglot Git hooks manager." ,
77 "options" : {
1818 "description" : " Install directly from Github release or from package manager (apt)." ,
1919 "default" : true
2020 }
21- }
21+ },
22+ "installsAfter" : [
23+ " ghcr.io/devcontainers/features/git"
24+ ]
2225}
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ if [ " $( id -u) " -ne 0 ]; then
4+ echo -e ' Scripts must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
5+ exit 1
6+ fi
7+
38source ./utils.sh
49
510LEFTHOOK_VERSION=${VERSION:- " latest" }
@@ -14,11 +19,6 @@ apt_get_update
1419# Clean up
1520rm -rf /var/lib/apt/lists/*
1621
17- if [ " $( id -u) " -ne 0 ]; then
18- echo -e ' Scripts must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
19- exit 1
20- fi
21-
2222export DEBIAN_FRONTEND=noninteractive
2323
2424get_github_filename () {
@@ -39,19 +39,23 @@ install_from_github() {
3939 latest_version=${versions[0]}
4040 prev_version=${versions[1]}
4141
42+
4243 echo " Downloading lefthook v${latest_version} ...."
4344
4445 check_packages wget
4546 local arch=$( dpkg --print-architecture)
4647
4748 local filename=$( get_github_filename $latest_version $arch )
4849
50+ set +e
51+
4952 mkdir -p /tmp/lefthook
5053 pushd /tmp/lefthook
5154 wget ${GITHUB_REPO} /releases/download/v${latest_version} /${filename}
5255 local exit_code=$?
5356
5457 set -e
58+
5559 if [ " $exit_code " != " 0" ]; then
5660 # Handle situation where git tags are ahead of what was is available to actually download
5761 echo " (!) lefthook version ${latest_version} failed to download. Attempting to fall back to ${prev_version} to retry..."
You can’t perform that action at this time.
0 commit comments