Skip to content

Commit

Permalink
Merge pull request #178 from basho/2.0
Browse files Browse the repository at this point in the history
Merge 2.0 branch into develop
  • Loading branch information
zeeshanlakhani committed Mar 19, 2015
2 parents a829631 + 39e3e50 commit 2ef1a18
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 33 deletions.
2 changes: 1 addition & 1 deletion priv/base/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ APP_VSN=${START_ERL#* }
ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin

# Setup command to control the node
NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG $NET_TICKTIME_ARG"
NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NET_TICKTIME_ARG $NAME_ARG $COOKIE_ARG"
NODETOOL_LITE="$ERTS_PATH/escript $ERTS_PATH/nodetool"


Expand Down
18 changes: 18 additions & 0 deletions priv/base/nodetool
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ main(Args) ->
{badrpc, Reason} ->
io:format(standard_error, "RPC to ~p failed: ~p\n", [TargetNode, Reason]),
halt(1);
{error, Code} when is_integer(Code) ->
halt(Code);
{error, Code, Reason} when is_integer(Code) ->
io:format(standard_error, "ERROR: ~p\n", [Reason]),
halt(Code);
_ ->
halt(1)
end;
Expand All @@ -81,6 +86,11 @@ main(Args) ->
{badrpc, Reason} ->
io:format(standard_error, "RPC to ~p failed: ~p\n", [TargetNode, Reason]),
halt(1);
{error, Code} when is_integer(Code) ->
halt(Code);
{error, Code, Reason} when is_integer(Code) ->
io:format(standard_error, "ERROR: ~p\n", [Reason]),
halt(Code);
_ ->
halt(1)
end;
Expand All @@ -90,6 +100,11 @@ main(Args) ->
{badrpc, Reason} ->
io:format(standard_error, "RPC to ~p failed: ~p\n", [TargetNode, Reason]),
halt(1);
{error, Code} when is_integer(Code) ->
halt(Code);
{error, Code, Reason} when is_integer(Code) ->
io:format(standard_error, "ERROR: ~p\n", [Reason]),
halt(Code);
Other ->
io:format("~p\n", [Other])
end;
Expand All @@ -101,6 +116,9 @@ main(Args) ->

process_args([], Acc, TargetNode) ->
{lists:reverse(Acc), TargetNode};
process_args(["-kernel", "net_ticktime", Value | Rest], Acc, TargetNode) ->
application:set_env(kernel, net_ticktime, list_to_integer(Value)),
process_args(Rest, Acc, TargetNode);
process_args(["-setcookie", Cookie | Rest], Acc, TargetNode) ->
erlang:set_cookie(node(), list_to_atom(Cookie)),
process_args(Rest, Acc, TargetNode);
Expand Down
5 changes: 4 additions & 1 deletion priv/templates/deb/control
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Homepage: {{vendor_url}}

Package: {{package_name}}
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}, adduser, logrotate, {{deb_depends}}
Depends: ${misc:Depends}, ${shlibs:Depends}, adduser, logrotate, sudo, {{deb_depends}}
Homepage: {{vendor_url}}
Description: {{package_shortdesc}}
{{package_desc}}
{{package_replacement_line}}
{{package_conflicts_line}}
2 changes: 2 additions & 0 deletions priv/templates/deb/deb.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
{package_install_user, "package_install_user"},
{package_install_user_desc, "package_install_user_desc"},
{package_install_group, "package_install_group"},
{package_replacement_line, "{{package_replacement_line_debian}}"},
{package_conflicts_line, "{{package_conflicts_line_debian}}"},
{vendor_name, "vendor_name"},
{vendor_url, "vendor_url"},
{vendor_contact_name, "vendor_contact_name"},
Expand Down
3 changes: 0 additions & 3 deletions priv/templates/deb/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ case "$1" in
# ensure we remove the rc.d scripts installed by postinst
update-rc.d {{package_install_name}} remove >/dev/null

if [ -d /var/lib/{{package_install_name}} ]; then
rm -r /var/lib/{{package_install_name}}
fi
if [ -d /var/log/{{package_install_name}} ]; then
rm -r /var/log/{{package_install_name}}
fi
Expand Down
2 changes: 2 additions & 0 deletions priv/templates/deb/vars.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
{runner_lib_dir, "{{platform_lib_dir}}"}.
{runner_patch_dir, "{{platform_lib_dir}}/{{package_patch_dir}}"}.
{pipe_dir, "/tmp/{{package_install_name}}/"}.
{package_replacement_line, "{{package_replacement_line_debian}}"}.
{package_conflicts_line, "{{package_replacement_line_debian}}"}.
2 changes: 1 addition & 1 deletion priv/templates/fbsd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ $(BUILD_STAGE_DIR): buildrel
# * Ensure all binaries are executable
# * copy the vars.config over for build config
buildrel:
OVERLAY_VARS="overlay_vars=../fbsd/vars.config" $(MAKE) deps rel
OVERLAY_VARS="overlay_vars=../fbsd/vars.config" $(MAKE) rel
chmod 0755 rel/{{package_install_name}}/bin/* rel/{{package_install_name}}/erts-*/bin/*

$(BUILDDIR):
Expand Down
32 changes: 15 additions & 17 deletions priv/templates/fbsdng/+MANIFEST
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
name: {{package_name}}
origin: {{freebsd_package_category}}
comment: {{package_shortdesc}}
licenses: [{{license_type}}]
licenselogic: single
arch: freebsd:10:x86:64
www: {{vendor_url}}
maintainer: {{vendor_contact_email}}
users: [{{package_install_user}}]
groups: [{{package_install_group}}]
prefix: /usr/local
categories: [{{freebsd_package_category}}]
name: "{{package_name}}"
origin: "{{freebsd_package_category}}"
comment: "{{package_shortdesc}}"
licenses: ["{{license_type}}"]
licenselogic: "single"
arch: "freebsd:10:x86:64"
www: "{{vendor_url}}"
maintainer: "{{vendor_contact_email}}"
users: ["{{package_install_user}}"]
groups: ["{{package_install_group}}"]
prefix: "/usr/local"
categories: ["{{freebsd_package_category}}"]
desc: "{{package_desc}}"
scripts:
pre-install: |-
if ! pw groupshow {{package_install_group}} 2>/dev/null; then pw groupadd {{package_install_group}}; fi
if ! pw usershow {{package_install_user}} 2>/dev/null; then pw useradd {{package_install_user}} -g {{package_install_group}} -h - -d {{platform_data_dir}} -s /bin/sh -c \"{{package_install_user_desc}}\"; fi
if [ ! -d /var/log/{{package_install_name}} ]; then mkdir /var/log/{{package_install_name}} && chown {{package_install_user}}:{{package_install_group}} /var/log/{{package_install_name}}; fi
scripts: {
pre-install: "if ! pw groupshow {{package_install_group}} 2>/dev/null; then pw groupadd {{package_install_group}}; fi \n if ! pw usershow {{package_install_user}} 2>/dev/null; then pw useradd {{package_install_user}} -g {{package_install_group}} -h - -d {{platform_data_dir}} -s /bin/sh -c \"{{package_install_user_desc}}\"; fi \n if [ ! -d /var/log/{{package_install_name}} ]; then mkdir /var/log/{{package_install_name}} && chown {{package_install_user}}:{{package_install_group}} /var/log/{{package_install_name}}; fi"
}
22 changes: 14 additions & 8 deletions priv/templates/fbsdng/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,33 @@ packing_list_files: $(BUILD_STAGE_DIR)
chmod -w ${BUILD_STAGE_DIR}/usr/local/etc/rc.d/{{package_install_name}}
chmod +x ${BUILD_STAGE_DIR}/usr/local/etc/rc.d/{{package_install_name}}
@cd $(BUILD_STAGE_DIR) && \
echo "version: ${PKG_VERSION}" >> +MANIFEST && \
echo "files:" >> +MANIFEST
echo "version: \"${PKG_VERSION}\"" >> +MANIFEST && \
echo "files: {" >> +MANIFEST

@echo "Copying Man pages to staging directory"
@cd $(BUILDDIR) && \
if [ -d doc/man/man1 ]; then \
mkdir -p $(PMAN_DIR) && \
cp -R doc/man/man1 $(PMAN_DIR); fi


@echo "Packaging /usr/local files"
@cd $(BUILD_STAGE_DIR) && \
find usr -type f | while read file ; do \
mode=$$(stat -f%p "$$file" | cut -c 3-) && \
sum=$$(sha256 -q $$file) && \
echo " /$$file: { sum: $$sum, perm: $$mode, uname: root, gname: wheel }" >> +MANIFEST; done
echo " /$$file: { sum: \"$$sum\", perm: \"$$mode\", uname: \"root\", gname: \"wheel\" }," >> +MANIFEST; done && \
sed -i .bak '$$s/,$$//' +MANIFEST && \
rm -- +MANIFEST.bak && \
echo " }" >> +MANIFEST


@cd $(BUILD_STAGE_DIR) && \
echo "directories:" >> +MANIFEST && \
echo " {{platform_base_dir}}: {}" >> +MANIFEST && \
echo " {{platform_data_dir}}: {uname: {{package_install_user}}, gname: {{package_install_group}}, perm: 0700 }" >> +MANIFEST && \
echo " {{platform_etc_dir}}: {}" >> +MANIFEST
echo "directories: {" >> +MANIFEST && \
echo " {{platform_base_dir}}: \"y\"," >> +MANIFEST && \
echo " {{platform_data_dir}}: {uname: \"{{package_install_user}}\", gname: \"{{package_install_group}}\", perm: \"0700\" }," >> +MANIFEST && \
echo " {{platform_etc_dir}}: \"y\"" >> +MANIFEST && \
echo " }" >> +MANIFEST

# Copy the app rel directory to the staging directory to build our
# package structure and move the directories into the right place
Expand All @@ -88,7 +94,7 @@ $(BUILD_STAGE_DIR): buildrel
# * Ensure all binaries are executable
# * copy the vars.config over for build config
buildrel:
OVERLAY_VARS="overlay_vars=../fbsdng/vars.config" $(MAKE) deps rel
OVERLAY_VARS="overlay_vars=../fbsdng/vars.config" $(MAKE) rel
chmod 0755 rel/{{package_install_name}}/bin/* rel/{{package_install_name}}/erts-*/bin/*

$(BUILDDIR):
Expand Down
1 change: 1 addition & 0 deletions priv/templates/smartos/+INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ if [ "$2" = "POST-INSTALL" ]; then

# Ensure proper ownership of lib directory
chown -R {{package_install_user}}:{{package_install_group}} {{platform_lib_dir}}
chmod -R g+r {{platform_lib_dir}}

# Treat new configuration files as new if old ones already exist
# if FILE and FILE.bak both exist, move FILE to FILE.new and FILE.bak to FILE
Expand Down
2 changes: 1 addition & 1 deletion priv/templates/smartos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ patch_runner: buildrel
# * Ensure all binaries are executable
# * copy the vars.config over for build config
buildrel: $(BUILDDIR) smartos_check
OVERLAY_VARS="overlay_vars=../smartos/vars.config" $(MAKE) deps rel
OVERLAY_VARS="overlay_vars=../smartos/vars.config" $(MAKE) rel
chmod 0755 $(BUILDDIR)/rel/{{package_install_name}}/bin/* $(BUILDDIR)/rel/{{package_install_name}}/erts-*/bin/*

$(BUILDDIR):
Expand Down
2 changes: 1 addition & 1 deletion priv/templates/solaris/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ buildrel:
@# Make sure we set our EUID properly
@# Ye Olde Bourne Shell on Solaris means we have to do it old school
echo "Using `which erl` to build"; \
OVERLAY_VARS="overlay_vars=../solaris/vars.config" $(MAKE) deps rel
OVERLAY_VARS="overlay_vars=../solaris/vars.config" $(MAKE) rel
chmod 0755 rel/{{package_install_name}}/bin/* \
rel/{{package_install_name}}/erts-*/bin/*
if [ "{{bin_or_sbin}}" != "bin" ]; then \
Expand Down

0 comments on commit 2ef1a18

Please sign in to comment.