summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2021-07-01 13:26:48 +0100
committerNick Thomas <nick@gitlab.com>2021-07-01 13:47:38 +0100
commitc289756d4ee4cb11fc41dc5ac7aafe19bfc12b92 (patch)
tree263b4ece854a5ad7123528e3e4fab92aa6adce73
parent1a299b07881096ae7e5f5190687d2d6318662219 (diff)
downloadgitlab-shell-c289756d4ee4cb11fc41dc5ac7aafe19bfc12b92.tar.gz
Add a make install command
Changelog: added
-rw-r--r--Makefile17
-rw-r--r--README.md28
2 files changed, 38 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 9e4abba..88daed3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang coverage coverage_golang setup _install build compile check clean
+.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang coverage coverage_golang setup _script_install build compile check clean install
GO_SOURCES := $(shell find . -name '*.go')
VERSION_STRING := $(shell git describe --match v* 2>/dev/null || awk '$0="v"$0' VERSION 2>/dev/null || echo unknown)
@@ -6,6 +6,8 @@ BUILD_TIME := $(shell date -u +%Y%m%d.%H%M%S)
BUILD_TAGS := tracer_static tracer_static_jaeger continuous_profiler_stackdriver
GOBUILD_FLAGS := -ldflags "-X main.Version=$(VERSION_STRING) -X main.BuildTime=$(BUILD_TIME)" -tags "$(BUILD_TAGS)"
+PREFIX ?= /usr/local
+
validate: verify test
verify: verify_golang
@@ -30,9 +32,9 @@ coverage: coverage_golang
coverage_golang:
[ -f cover.out ] && go tool cover -func cover.out
-setup: _install bin/gitlab-shell
+setup: _script_install bin/gitlab-shell
-_install:
+_script_install:
bin/install
build: bin/gitlab-shell
@@ -45,3 +47,12 @@ check:
clean:
rm -f bin/check bin/gitlab-shell bin/gitlab-shell-authorized-keys-check bin/gitlab-shell-authorized-principals-check bin/gitlab-sshd
+
+install: compile
+ mkdir -p $(DESTDIR)$(PREFIX)/bin/
+ install -m755 bin/check $(DESTDIR)$(PREFIX)/bin/check
+ install -m755 bin/gitlab-shell $(DESTDIR)$(PREFIX)/bin/gitlab-shell
+ install -m755 bin/gitlab-shell $(DESTDIR)$(PREFIX)/bin/gitlab-shell-authorized-keys-check
+ install -m755 bin/gitlab-shell $(DESTDIR)$(PREFIX)/bin/gitlab-shell-authorized-principals-check
+ install -m755 bin/gitlab-shell $(DESTDIR)$(PREFIX)/bin/gitlab-sshd
+
diff --git a/README.md b/README.md
index 70f03d9..7847377 100644
--- a/README.md
+++ b/README.md
@@ -34,16 +34,36 @@ Download and install the current version of Go from https://golang.org/dl/
We follow the [Golang Release Policy](https://golang.org/doc/devel/release.html#policy)
of supporting the current stable version and the previous two major versions.
-## Setup
-
- make setup
-
## Check
Checks if GitLab API access and redis via internal API can be reached:
make check
+## Compile
+
+Builds the `gitlab-shell` binaries, placing them into `bin/`.
+
+ make compile
+
+## Install
+
+Builds the `gitlab-shell` binaries and installs them onto the filesystem. The
+default location is `/usr/local`, but can be controlled by use of the `PREFIX`
+and `DESTDIR` environment variables.
+
+ make install
+
+## Setup
+
+This command is intended for use when installing GitLab from source on a single
+machine. In addition to compiling the gitlab-shell binaries, it ensures that
+various paths on the filesystem exist with the correct permissions. Do not run
+it unless instructed to by your installation method documentation.
+
+ make setup
+
+
## Testing
Run tests: