mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-10 22:46:58 +02:00
Merge pull request #484 from crawford/nixos
sdk_lib: cleanup to support non-standard environs
This commit is contained in:
commit
8726e115b4
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
@ -185,9 +185,9 @@ generate_locales() {
|
|||||||
# with long multibyte strings. Newer setups have this fixed,
|
# with long multibyte strings. Newer setups have this fixed,
|
||||||
# but locale-gen doesn't need to be run in any locale in the
|
# but locale-gen doesn't need to be run in any locale in the
|
||||||
# first place, so just go with C to keep it fast.
|
# first place, so just go with C to keep it fast.
|
||||||
|
chroot "${FLAGS_chroot}" /usr/bin/env \
|
||||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin" LC_ALL=C \
|
PATH="/usr/sbin:/usr/bin:/sbin:/bin" LC_ALL=C \
|
||||||
chroot "${FLAGS_chroot}" locale-gen -q -u \
|
locale-gen -q -u -G "$(printf '%s\n' "${gen_locales[@]}")"
|
||||||
-G "$(printf '%s\n' "${gen_locales[@]}")"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,15 +398,16 @@ fi
|
|||||||
# the source trunk for scripts that may need to print it (e.g.
|
# the source trunk for scripts that may need to print it (e.g.
|
||||||
# build_image.sh).
|
# build_image.sh).
|
||||||
|
|
||||||
|
cmd=( /usr/bin/env PATH="/usr/sbin:/usr/bin:/sbin:/bin" LC_ALL=C )
|
||||||
if [ $FLAGS_early_make_chroot -eq $FLAGS_TRUE ]; then
|
if [ $FLAGS_early_make_chroot -eq $FLAGS_TRUE ]; then
|
||||||
cmd=( /bin/bash -l -c 'env "$@"' -- )
|
cmd+=( /bin/bash -l -c 'env "$@"' -- )
|
||||||
elif [ ! -x "${FLAGS_chroot}/usr/bin/sudo" ]; then
|
elif [ ! -x "${FLAGS_chroot}/usr/bin/sudo" ]; then
|
||||||
# Complain that sudo is missing.
|
# Complain that sudo is missing.
|
||||||
error "Failing since the chroot lacks sudo."
|
error "Failing since the chroot lacks sudo."
|
||||||
error "Requested enter_chroot command was: $@"
|
error "Requested enter_chroot command was: $@"
|
||||||
exit 127
|
exit 127
|
||||||
else
|
else
|
||||||
cmd=( sudo -i -u "${SUDO_USER}" )
|
cmd+=( sudo -i -u "${SUDO_USER}" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmd+=( "${CHROOT_PASSTHRU[@]}" "$@" )
|
cmd+=( "${CHROOT_PASSTHRU[@]}" "$@" )
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
@ -85,8 +85,9 @@ early_enter_chroot() {
|
|||||||
# the overhead of enter_chroot, and do not need access to the source tree,
|
# the overhead of enter_chroot, and do not need access to the source tree,
|
||||||
# don't need the actual chroot profile env, and can run the command as root.
|
# don't need the actual chroot profile env, and can run the command as root.
|
||||||
bare_chroot() {
|
bare_chroot() {
|
||||||
|
chroot "${FLAGS_chroot}" /usr/bin/env \
|
||||||
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
|
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
|
||||||
chroot "${FLAGS_chroot}" "$@"
|
"$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
|
Loading…
Reference in New Issue
Block a user