From 0979a483b41308471a58362167c265db378505e1 Mon Sep 17 00:00:00 2001 From: Malte Poll Date: Mon, 11 Sep 2023 15:46:58 +0200 Subject: [PATCH] debugd: package as tar --- debugd/cmd/debugd/BUILD.bazel | 22 +++++++++++++++++++ .../service/system-preset/20-debugd.preset | 1 + .../cmd/debugd/service/system/debugd.service | 15 +++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 debugd/cmd/debugd/service/system-preset/20-debugd.preset create mode 100644 debugd/cmd/debugd/service/system/debugd.service diff --git a/debugd/cmd/debugd/BUILD.bazel b/debugd/cmd/debugd/BUILD.bazel index 3ee7c7917..40d946f36 100644 --- a/debugd/cmd/debugd/BUILD.bazel +++ b/debugd/cmd/debugd/BUILD.bazel @@ -1,4 +1,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") +load("@rules_pkg//:pkg.bzl", "pkg_tar") +load("@rules_pkg//pkg:mappings.bzl", "pkg_files") load("//bazel/go:platform.bzl", "platform_binary") go_library( @@ -42,3 +44,23 @@ platform_binary( target_file = ":debugd", visibility = ["//visibility:public"], ) + +pkg_files( + name = "debugd_unit", + srcs = glob(["service/**"]), + renames = { + "service/system-preset/20-debugd.preset": "usr/lib/systemd/system-preset/20-debugd.preset", + "service/system/debugd.service": "usr/lib/systemd/system/debugd.service", + }, +) + +pkg_tar( + name = "debugd-package", + srcs = [ + ":debugd_linux_amd64", + ":debugd_unit", + ], + mode = "0755", + remap_paths = {"/platform:linux_amd64_gnu.2.23": "/usr/bin/debugd"}, + visibility = ["//visibility:public"], +) diff --git a/debugd/cmd/debugd/service/system-preset/20-debugd.preset b/debugd/cmd/debugd/service/system-preset/20-debugd.preset new file mode 100644 index 000000000..2ef246172 --- /dev/null +++ b/debugd/cmd/debugd/service/system-preset/20-debugd.preset @@ -0,0 +1 @@ +enable debugd.service diff --git a/debugd/cmd/debugd/service/system/debugd.service b/debugd/cmd/debugd/service/system/debugd.service new file mode 100644 index 000000000..fe2a30c44 --- /dev/null +++ b/debugd/cmd/debugd/service/system/debugd.service @@ -0,0 +1,15 @@ +[Unit] +Description=Constellation Debug Daemon +Wants=network-online.target +After=network-online.target configure-constel-csp.service + +[Service] +Type=simple +RemainAfterExit=yes +Restart=on-failure +EnvironmentFile=/run/constellation.env +Environment=PATH=/run/state/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin +ExecStart=debugd + +[Install] +WantedBy=multi-user.target