avatars/Makefile

41 lines
1.1 KiB
Makefile
Raw Normal View History

2019-03-23 23:56:39 +03:00
HOSTNAME_FQDN := codeberg.org
export BUILDDIR := /tmp/build
export GOROOT := ${BUILDDIR}/go
export GOPATH := ${BUILDDIR}/gitea
export PATH := ${GOROOT}/bin:${GOPATH}/bin:${PATH}
GOTAR = go1.11.2.$(shell uname | tr [:upper:] [:lower:])-amd64.tar.gz
ORIGIN = ssh://prlgc.com/git/gogs-gitea
TARGETS = ${GOPATH}/bin/avatar
all : ${TARGETS}
${GOPATH}/bin/avatar : main.go ${GOROOT}/bin/go
go build -o $@ $<
${GOROOT}/bin/go :
mkdir -p ${GOROOT}/Downloads
wget -c --no-verbose --directory-prefix=${GOROOT}/Downloads https://dl.google.com/go/${GOTAR}
tar xfz ${GOROOT}/Downloads/${GOTAR} -C ${BUILDDIR}
deployment : deploy-avatar
deploy-avatar : ${GOPATH}/bin/avatar
-ssh root@${HOSTNAME_FQDN} systemctl stop avatar
scp $< root@${HOSTNAME_FQDN}:/usr/local/bin/
scp -r etc/* root@${HOSTNAME_FQDN}:/etc/
ssh root@${HOSTNAME_FQDN} systemctl daemon-reload
ssh root@${HOSTNAME_FQDN} systemctl enable avatar
ssh root@${HOSTNAME_FQDN} systemctl start avatar
ssh root@${HOSTNAME_FQDN} systemctl status avatar
clean :
${MAKE} -C ${GOPATH}/src/code.gitea.io/gitea clean
realclean :
rm -rf ${BUILDDIR}