From 862453b0e49c7c0acb1bde65a79ff792ade4d6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Mon, 20 Jun 2022 08:46:44 +0000 Subject: [PATCH] Revert "cmd-init: Support specifying a subdirectory" Remove support for subdirectory in cosa init given that: - we currently don't use this feature, - we chose another path for multiple version support in openshift/os as using subdirectories lead to a lot of additionnal complexity. See: https://github.com/openshift/os/pull/803 This reverts commit 4781e4663f8b55cbc451feded25bdbd276722d62. --- src/cmd-init | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/cmd-init b/src/cmd-init index 6547511448..e1e2cf0d71 100755 --- a/src/cmd-init +++ b/src/cmd-init @@ -14,8 +14,8 @@ TRANSIENT=0 print_help() { cat 1>&2 <<'EOF' Usage: coreos-assembler init --help - coreos-assembler init [--force] [--transient] [--branch BRANCH] - [--commit COMMIT] GITCONFIG [SUBDIR] + coreos-assembler init [--force] [--transient] [--branch BRANCH] + [--commit COMMIT] GITCONFIG For example, you can use https://github.com/coreos/fedora-coreos-config as GITCONFIG, or fork it. Another option useful for local development @@ -23,9 +23,6 @@ Usage: coreos-assembler init --help starting with `/` - a symlink to it will be created and then used directly. You can specify a branch of a git repo with the `--branch` flag. - If specified, SUBDIR is a subdirectory of the git repository that should - contain manifest.yaml and image.yaml (or image.ks). - Use `--transient` for builds that will throw away all cached data on success/failure, and should hence not invoke `fsync()` for example. EOF @@ -83,7 +80,7 @@ while true; do done # If user did not provide a repo then error out -if [ $# = 0 ]; then +if [ $# -ne 1 ]; then print_help fatal "ERROR: Missing GITCONFIG" exit 1 @@ -96,7 +93,6 @@ if [ "$FORCE" != "1" ] && [ -n "$(ls ./)" ]; then fi source=$1; shift -subdir=${1:-} preflight @@ -112,7 +108,7 @@ mkdir -p src (cd src if ! test -e config; then case "${source}" in - /*) ln -s "${source}/${subdir}" config;; + /*) ln -s "${source}" config;; *) git clone ${BRANCH:+--branch=${BRANCH}} --depth=1 --shallow-submodules --recurse-submodules "${source}" config # If a commit was specified then we'll fetch and reset # the specified branch to that commit. This is useful when @@ -124,10 +120,6 @@ mkdir -p src git -C ./config fetch origin "$COMMIT" git -C ./config reset --hard "$COMMIT" fi - if [ -n "${subdir}" ]; then - mv config config-git - ln -sr config-git/"${subdir}" config - fi (set +x; cd config && echo -n "Config commit: " && git describe --tags --always --abbrev=42) ;; esac