AUTH-2644: Change install location and add man page

This commit is contained in:
Michael Borkenstein 2020-07-02 13:23:54 -05:00
parent b9d6aaebbe
commit 1ed9e0fceb
4 changed files with 25 additions and 9 deletions

View File

@ -4,7 +4,8 @@ VERSION_FLAGS := -ldflags='-X "main.Version=$(VERSION)" -X "main.BuildTime=$(DAT
IMPORT_PATH := github.com/cloudflare/cloudflared IMPORT_PATH := github.com/cloudflare/cloudflared
PACKAGE_DIR := $(CURDIR)/packaging PACKAGE_DIR := $(CURDIR)/packaging
INSTALL_BINDIR := usr/local/bin INSTALL_BINDIR := /usr/bin/
MAN_DIR := /usr/share/man/man1/
EQUINOX_FLAGS = --version="$(VERSION)" \ EQUINOX_FLAGS = --version="$(VERSION)" \
--platforms="$(EQUINOX_BUILD_PLATFORMS)" \ --platforms="$(EQUINOX_BUILD_PLATFORMS)" \
@ -86,19 +87,22 @@ publish-deb: cloudflared-deb
publish-rpm: cloudflared-rpm publish-rpm: cloudflared-rpm
$(call publish_package,yum) $(call publish_package,yum)
.PHONY: cloudflared-deb define build_package
cloudflared-deb: cloudflared
mkdir -p $(PACKAGE_DIR) mkdir -p $(PACKAGE_DIR)
cp cloudflared $(PACKAGE_DIR)/cloudflared cp cloudflared $(PACKAGE_DIR)/cloudflared
fakeroot fpm -C $(PACKAGE_DIR) -s dir -t deb --deb-compression bzip2 \ cat cloudflared_man_template | sed -e 's/\$${VERSION}/$(VERSION)/; s/\$${DATE}/$(DATE)/' > $(PACKAGE_DIR)/cloudflared.1
-a $(TARGET_ARCH) -v $(VERSION) -n cloudflared cloudflared=/usr/local/bin/ fakeroot fpm -C $(PACKAGE_DIR) -s dir -t $(1) --$(1)-compression bzip2 \
-a $(TARGET_ARCH) -v $(VERSION) -n cloudflared --after-install postinst.sh --after-remove postrm.sh \
cloudflared=$(INSTALL_BINDIR) cloudflared.1=$(MAN_DIR)
endef
.PHONY: cloudflared-deb
cloudflared-deb: cloudflared
$(call build_package,deb)
.PHONY: cloudflared-rpm .PHONY: cloudflared-rpm
cloudflared-rpm: cloudflared cloudflared-rpm: cloudflared
mkdir -p $(PACKAGE_DIR) $(call build_package,rpm)
cp cloudflared $(PACKAGE_DIR)/cloudflared
fakeroot fpm -C $(PACKAGE_DIR) -s dir -t rpm --rpm-compression bzip2 \
-a $(TARGET_ARCH) -v $(VERSION) -n cloudflared cloudflared=/usr/local/bin/
.PHONY: cloudflared-darwin-amd64.tgz .PHONY: cloudflared-darwin-amd64.tgz
cloudflared-darwin-amd64.tgz: cloudflared cloudflared-darwin-amd64.tgz: cloudflared

6
cloudflared_man_template Normal file
View File

@ -0,0 +1,6 @@
.\" Manpage for cloudflared.
.TH man 1 ${DATE} "${VERSION}" "cloudflared man page"
.SH NAME
cloudflared \- creates a connection to the cloudflare edge network
.SH DESCRIPTION
cloudflared creates a persistent connection between a local service and the Cloudflare network. Once the daemon is running and the Tunnel has been configured, the local service can be locked down to only allow connections from Cloudflare.

3
postinst.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
set -eu
ln -s /usr/bin/cloudflared /usr/local/bin/cloudflared

3
postrm.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
set -eu
rm /usr/local/bin/cloudflared