browser4-cli 4.12.0-rc.3 → 4.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -497,25 +497,48 @@ create_symlinks() {
497
497
  ok "Created symlink: ${link_name} -> ${binary_name}"
498
498
  fi
499
499
 
500
- # 2) Only if no conflict: b4 -> browser4-cli-<platform>
500
+ # 2) b4 -> browser4-cli-<platform> (only if b4 is our tool or doesn't exist)
501
501
  local short_name="b4${ext}"
502
502
  local short_path="${install_dir}/${short_name}"
503
503
 
504
- if command -v b4 >/dev/null 2>&1; then
505
- warn "Skipping short link '${short_name}': 'b4' already found on PATH"
506
- return
507
- fi
504
+ local b4_exists=false
505
+ local b4_is_ours=false
508
506
 
507
+ # Check in install dir first — anything here is ours
509
508
  if [[ -e "$short_path" ]] || [[ -L "$short_path" ]]; then
510
- warn "Skipping short link '${short_name}': already exists in ${install_dir}"
509
+ b4_exists=true
510
+ b4_is_ours=true
511
+ fi
512
+
513
+ # Check if b4 is on PATH from somewhere else
514
+ if [[ "$b4_exists" != true ]]; then
515
+ if command -v b4 >/dev/null 2>&1; then
516
+ b4_exists=true
517
+ # Check if it's ours by running --version
518
+ if b4 --version 2>&1 | grep -qi "browser4-cli"; then
519
+ b4_is_ours=true
520
+ fi
521
+ fi
522
+ fi
523
+
524
+ if [[ "$b4_exists" == true ]] && [[ "$b4_is_ours" != true ]]; then
525
+ warn "Skipping short link '${short_name}': 'b4' is not browser4-cli"
511
526
  return
512
527
  fi
513
528
 
514
529
  if [[ "$DRY_RUN" == true ]]; then
515
- step "[DRY-RUN] Would create symlink: ${short_name} -> ${binary_name}"
530
+ if [[ "$b4_exists" == true ]]; then
531
+ step "[DRY-RUN] Would update symlink: ${short_name} -> ${binary_name}"
532
+ else
533
+ step "[DRY-RUN] Would create symlink: ${short_name} -> ${binary_name}"
534
+ fi
516
535
  else
517
536
  ln -sf "$binary_name" "$short_path"
518
- ok "Created symlink: ${short_name} -> ${binary_name}"
537
+ if [[ "$b4_exists" == true ]]; then
538
+ ok "Updated symlink: ${short_name} -> ${binary_name}"
539
+ else
540
+ ok "Created symlink: ${short_name} -> ${binary_name}"
541
+ fi
519
542
  fi
520
543
  }
521
544