From 409b47a93235e3de0497f6d25b732a5621c0f55e Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 31 Jan 2023 12:00:20 +0100 Subject: [PATCH] *: Fix user-patches setup Normally `ln -sf path/to/target at/name` will create a symlink at `at/name` that points to `path/to/target`. But if `at/name` already exists and is a directory or a symlink to some other directory, then this command will create a symlink at `at/name/target` pointing to `path/to/target`. There is an ambiguity between 1st and 3rd form of `ln` (please refer to `man ln` for the available invocation forms). It can be disambiguated by using the `-T` flag to force the 1st form. In our case, if `/etc/portage/patches` symlink already existed and was pointing to `/coreos/user-patches`, we ended up with a useless symlink at `/coreos/user-patches/user-patches` pointing to `/coreos/user-patches`. --- build_library/catalyst.sh | 2 +- setup_board | 2 +- update_chroot | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build_library/catalyst.sh b/build_library/catalyst.sh index 595065da8b..26b5372863 100644 --- a/build_library/catalyst.sh +++ b/build_library/catalyst.sh @@ -243,7 +243,7 @@ write_configs() { info " stage4.spec" catalyst_stage4 > "$TEMPDIR/stage4.spec" info "Putting a symlink to user patches..." - ln -sf '/var/gentoo/repos/local/coreos/user-patches' \ + ln -sfT '/var/gentoo/repos/local/coreos/user-patches' \ "$TEMPDIR/portage/patches" } diff --git a/setup_board b/setup_board index 7595b44ae1..541a41d029 100755 --- a/setup_board +++ b/setup_board @@ -233,7 +233,7 @@ fi info "Configuring portage in ${BOARD_ROOT}" sudo mkdir -p "${BOARD_ETC}/portage/"{profile,repos.conf} -sudo ln -sf "$(portageq get_repo_path / coreos)/coreos/user-patches" \ +sudo ln -sfT "$(portageq get_repo_path / coreos)/coreos/user-patches" \ "${BOARD_ETC}/portage/patches" sudo cp /etc/portage/repos.conf/* "${BOARD_ETC}"/portage/repos.conf/ sudo ROOT="${BOARD_ROOT}" eselect profile set --force "${PORTAGE_PROFILE}" diff --git a/update_chroot b/update_chroot index a829d74cbd..9df5da6a30 100755 --- a/update_chroot +++ b/update_chroot @@ -83,7 +83,7 @@ info "Setting up portage..." sudo mkdir -p "${REPO_CACHE_DIR}/distfiles" sudo chown "${PORTAGE_USERNAME}:portage" "${REPO_CACHE_DIR}/distfiles" sudo mkdir -p /etc/portage/repos.conf /var/lib/portage/pkgs -sudo ln -sf "${COREOS_OVERLAY}/coreos/user-patches" '/etc/portage/patches' +sudo ln -sfT "${COREOS_OVERLAY}/coreos/user-patches" '/etc/portage/patches' sudo touch /etc/portage/make.conf.user sudo_clobber "/etc/portage/make.conf" <