Skip to content

Commit be23df1

Browse files
committed
build: clean up chroot environment + systemd disable noise
chroot_custom / chroot_custom_long_running: add LC_ALL="C" LANG="C" LANGUAGE="" SUDO_USER="" (parity with chroot_sdcard/chroot_mount). disable_systemd_service_sdcard: use systemctl --root= instead of D-Bus; output at debug level only.
1 parent 7c39bd9 commit be23df1

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

lib/functions/logging/runners.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ function chroot_sdcard_with_stdout() {
156156
function chroot_custom_long_running() { # any pipe causes the left-hand side to subshell and caos ensues. it's just like chroot_custom()
157157
local target=$1
158158
shift
159-
raw_command="$*" raw_extra="chroot_custom_long_running" TMPDIR="" run_host_command_logged_raw chroot "${target}" /usr/bin/env bash -e -o pipefail -c "$*"
159+
raw_command="$*" raw_extra="chroot_custom_long_running" TMPDIR="" LC_ALL="C" LANG="C" LANGUAGE="" SUDO_USER="" run_host_command_logged_raw chroot "${target}" /usr/bin/env bash -e -o pipefail -c "$*"
160160
}
161161

162162
function chroot_custom() {
163163
local target=$1
164164
shift
165-
raw_command="$*" raw_extra="chroot_custom" TMPDIR="" run_host_command_logged_raw chroot "${target}" /usr/bin/env bash -e -o pipefail -c "$*"
165+
raw_command="$*" raw_extra="chroot_custom" TMPDIR="" LC_ALL="C" LANG="C" LANGUAGE="" SUDO_USER="" run_host_command_logged_raw chroot "${target}" /usr/bin/env bash -e -o pipefail -c "$*"
166166
}
167167

168168
# For installing packages host-side. Not chroot!

lib/functions/rootfs/systemd-utils.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99

1010
function disable_systemd_service_sdcard() {
1111
display_alert "Disabling systemd service(s) on target" "${*}" "debug"
12-
declare service
12+
declare service stderr_output
1313
for service in "${@}"; do
14-
chroot_sdcard systemctl --no-reload disable "${service}" "||" true
14+
# Use --root= to operate directly on the chroot filesystem
15+
# instead of talking to the host's systemd via D-Bus (which
16+
# doesn't know about the chroot's unit files).
17+
stderr_output="$(systemctl --root="${SDCARD}" --no-reload disable "${service}" 2>&1)" || true
18+
[[ -n "${stderr_output}" ]] && display_alert "systemctl disable ${service}" "${stderr_output}" "debug"
1519
done
1620
}

0 commit comments

Comments
 (0)