Skip to content

Commit 4a408d5

Browse files
authored
Merge pull request #1023 from basho/mas-3.0-debianmake
Mas 3.0 debianmake
2 parents 7a47a9b + 3c8bc91 commit 4a408d5

28 files changed

+265
-197
lines changed

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ rel: locked-deps compile
8282
rel-rpm: locked-deps compile
8383
$(REBAR) as rel,rpm release
8484

85+
rel-deb: locked-deps compile
86+
$(REBAR) as deb release
87+
cp -a _build/deb/rel/riak rel/
88+
8589
relclean:
8690
rm -rf $(REL_DIR)
8791
rm -rf rel/riak
@@ -303,8 +307,9 @@ pkgclean: ballclean
303307
PKG_VERSION = $(shell echo $(PKG_ID) | sed -e 's/^$(REPO)-//')
304308

305309
package:
306-
git archive --format=tar HEAD | gzip >rel/pkg/out/riak-$(PKG_ID).tar.gz
307-
$(MAKE) -C rel/pkg/ -f Makefile
310+
mkdir rel/pkg/out/riak-$(PKG_ID)
311+
git archive --format=tar HEAD | gzip >rel/pkg/out/$(PKG_ID).tar.gz
312+
$(MAKE) -f rel/pkg/Makefile
308313

309314
packageclean:
310315
rm -rf rel/pkg/out/*

rebar.config

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@
8686
{template, "rel/files/riak-chkconfig", "bin/riak-chkconfig"},
8787
{template, "rel/files/riak-repl", "bin/riak-repl"},
8888

89+
{template, "rel/files/riak", "usr/bin/riak"},
90+
{template, "rel/files/riakpre", "usr/bin/riakpre"},
91+
{template, "rel/files/riakrun", "usr/bin/riakrun"},
92+
8993
{copy, "rel/files/check_ulimit", "bin/hooks/check_ulimit"},
9094
{copy, "rel/files/riak_not_running", "bin/hooks/riak_not_running"}
9195

@@ -98,43 +102,60 @@
98102
{debug, "riak-debug"},
99103
{repl, "riak-repl"},
100104
{chkconfig, "riak-chkconfig"}
101-
]},
102-
105+
]}
103106

104-
{extended_start_script_hooks,
105-
[ {pre_start,
106-
[{custom, "hooks/riak_not_running"},
107-
{custom, "hooks/check_ulimit"}]},
108-
{post_start,
109-
[{wait_for_process, riak_core_node_watcher}
110-
]}
111-
]}
112107
]}.
113108

114109
{dialyzer, [{plt_apps, all_deps}]}.
115110

116111
{profiles, [
117112
{rel, [
118113
{relx, [
119-
{overlay_vars, "rel/vars.config"}
114+
{overlay_vars, "rel/vars.config"},
115+
{extended_start_script_hooks,
116+
[{pre_start,
117+
[{custom, "hooks/riak_not_running"},
118+
{custom, "hooks/check_ulimit"}]},
119+
{post_start,
120+
[{wait_for_process, riak_core_node_watcher}]}
121+
]}
120122
]}
121123
]},
122-
{dev, [
123-
{relx, [
124-
{dev_mode, true}
125-
]}
124+
{dev, [{relx, [{dev_mode, true}]}
126125
]},
127126
{rpm, [
128127
{relx, [
129128
{overlay_vars, "rpm.vars.config"},
130129
{overlay, [
131-
{template, "rel/pkg/rpm/riak", "usr/bin/riak"}
132-
]}
130+
131+
]},
132+
{extended_start_script_hooks,
133+
[{pre_start,
134+
[{custom, "hooks/riak_not_running"},
135+
{custom, "hooks/check_ulimit"}]},
136+
{post_start,
137+
[{pid, "/run/riak/riak.pid"},
138+
{wait_for_process, riak_core_node_watcher}]}
139+
]}
133140
]}
134141
]},
135142
{deb, [
136143
{relx, [
137-
{overlay_vars, "deb.vars.config"}
144+
{overlay_vars, "debian/vars.config"},
145+
{overlay, [
146+
{template, "rel/files/riak", "usr/bin/riak"},
147+
{template, "rel/files/riakpre", "usr/bin/riakpre"},
148+
{template, "rel/files/riakrun", "usr/bin/riakrun"}
149+
]},
150+
{extended_start_script_hooks,
151+
[{pre_start,
152+
[{custom, "hooks/riak_not_running"},
153+
{custom, "hooks/check_ulimit"}]},
154+
{post_start,
155+
[wait_for_vm_start,
156+
{pid, "/run/riak/riak.pid"},
157+
{wait_for_process, riak_core_node_watcher}]}
158+
]}
138159
]}
139160
]}
140161
]}.

rel/files/advanced.config

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,9 @@
100100
]
101101
}
102102
]
103-
}
103+
},
104+
{setup,
105+
[
106+
{home, "{{platform_data_dir}}/setup"}
107+
]}
104108
].

rel/files/riak

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
source riakpre
4+
5+
su - riak -c "riakrun ${*}"
6+

rel/files/riakpre

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
RUNNER_GEN_DIR="${RUNNER_GEN_DIR:-{{ platform_gen_dir }}}"
4+
RELEASE_ROOT_DIR="${RELEASE_ROOT_DIR:-{{ runner_base_dir }}}"
5+
PID_DIR={{pid_dir}}
6+
7+
8+
# Switch (+) required on systemd to ensure this is run as root
9+
# as ExecStartPre
10+
if [[ $EUID -ne 0 ]]; then
11+
echo "You need to be root or use sudo to run this command."
12+
exit 1
13+
fi
14+
15+
# If calling ping, admin, stop etc - this has been started and so
16+
# these files should have been created by cf_config
17+
if [ -e "$RUNNER_GEN_DIR/vm.args" ]; then
18+
ln -sf $RUNNER_GEN_DIR/vm.args $RELEASE_ROOT_DIR/vm.args
19+
fi
20+
21+
if [ -e "$RUNNER_GEN_DIR/sys.config" ]; then
22+
ln -sf $RUNNER_GEN_DIR/sys.config $RELEASE_ROOT_DIR/sys.config
23+
fi
24+
25+
# Expect this to have been created by systemd, unless
26+
# user has called sudo /usr/sbin/riak directly
27+
if [ ! -d $PID_DIR ]; then
28+
mkdir $PID_DIR
29+
chown riak:riak $PID_DIR
30+
fi

rel/files/riakrun

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
COMMAND={{platform_bin_dir}}/riak
4+
RUNNER_LOG_DIR={{platform_log_dir}}
5+
6+
case "$1" in
7+
start|console|foreground)
8+
RUNNER_LOG_DIR=${RUNNER_LOG_DIR} PIPE_DIR=${PIPE_DIR} ${COMMAND} ${*} -pa {{platform_lib_dir}}/patches
9+
;;
10+
*)
11+
RUNNER_LOG_DIR=${RUNNER_LOG_DIR} PIPE_DIR=${PIPE_DIR} ${COMMAND} ${*}
12+
;;
13+
esac

rel/pkg/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ PKG_BUILD ?= 1
8383
## Call platform dependent makefile
8484
ostype: varcheck
8585
$(if $(PKGERDIR),,$(error "Operating system '$(OS)' not supported by node_package"))
86-
$(MAKE) -C $(PKGERDIR) -f Makefile
86+
$(MAKE) -C $(BASE_DIR)/rel/pkg/out/riak-$(PKG_ID) -f $(BASE_DIR)/rel/pkg/$(PKGERDIR)/Makefile
8787

8888
## Check required settings before continuing
8989
varcheck:

rel/pkg/deb/Makefile

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
1+
export
2+
3+
TAR_VERSION = $(shell git describe --tags | sed -e 's/\([0-9.]*\-[0-9]*\)-.*/\1/')
14

25
default:
3-
ln -sf $(PKG_ID).tar.gz ../{{package_name}}_$(PKG_VERSION).orig.tar.gz
4-
export DEBFULLNAME="{{vendor_contact_name}}"; \
5-
export DEBEMAIL="{{vendor_contact_email}}"; \
6-
dch --create --package {{package_name}} -v "$(PKG_VERSION)-$(PKG_BUILD)" \
7-
"Build from $(PKG_VERSION)";\
6+
mkdir -p $(BASE_DIR)/rel/pkg/out/$(PKG_ID)/debian
7+
cp -R $(BASE_DIR)/rel/pkg/deb/debian/* $(BASE_DIR)/rel/pkg/out/$(PKG_ID)/debian
8+
9+
tar -xf $(BASE_DIR)/rel/pkg/out/$(PKG_ID).tar.gz -C $(BASE_DIR)/rel/pkg/out/$(PKG_ID)/
10+
ln -sf $(BASE_DIR)/rel/pkg/out/$(PKG_ID).tar.gz $(BASE_DIR)/rel/pkg/out/$(TAR_VERSION).orig.tar.gz
11+
12+
cd $(BASE_DIR)/rel/pkg/out/$(PKG_ID)/; \
13+
echo $(shell pwd); \
14+
dch --create --package riak -v "$(PKG_VERSION)" \
15+
"Build from $(PKG_ID)";\
816
debuild --prepend-path=$(ERLANG_BIN) \
9-
-e REVISION=$(PKG_VERSION) \
10-
-e RELEASE=$(PKG_BUILD) \
11-
-e REBAR=$(REBAR) \
12-
{{debuild_extra_options}} \
13-
-uc -us
14-
mkdir -p ../packages
15-
cd .. && mv *$(PKG_VERSION)-$(PKG_BUILD)_*.deb packages
16-
cd ../packages && \
17+
-e REVISION=$(PKG_VERSION) \
18+
-e RELEASE=$(PKG_BUILD) \
19+
-e REBAR=$(REBAR) \
20+
-i -uc -us -b
21+
22+
mkdir -p $(BASE_DIR)/rel/pkg/packages
23+
cd $(BASE_DIR)/rel/pkg/out && mv *.deb ../packages
24+
cd $(BASE_DIR)/rel/pkg/packages && \
1725
for debfile in *.deb; do \
1826
sha256sum $${debfile} > $${debfile}.sha \
1927
; done

rel/pkg/deb/control

Lines changed: 0 additions & 16 deletions
This file was deleted.

rel/pkg/deb/copyright

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)