From 92b078b0734b4ad01d9da71c565afd1992a951e8 Mon Sep 17 00:00:00 2001 From: Christian Heusel <christian@heusel.eu> Date: Tue, 25 Jul 2023 10:50:48 +0200 Subject: [PATCH] fix(pkgctl clone): fix --maintainer and --universe being stuck The problem here is that anything that requires user input (such as a key unlock or hostkey verify) will block the terminal and wait for input which will never come. We therefore handle just the first element without parallel so these things can easily be done. Afterwards users are expected to either have setup a ssh ControlMaster or use something like a ssh agent. fixes https://gitlab.archlinux.org/archlinux/devtools/-/issues/148 Signed-off-by: Christian Heusel <christian@heusel.eu> --- src/lib/repo/clone.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/repo/clone.sh b/src/lib/repo/clone.sh index 08bded4d..92de3515 100644 --- a/src/lib/repo/clone.sh +++ b/src/lib/repo/clone.sh @@ -61,7 +61,9 @@ pkgctl_repo_clone() { jobs=$(nproc) # variables - local command=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}} + local command + # split the words in _DEVTOOLS_COMMAND to array members + read -ra command <<< "${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}" local project_path while (( $# )); do @@ -169,9 +171,13 @@ pkgctl_repo_clone() { fi # assign command options if [[ -n "${VERSION}" ]]; then - command+=" --switch '${VERSION}'" + command+=("--switch" "'${VERSION}'") fi - if ! parallel --bar --jobs "${jobs}" "${command}" ::: "${pkgbases[@]}"; then + + # we clone the first element separately to prevent problems with key unlocking etc. + "${command[@]}" "${pkgbases[0]}" + + if ! parallel --bar --jobs "${jobs}" "${command[@]}" ::: "${pkgbases[@]:1}"; then die 'Failed to clone some packages, please check the output' exit 1 fi -- GitLab