Actualizar lib/steps/repos.sh

This commit is contained in:
Zenaku 2026-06-02 16:30:48 +00:00
parent 58d7837c7f
commit dd7edfa4ed

View file

@ -8,7 +8,16 @@ step_repos() {
_clone_repos
_setup_env
}
_clone_repos() {
echo "[DEBUG] ==============================="
echo "[DEBUG] HV_BASE=$HV_BASE"
echo "[DEBUG] HV_CORE=$HV_CORE"
echo "[DEBUG] REPO_URLS[core]=${REPO_URLS[core]}"
echo "[DEBUG] REPO_BRANCHES[core]=${REPO_BRANCHES[core]}"
echo "[DEBUG] REPO_DIRS[core]=${REPO_DIRS[core]}"
echo "[DEBUG] ==============================="
for name in core essentials cli gui; do
local url="${REPO_URLS[$name]}"
local branch="${REPO_BRANCHES[$name]}"
@ -18,7 +27,13 @@ _clone_repos() {
[ "$name" = "essentials" ] && dest="$HV_ESSENTIALS"
[ "$name" = "gui" ] && dest="$HV_GUI"
echo "[DEBUG] --- name=$name"
echo "[DEBUG] url=$url"
echo "[DEBUG] branch=$branch"
echo "[DEBUG] dest=$dest"
if [ -d "$dest/.git" ]; then
echo "[DEBUG] .git EXISTS at $dest — asking re-clone"
log_warn "Repo already exists: ${dest}"
if ask_confirm "Delete and re-clone ${name}?"; then
rm -rf "$dest"
@ -26,25 +41,35 @@ _clone_repos() {
log_skip "Re-clone skipped — using ${dest}"
continue
fi
else
echo "[DEBUG] .git NOT found — proceeding to clone"
fi
start_spinner "Cloning ${name} (branch: ${branch})..."
if git clone --branch "$branch" "$url" "$dest" ; then
echo "[DEBUG] running: git clone --branch $branch $url $dest"
if git clone --branch "$branch" "$url" "$dest"; then
echo "[DEBUG] clone SUCCESS"
stop_spinner "${name} cloned → ${dest}"
else
echo "[DEBUG] clone FAILED (exit code $?)"
stop_spinner
log_error "git clone failed: ${url}"
exit 1
fi
chmod 700 "$dest"
echo "[DEBUG] chmod 700 done"
done
echo "[DEBUG] _clone_repos finished"
}
_setup_env() {
local env_file="$HV_CORE/.env"
local example_file="$HV_CORE/.env.example"
echo "[DEBUG] _setup_env: example_file=$example_file"
echo "[DEBUG] _setup_env: env_file=$env_file"
if [ ! -f "$example_file" ]; then
log_error ".env.example not found: ${example_file}"
exit 1