Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

At dpkg postinst, ask for reboot instead of killing desktop #26

Merged
merged 2 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
build --host_cxxopt=-std=c++17
run --workspace_status_command="bash tools/workspace-status.sh"
build --workspace_status_command="bash tools/workspace-status.sh"
2 changes: 1 addition & 1 deletion .github/workflows/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
},
{
"name": "linux_amd64: build bb_clientd.deb",
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_amd64 //:bb_clientd_deb"
"run": "bazel build --stamp --platforms=@rules_go//go/toolchain:linux_amd64 //:bb_clientd_deb"
},
{
"name": "linux_amd64: copy bb_clientd.deb",
Expand Down
20 changes: 18 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
load("@gazelle//:def.bzl", "gazelle")
load("@rules_pkg//:pkg.bzl", "pkg_deb", "pkg_tar")

Expand Down Expand Up @@ -35,15 +36,30 @@ pkg_tar(
},
)

# When built with --stamp, creates a non-deterministic output file for pushing images to a remote registry.
# With --nostamp, produces a deterministic output so dependents get cache hits.
expand_template(
name = "deb_version_file",
out = "_deb_version.txt",
stamp_substitutions = {"_TAG_": "{{BUILD_SCM_TIMESTAMP}}-{{BUILD_SCM_REVISION}}"},
substitutions = {"_TAG_": "0~unknown"},
template = ["_TAG_"],
visibility = ["//visibility:public"],
)

pkg_deb(
name = "bb_clientd_deb",
architecture = "amd64",
architecture = select({
"@platforms//cpu:x86_64": "amd64",
"//conditions:default": "unknown",
}),
data = ":bb_clientd_deb_data",
depends = ["fuse"],
description = "The Buildbarn client daemon",
homepage = "https://github.com/buildbarn/bb-clientd",
maintainer = "The Buildbarn team",
package = "bb-clientd",
package_file_name = "bb-clientd.deb",
postinst = "configs/linux/postinst.sh",
version = "0.0.0",
version_file = ":deb_version_file",
)
2 changes: 2 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
module(name = "com_github_buildbarn_bb_clientd")

bazel_dep(name = "aspect_bazel_lib", version = "2.14.0")
bazel_dep(name = "bazel_remote_apis", version = "0.0.0")
bazel_dep(name = "com_github_buildbarn_bb_remote_execution")
bazel_dep(name = "com_github_buildbarn_bb_storage")
bazel_dep(name = "com_github_buildbarn_go_xdr")
bazel_dep(name = "gazelle", version = "0.42.0")
bazel_dep(name = "jsonnet_go", version = "0.20.0")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "protobuf", version = "29.3")
bazel_dep(name = "rules_jsonnet", version = "0.6.0")
bazel_dep(name = "rules_go", version = "0.53.0")
Expand Down
30 changes: 11 additions & 19 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion configs/linux/postinst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,27 @@ if ! grep -q '^user_allow_other$' /etc/fuse.conf; then
fi

# Pick up changes to /etc/logind.conf.
systemctl restart systemd-logind.service
if [ -z "$(loginctl --no-legend list-sessions)" ]; then
systemctl restart systemd-logind.service
else
# Restarting systemd-logind.service effectively kills user sessions and the
# users' desktop environment, so let the user get a hint about reboot
# instead.
if [ "$#" -ge 2 ] && [ "$1" = "configure" ]; then
old_version=$2
else
old_version=""
fi
# In the future, the old version can determine if reboot is required:
# if dpkg --compare-versions "$old_version" lt "20250312T094712Z-2b641c6"; then
if [ -z "$old_version" ]; then
/usr/share/update-notifier/notify-reboot-required
if [ -e /var/run/reboot-required ]; then
cat /var/run/reboot-required
fi
echo "Please reboot to apply changes to /etc/logind.conf"
fi
fi

# Pick up changes to the systemd service.
systemctl daemon-reload
Expand Down
2 changes: 1 addition & 1 deletion tools/github_workflows/github_workflows.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ workflows_template.getWorkflows(
steps+: [
{
name: 'linux_amd64: build bb_clientd.deb',
run: 'bazel build --platforms=@rules_go//go/toolchain:linux_amd64 //:bb_clientd_deb',
run: 'bazel build --stamp --platforms=@rules_go//go/toolchain:linux_amd64 //:bb_clientd_deb',
},
{
name: 'linux_amd64: copy bb_clientd.deb',
Expand Down