-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ryan Northey <ryan@synca.io>
- Loading branch information
Showing
14 changed files
with
531 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
load("//bazel:envoy_build_system.bzl", "envoy_package") | ||
load(":packages.bzl", "envoy_pkg_distros") | ||
load("@envoy_repo//:version.bzl", "VERSION") | ||
|
||
envoy_package() | ||
|
||
MAINTAINER = "Envoy maintainers <envoy-maintainers@googlegroups.com>" | ||
|
||
genrule( | ||
name = "envoy-bin", | ||
srcs = ["//source/exe:envoy-static.stripped"], | ||
outs = ["envoy"], | ||
cmd = "cp -L $< $@", | ||
) | ||
|
||
envoy_pkg_distros(version = VERSION, maintainer = MAINTAINER) | ||
|
||
sh_binary( | ||
name = "verify_packages", | ||
data = [ | ||
"//tools/distribution:verify", | ||
":distros.yaml", | ||
"//tools/distribution:distrotest.sh", | ||
], | ||
srcs = [":verification.sh"], | ||
args = [ | ||
"$(location //tools/distribution:verify)", | ||
"$(location //tools/distribution:distrotest.sh)", | ||
"$(location :distros.yaml)", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
load("//bazel:envoy_build_system.bzl", "envoy_package") | ||
|
||
envoy_package() | ||
|
||
exports_files([ | ||
"copyright", | ||
"preinst", | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: Envoy | ||
Source: <https://github.com/envoyproxy/envoy> | ||
|
||
Files: * | ||
Copyright: Copyright 2016-2018 Envoy Project Authors | ||
License: Apache | ||
/usr/share/common-licenses/Apache-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
load("@rules_pkg//:pkg.bzl", "pkg_deb", "pkg_tar") | ||
|
||
GLIBC_MIN_VERSION = "2.27" | ||
|
||
def envoy_pkg_deb(name = "envoy", version = None, data = ":deb-data.tar.xz", maintainer = None, **kwargs): | ||
arch = select({ | ||
"//bazel:x86": "amd64", | ||
"//conditions:default": "arm64", | ||
}) | ||
pkg_deb( | ||
name = "%s.deb" % name, | ||
architecture = arch, | ||
data = data, | ||
depends = [ | ||
"libc6 (>= %s)" % GLIBC_MIN_VERSION, | ||
], | ||
description = "Envoy built for Debian/Ubuntu", | ||
distribution = "buster bullseye impish hirstute", | ||
homepage = "https://www.envoyproxy.io/", | ||
maintainer = maintainer, | ||
package = name, | ||
version = version, | ||
# d = "%s_%s_%s.changes" % (name, version, arch), | ||
changes = "%s_%s.changes" % (name, version), | ||
preinst = "//distribution/debian:preinst", | ||
**kwargs, | ||
) | ||
|
||
def envoy_deb_data(bin_src = None, suffix = ""): | ||
remap_paths = {} | ||
if suffix: | ||
remap_paths["/envoy.%s" % suffix] = "/envoy" | ||
suffix = "-%s" % suffix | ||
|
||
pkg_tar( | ||
name = "bin%s" % suffix, | ||
extension = "tar", | ||
package_dir = "/usr/bin", | ||
srcs = [bin_src], | ||
mode = "0755", | ||
remap_paths = remap_paths, | ||
) | ||
|
||
pkg_tar( | ||
name = "deb-data%s" % suffix, | ||
extension = "tar.xz", | ||
deps = [ | ||
":config.tar", | ||
":bin%s.tar" % suffix, | ||
":copyright.tar", | ||
], | ||
) | ||
|
||
def envoy_pkg_debs(version = None, release_version = None, envoy_bin = None, maintainer = None): | ||
pkg_tar( | ||
name = "copyright", | ||
extension = "tar", | ||
srcs = ["//distribution/debian:copyright"], | ||
package_dir = "/usr/share/doc/envoy", | ||
) | ||
|
||
# generate deb data for base and dbg builds | ||
envoy_deb_data(bin_src = envoy_bin) | ||
|
||
# generate packages for this patch version | ||
envoy_pkg_deb(version = version, maintainer = maintainer) | ||
|
||
# generate packages for this minor version | ||
envoy_pkg_deb( | ||
name = "envoy-%s" % release_version, | ||
version = version, | ||
conflicts = ["envoy"], | ||
provides = ["envoy"], | ||
maintainer = maintainer) | ||
|
||
debs = ( | ||
"envoy.deb", | ||
"envoy-%s.deb" % release_version) | ||
|
||
changes = ( | ||
"envoy_%s.changes" % version, | ||
"envoy-%s_%s.changes" % (release_version, version)) | ||
|
||
# package all debs and changes files | ||
pkg_tar( | ||
name = "base_debs", | ||
extension = "tar", | ||
package_dir = "deb", | ||
srcs = [":%s" % deb for deb in debs + changes], | ||
) | ||
|
||
# select(arch) cant be used in the changes filepath so mangle it here | ||
arch = select({ | ||
"//bazel:x86": "amd64", | ||
"//conditions:default": "arm64", | ||
}) | ||
|
||
deb_mangle_cmd = "rm -rf /tmp/debs && mkdir -p /tmp/debs && tar xf $< -C /tmp/debs " | ||
for change in changes: | ||
change_root = ".".join(change.split(".")[:-1]) | ||
deb_mangle_cmd += "&& mv /tmp/debs/deb/%s /tmp/debs/deb/%s_" % (change, change_root) | ||
deb_mangle_cmd += arch + ".changes" | ||
deb_mangle_cmd += "&& tar cf $@ -C /tmp/debs ." | ||
|
||
native.genrule( | ||
name = "debs", | ||
srcs = [":base_debs"], | ||
outs = [":debs.tar"], | ||
cmd = deb_mangle_cmd, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#! /bin/sh | ||
|
||
# postinst script for envoy | ||
|
||
set -e | ||
|
||
if [ "$1" != "configure" ]; then | ||
exit 0 | ||
fi | ||
|
||
#DEBHELPER# | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#! /bin/sh | ||
|
||
# preinst script for envoy | ||
|
||
set -e | ||
|
||
addenvoyuser() { | ||
if ! getent group envoy >/dev/null; then | ||
addgroup --system envoy >/dev/null | ||
fi | ||
|
||
if ! getent passwd envoy >/dev/null; then | ||
adduser \ | ||
--system \ | ||
--disabled-login \ | ||
--ingroup envoy \ | ||
--no-create-home \ | ||
--home /nonexistent \ | ||
--gecos "envoy user" \ | ||
--shell /bin/false \ | ||
envoy >/dev/null | ||
|
||
fi | ||
} | ||
|
||
|
||
case "$1" in | ||
|
||
install) | ||
addenvoyuser | ||
cat <<BANNER | ||
Envoy installed!!! | ||
BANNER | ||
;; | ||
|
||
upgrade) | ||
addenvoyuser | ||
;; | ||
|
||
abort-upgrade) | ||
;; | ||
|
||
*) | ||
echo "preinst called with unknown argument \`$1'" >&2 | ||
exit 0 | ||
;; | ||
esac | ||
|
||
#DEBHELPER# | ||
|
||
exit 0 |
Oops, something went wrong.