Skip to content

Introduce a lfs template #573

@tschm

Description

@tschm
    @# -----------------------------
@# Git LFS install (cross-platform)
@# -----------------------------
@UNAME_S=$$(uname -s); \
UNAME_M=$$(uname -m); \
if [ "$$UNAME_S" = "Darwin" ]; then \
	printf "${BLUE}[INFO] macOS detected ($$UNAME_M)${RESET}\n"; \
	mkdir -p .local/bin .local/tmp; \
	GIT_LFS_VERSION=$$(curl -sI https://github.com/git-lfs/git-lfs/releases/latest | grep -i '^location:' | sed 's/.*tag\/v//;s/[[:space:]]*$$//'); \
	printf "${BLUE}[INFO] Installing git-lfs v$$GIT_LFS_VERSION${RESET}\n"; \
	if [ "$$UNAME_M" = "arm64" ]; then \
		curl -fL -o .local/tmp/git-lfs.zip \
			"https://github.com/git-lfs/git-lfs/releases/download/v$$GIT_LFS_VERSION/git-lfs-darwin-arm64-v$$GIT_LFS_VERSION.zip"; \
	else \
		curl -fL -o .local/tmp/git-lfs.zip \
			"https://github.com/git-lfs/git-lfs/releases/download/v$$GIT_LFS_VERSION/git-lfs-darwin-amd64-v$$GIT_LFS_VERSION.zip"; \
	fi; \
	unzip -o -q .local/tmp/git-lfs.zip -d .local/tmp; \
	cp .local/tmp/git-lfs-*/git-lfs .local/bin/; \
	chmod +x .local/bin/git-lfs; \
	PATH=$$PWD/.local/bin:$$PATH git-lfs install; \
	rm -rf .local/tmp; \
elif [ "$$UNAME_S" = "Linux" ]; then \
	printf "${BLUE}[INFO] Linux detected${RESET}\n"; \
	if ! command -v git-lfs >/dev/null 2>&1; then \
		printf "${BLUE}[INFO] Installing git-lfs via apt...${RESET}\n"; \
		apt-get update && apt-get install -y git-lfs; \
	fi; \
	git lfs install; \
else \
	printf "${RED}[ERROR] Unsupported OS: $$UNAME_S${RESET}\n"; \
	exit 1; \
fi

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions