#!/bin/bash
#
# To run: curl radia.run | bash -s init-from-git repo...
#
# The file 'radia-run.sh' will be run in the cloned repo.
#
# repo may be https://github.com/foo/bar or foo/bar

init_from_git_main() {
    install_tmp_dir
    init_from_git_tmpdir=$(pwd)
    cd
    # Avoid false returns
    set -e
    . ~/.bashrc
    set +e
    for repo in "${install_extra_args[@]}"; do
        init_from_git_one "$repo"
    done
}

init_from_git_one() {
    local repo=$1
    rm -rf "$init_from_git_tmpdir"
    mkdir -p "$init_from_git_tmpdir"
    (
        set -e
        cd "$init_from_git_tmpdir"
        if [[ ! repo =~ ^\w+:// ]]; then
            repo=https://github.com/$repo
        fi
        if git clone -q "$repo"; then
            cd "$(basename "$repo" .git)"
            . ./radia-run.sh
        fi
    ) || true
}

init_from_git_main

#!/bin/bash
#
# To run: curl radia.run | bash -s init-from-git repo...
#
# The file 'radia-run.sh' will be run in the cloned repo.
#
# repo may be https://github.com/foo/bar or foo/bar

init_from_git_main() {
    install_tmp_dir
    init_from_git_tmpdir=$(pwd)
    cd
    # Avoid false returns
    set -e
    . ~/.bashrc
    set +e
    for repo in "${install_extra_args[@]}"; do
        init_from_git_one "$repo"
    done
}

init_from_git_one() {
    local repo=$1
    rm -rf "$init_from_git_tmpdir"
    mkdir -p "$init_from_git_tmpdir"
    (
        set -e
        cd "$init_from_git_tmpdir"
        if [[ ! repo =~ ^\w+:// ]]; then
            repo=https://github.com/$repo
        fi
        if SSH_ASKPASS=true git clone -q "$repo"; then
            cd "$(basename "$repo" .git)"
            . ./radia-run.sh
        fi
    ) || true
}

init_from_git_main

Disable HTTP credentials when cloning git repos
Disable HTTP credentials when cloning git repos

All of sudden this script starting asking for passwords for non-existant
github repos. This breaks the non-interactive functionality of the
script.

radiasoft/containers#35
