mirror of
https://github.com/systemd/systemd.git
synced 2025-01-05 13:18:06 +03:00
20345a86b7
In https://github.com/systemd/mkosi/pull/2847, the '@' specifier is removed, CLI arguments take priority over configuration files again and the "main" image is defined at the top level instead of in mkosi.images/. Additionally, not every setting from the top level configuration is inherited by the images in mkosi.images/ anymore, only settings which make sense to be inherited are inherited. This commit gets rid of all the usages of '@', moves the "main" image configuration from mkosi.images/system to the top level and gets rid of various hacks we had in place to deal with quirks of the old configuration parsing logic. We also remove usages of Images= and --append as these options are removed by the mentioned PR.
49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
set -e
|
|
set -o nounset
|
|
|
|
if ((${NO_SYNC:-0})); then
|
|
exit 0
|
|
fi
|
|
|
|
PKG_SUBDIR="$(realpath --canonicalize-missing "pkg/$DISTRIBUTION" --relative-to "$PWD")"
|
|
|
|
if [[ -d "$PKG_SUBDIR/.git" ]]; then
|
|
if [[ "$(git -C "$PKG_SUBDIR" rev-parse HEAD)" == "$GIT_COMMIT" ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
# If work is being done on the packaging rules in a separate branch, don't touch the checkout.
|
|
if ! git -C "$PKG_SUBDIR" merge-base --is-ancestor HEAD "origin/$GIT_BRANCH"; then
|
|
EXIT_STATUS=$?
|
|
if [[ $EXIT_STATUS -eq 1 ]]; then
|
|
exit 0
|
|
else
|
|
exit $EXIT_STATUS
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if [[ ! -e "$PKG_SUBDIR" ]] || [[ -z "$(ls --almost-all "$PKG_SUBDIR")" ]]; then
|
|
# The repository on Salsa has the full upstream sources, so it's a waste of
|
|
# space to redownload and duplicate everything, so do a sparse checkout as
|
|
# we only need the packaging directory anyway.
|
|
if [[ -n "${GIT_SUBDIR:-}" ]]; then
|
|
sparse=(--no-checkout --filter=tree:0)
|
|
else
|
|
sparse=()
|
|
fi
|
|
|
|
git clone "$GIT_URL" --branch "$GIT_BRANCH" "${sparse[@]}" "$PKG_SUBDIR"
|
|
if [[ -n "${GIT_SUBDIR:-}" ]]; then
|
|
# --no-cone is needed to check out only one top-level directory
|
|
git -C "$PKG_SUBDIR" sparse-checkout set --no-cone "${GIT_SUBDIR:-}"
|
|
fi
|
|
else
|
|
git -C "$PKG_SUBDIR" remote set-url origin "$GIT_URL"
|
|
git -C "$PKG_SUBDIR" fetch origin "$GIT_BRANCH"
|
|
fi
|
|
|
|
git -C "$PKG_SUBDIR" -c advice.detachedHead=false checkout "$GIT_COMMIT"
|