forked from dokku/dokku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpm.mk
175 lines (156 loc) · 7.37 KB
/
rpm.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
RPM_ARCHITECTURE = x86_64
DOKKU_RPM_PACKAGE_NAME = dokku-$(DOKKU_VERSION)-1.$(RPM_ARCHITECTURE).rpm
DOKKU_UPDATE_RPM_PACKAGE_NAME = dokku-update-$(DOKKU_UPDATE_VERSION)-1.$(RPM_ARCHITECTURE).rpm
HEROKUISH_RPM_PACKAGE_NAME = herokuish-$(HEROKUISH_VERSION)-1.$(RPM_ARCHITECTURE).rpm
SSHCOMMAND_RPM_PACKAGE_NAME = sshcommand-$(SSHCOMMAND_VERSION)-1.$(RPM_ARCHITECTURE).rpm
SIGIL_RPM_PACKAGE_NAME = gliderlabs-sigil-$(SIGIL_VERSION)-1.$(RPM_ARCHITECTURE).rpm
.PHONY: rpm-all
rpm-all: rpm-setup rpm-herokuish rpm-dokku rpm-sshcommand rpm-sigil rpm-dokku-update
mv /tmp/*.rpm .
@echo "Done"
rpm-setup:
@echo "-> Installing rpm build requirements"
@sudo apt-get update -qq >/dev/null
@sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y gcc git build-essential wget ruby-dev ruby1.9.1 rpm >/dev/null 2>&1
@command -v fpm >/dev/null || sudo gem install fpm --no-ri --no-rdoc
@ssh -o StrictHostKeyChecking=no git@github.com || true
rpm-herokuish:
rm -rf /tmp/tmp /tmp/build $(BUILD_DIRECTORY)/$(HEROKUISH_RPM_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build
@echo "-> Creating rpm files"
@echo "#!/usr/bin/env bash" >> /tmp/tmp/post-install
@echo 'echo "Starting docker"' >> /tmp/tmp/post-install
@echo 'systemctl start docker' >> /tmp/tmp/post-install
@echo "sleep 5" >> /tmp/tmp/post-install
@echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install
@echo 'if [[ -n $${http_proxy+x} ]]; then echo "See the docker pull docs for proxy configuration"; fi' >> /tmp/tmp/post-install
@echo 'if [[ -n $${https_proxy+x} ]]; then echo "See the docker pull docs for proxy configuration"; fi' >> /tmp/tmp/post-install
@echo 'if [[ -n $${BUILDARGS+x} ]]; then echo "See the docker pull docs for proxy configuration"; fi' >> /tmp/tmp/post-install
@echo "sudo docker pull gliderlabs/herokuish:v${HEROKUISH_VERSION} && sudo docker tag gliderlabs/herokuish:v${HEROKUISH_VERSION} gliderlabs/herokuish:latest" >> /tmp/tmp/post-install
@echo "-> Creating $(HEROKUISH_RPM_PACKAGE_NAME)"
sudo fpm -t rpm -s dir -C /tmp/build -n herokuish \
--version $(HEROKUISH_VERSION) \
--architecture $(RPM_ARCHITECTURE) \
--package $(BUILD_DIRECTORY)/$(HEROKUISH_RPM_PACKAGE_NAME) \
--depends '/usr/bin/docker' \
--depends 'sudo' \
--after-install /tmp/tmp/post-install \
--url "https://github.com/$(HEROKUISH_REPO_NAME)" \
--description $(HEROKUISH_DESCRIPTION) \
--license 'MIT License' \
.
rpm-dokku:
rm -rf /tmp/tmp /tmp/build $(BUILD_DIRECTORY)/dokku_*_$(RPM_ARCHITECTURE).rpm
mkdir -p /tmp/tmp /tmp/build
mkdir -p /tmp/build/usr/share/bash-completion/completions
mkdir -p /tmp/build/usr/bin
mkdir -p /tmp/build/usr/share/doc/dokku
mkdir -p /tmp/build/usr/share/dokku/contrib
mkdir -p /tmp/build/usr/share/lintian/overrides
mkdir -p /tmp/build/usr/share/man/man1
mkdir -p /tmp/build/var/lib/dokku/core-plugins/available
cp dokku /tmp/build/usr/bin
cp LICENSE /tmp/build/usr/share/doc/dokku/copyright
cp contrib/bash-completion /tmp/build/usr/share/bash-completion/completions/dokku
find . -name ".DS_Store" -depth -exec rm {} \;
$(MAKE) go-build
cp common.mk /tmp/build/var/lib/dokku/core-plugins/common.mk
cp -r plugins/* /tmp/build/var/lib/dokku/core-plugins/available
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do cd /tmp/build/var/lib/dokku/core-plugins/available/$$plugin && if [ -e Makefile ]; then $(MAKE) src-clean; fi; done
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/core-plugins/available/$$plugin/.core; done
rm /tmp/build/var/lib/dokku/core-plugins/common.mk
$(MAKE) help2man
$(MAKE) addman
cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/share/man/man1/dokku.1
gzip -9 /tmp/build/usr/share/man/man1/dokku.1
cp contrib/dokku-installer.py /tmp/build/usr/share/dokku/contrib
ifeq ($(DOKKU_VERSION),master)
git describe --tags > /tmp/build/var/lib/dokku/VERSION
else
echo $(DOKKU_VERSION) > /tmp/build/var/lib/dokku/VERSION
endif
cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION
ifneq (,$(findstring false,$(IS_RELEASE)))
sed -i.bak -e "s/^/`date +%s`-/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak
endif
ifdef DOKKU_GIT_REV
echo "$(DOKKU_GIT_REV)" > /tmp/build/var/lib/dokku/GIT_REV
else
git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV
endif
@echo "-> Creating rpm package"
VERSION=$$(cat /tmp/build/var/lib/dokku/STABLE_VERSION); \
sudo fpm -t rpm -s dir -C /tmp/build -n dokku \
--version "$$VERSION" \
--architecture $(RPM_ARCHITECTURE) \
--package "$(BUILD_DIRECTORY)/$(DOKKU_RPM_PACKAGE_NAME)" \
--depends '/usr/bin/docker' \
--depends 'bind-utils' \
--depends 'curl' \
--depends 'gcc' \
--depends 'git' \
--depends 'gliderlabs-sigil' \
--depends 'make' \
--depends 'man-db' \
--depends 'nc' \
--depends 'nginx >= 1.8.0' \
--depends 'plugn' \
--depends 'procfile-util' \
--depends 'python' \
--depends 'sshcommand' \
--depends 'sudo' \
--after-install rpm/dokku.postinst \
--url "https://github.com/$(DOKKU_REPO_NAME)" \
--description $(DOKKU_DESCRIPTION) \
--license 'MIT License' \
.
rpm-dokku-update:
rm -rf $(BUILD_DIRECTORY)/$(DOKKU_UPDATE_RPM_PACKAGE_NAME)
echo "${DOKKU_UPDATE_VERSION}" > contrib/dokku-update-version
sudo fpm -t rpm -s dir -n dokku-update \
--version $(DOKKU_UPDATE_VERSION) \
--architecture $(RPM_ARCHITECTURE) \
--package $(BUILD_DIRECTORY)/$(DOKKU_UPDATE_RPM_PACKAGE_NAME) \
--depends 'dokku' \
--url "https://github.com/$(DOKKU_UPDATE_REPO_NAME)" \
--description $(DOKKU_UPDATE_DESCRIPTION) \
--license 'MIT License' \
contrib/dokku-update=/usr/local/bin/dokku-update \
contrib/dokku-update-version=/var/lib/dokku-update/VERSION
rpm-sshcommand:
rm -rf /tmp/tmp /tmp/build $(BUILD_DIRECTORY)/$(SSHCOMMAND_RPM_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin
@echo "-> Downloading package"
wget -q -O /tmp/tmp/sshcommand-$(SSHCOMMAND_VERSION) $(SSHCOMMAND_URL)
@echo "-> Copying files into place"
mkdir -p "/tmp/build/usr/bin"
cp /tmp/tmp/sshcommand-$(SSHCOMMAND_VERSION) /tmp/build/usr/bin/sshcommand
chmod +x /tmp/build/usr/bin/sshcommand
@echo "-> Creating $(SSHCOMMAND_RPM_PACKAGE_NAME)"
sudo fpm -t rpm -s dir -C /tmp/build -n sshcommand \
--version $(SSHCOMMAND_VERSION) \
--architecture $(RPM_ARCHITECTURE) \
--package $(BUILD_DIRECTORY)/$(SSHCOMMAND_RPM_PACKAGE_NAME) \
--url "https://github.com/$(SSHCOMMAND_REPO_NAME)" \
--category admin \
--description "$$SSHCOMMAND_DESCRIPTION" \
--license 'MIT License' \
.
rpm-sigil:
rm -rf /tmp/tmp /tmp/build $(BUILD_DIRECTORY)/$(SIGIL_RPM_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin
@echo "-> Downloading package"
wget -q -O /tmp/tmp/sigil-$(SIGIL_VERSION).tgz $(SIGIL_URL)
cd /tmp/tmp/ && tar zxf /tmp/tmp/sigil-$(SIGIL_VERSION).tgz
@echo "-> Copying files into place"
cp /tmp/tmp/sigil /tmp/build/usr/bin/sigil && chmod +x /tmp/build/usr/bin/sigil
@echo "-> Creating $(SIGIL_RPM_PACKAGE_NAME)"
sudo fpm -t rpm -s dir -C /tmp/build -n gliderlabs-sigil \
--version $(SIGIL_VERSION) \
--architecture $(RPM_ARCHITECTURE) \
--package $(BUILD_DIRECTORY)/$(SIGIL_RPM_PACKAGE_NAME) \
--url "https://github.com/$(SIGIL_REPO_NAME)" \
--category utils \
--description "$$SIGIL_DESCRIPTION" \
--license 'MIT License' \
.