mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-05 04:06:33 +02:00
Catalyst 4 has totally changed the way repositories are handled. It only works when the name of the directory containing the repository matches the configured name of that repository. We already renamed coreos to coreos-overlay accordingly, but we actually want entirely different names and more convenient locations too. The repositories are now known as gentoo-subset and flatcar-overlay, and they live under scripts/repos. Using the same name as upstream Gentoo would have been problematic, and just "flatcar" would have looked awkward in documentation. I have removed code referencing /mnt/host/source/config rather than fix it up, as this is no location is no longer used anywhere. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
54 lines
1.3 KiB
Bash
Executable File
54 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright (c) 2014 The CoreOS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
|
|
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
|
|
|
DEFINE_boolean commit ${FLAGS_FALSE} \
|
|
"Commit all changes after updating."
|
|
|
|
# Parse flags
|
|
FLAGS "$@" || exit 1
|
|
eval set -- "${FLAGS_ARGV}"
|
|
switch_to_strict_mode
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
eval set -- gentoo-subset flatcar-overlay
|
|
fi
|
|
|
|
update_overlay() {
|
|
local repo_name="$1"
|
|
local repo_path=$(portageq get_repo_path / "${repo_name}")
|
|
local job_opts=$(portageq envvar MAKEOPTS)
|
|
|
|
info "Updating metadata in ${repo_name}..."
|
|
egencache ${job_opts} --repo="${repo_name}" --update
|
|
|
|
pushd "${repo_path}" >/dev/null
|
|
git add -A metadata/md5-cache
|
|
|
|
if git diff --quiet --cached; then
|
|
info "Nothing to update in ${repo_name}"
|
|
return 0
|
|
fi
|
|
|
|
if [[ ${FLAGS_commit} -eq ${FLAGS_TRUE} ]]; then
|
|
git commit -m "chore(metadata): Regenerate cache" metadata/md5-cache
|
|
else
|
|
git status metadata/md5-cache
|
|
fi
|
|
popd >/dev/null
|
|
}
|
|
|
|
for repo in "$@"; do
|
|
if ! portageq get_repo_path / "$repo" >/dev/null; then
|
|
die_notrace "Unknown repo name '$repo'"
|
|
fi
|
|
update_overlay "$repo"
|
|
done
|
|
|
|
command_completed
|