Compare commits

..

2 Commits

Author SHA1 Message Date
lilydjwg lilydjwg
603e09f8b1 Merge branch 'run-inside-service' into 'master'
feat(arch-nspawn): use --keep-unit when running inside a service

See merge request archlinux/devtools!197
2025-07-26 14:10:13 +00:00
lilydjwg
2c792e44aa feat(arch-nspawn): use --keep-unit when $DEVTOOLS_KEEP_UNIT is set to 1 2024-04-28 11:28:11 +08:00
2 changed files with 16 additions and 9 deletions

View File

@@ -61,13 +61,20 @@ nspawn_args=(
--directory="$working_dir"
--setenv="PATH=/usr/local/sbin:/usr/local/bin:/usr/bin"
--register=no
--slice="devtools-$(systemd-escape "${SUDO_USER:-$USER}")"
--machine="arch-nspawn-$$"
--as-pid2
--console=autopipe
--timezone=off
)
if [[ ${DEVTOOLS_KEEP_UNIT:-0} == 1 ]]; then
nspawn_args+=(--keep-unit)
else
nspawn_args+=(
--slice="devtools-$(systemd-escape "${SUDO_USER:-$USER}")"
--machine="arch-nspawn-$$"
)
fi
if (( ${#cache_dirs[@]} == 0 )); then
mapfile -t cache_dirs < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" CacheDir)
fi

View File

@@ -94,19 +94,19 @@ pkgctl_license_check() {
pushd "${path}" >/dev/null
if [[ ! -f PKGBUILD ]]; then
msg_error "${BOLD}${path}:${ALL_OFF} no PKGBUILD found"
msg_error "${BOLD}${pkgbase}:${ALL_OFF} no PKGBUILD found"
return 1
fi
if [[ ! -f .SRCINFO ]]; then
msg_error "${BOLD}${path}:${ALL_OFF} no .SRCINFO found"
return 1
fi
# reset common PKGBUILD variables
unset pkgbase
if ! pkgbase=$(grep --max-count=1 --extended-regexp "pkgbase = (.+)" .SRCINFO | awk '{print $3}'); then
msg_error "${BOLD}${path}:${ALL_OFF} pkgbase not found in .SRCINFO"
# shellcheck source=contrib/makepkg/PKGBUILD.proto
if ! . ./PKGBUILD; then
msg_error "${BOLD}${pkgbase}:${ALL_OFF} failed to source PKGBUILD"
return 1
fi
pkgbase=${pkgbase:-$pkgname}
if [[ ! -e LICENSE ]]; then
msg_error "${BOLD}${pkgbase}:${ALL_OFF} is missing the LICENSE file"