Improve safety and CLI fidelity for everyday use
Drop default --noconfirm (opt-in via --noconfirm), fix --noremovemake, forward pacman argv intact for -R/-D/-F/-T/-U, deepen PKGBUILD review, show an install plan before building, and add shellcheck CI plus unit tests. Co-authored-by: Frank Vitrano <WHC2006@users.noreply.github.com>
This commit is contained in:
co-authored by
Frank Vitrano
parent
d0f2cfe335
commit
bba71040d6
+37
-2
@@ -27,8 +27,10 @@ build_pkg() {
|
||||
*) clean_flags+=("$f") ;;
|
||||
esac
|
||||
done
|
||||
local -a mk_extra=()
|
||||
mapfile -t mk_extra < <(pac_noconfirm_args)
|
||||
# Always sync deps for repo side via makepkg -s when needed
|
||||
${MIAUR_MAKEPKG} -s --noconfirm "${clean_flags[@]}" || exit 1
|
||||
${MIAUR_MAKEPKG} -s "${mk_extra[@]}" "${clean_flags[@]}" || exit 1
|
||||
) || die "build failed: $name"
|
||||
|
||||
if [[ $do_install -eq 1 ]]; then
|
||||
@@ -36,7 +38,10 @@ build_pkg() {
|
||||
mapfile -t pkgs < <(find "$dir" -maxdepth 1 -type f \( -name '*.pkg.tar.zst' -o -name '*.pkg.tar.xz' -o -name '*.pkg.tar.gz' \) ! -name '*-debug-*' | sort)
|
||||
[[ ${#pkgs[@]} -eq 0 ]] && die "no build artifacts found: $name"
|
||||
msg "Installing $name..."
|
||||
local -a uflags=(-U --noconfirm)
|
||||
local -a uflags=(-U)
|
||||
local -a conf=()
|
||||
mapfile -t conf < <(pac_noconfirm_args)
|
||||
uflags+=("${conf[@]}")
|
||||
[[ $asdeps -eq 1 ]] && uflags+=(--asdeps)
|
||||
as_root ${MIAUR_PACMAN} "${uflags[@]}" "${pkgs[@]}" || die "installation failed: $name"
|
||||
fi
|
||||
@@ -60,6 +65,13 @@ install_aur_packages() {
|
||||
msg "Resolving dependencies..."
|
||||
local -a order=()
|
||||
mapfile -t order < <(aur_resolve_order "${targets[@]}")
|
||||
# Drop empty line if order was empty print
|
||||
local -a order_clean=()
|
||||
local _o
|
||||
for _o in "${order[@]}"; do
|
||||
[[ -n $_o ]] && order_clean+=("$_o")
|
||||
done
|
||||
order=("${order_clean[@]}")
|
||||
[[ ${#order[@]} -eq 0 ]] && die "no packages to install"
|
||||
|
||||
# Collect all repo deps across the graph
|
||||
@@ -81,6 +93,28 @@ install_aur_packages() {
|
||||
done < <(collect_deps_for_dir "$dir" 1 1)
|
||||
done
|
||||
|
||||
msg "Packages to build (${#order[@]}):"
|
||||
declare -A is_target_preview=()
|
||||
for pkg in "${targets[@]}"; do
|
||||
is_target_preview[$pkg]=1
|
||||
done
|
||||
for pkg in "${order[@]}"; do
|
||||
if [[ -n ${is_target_preview[$pkg]+x} ]]; then
|
||||
msg2 "aur/$pkg (target)"
|
||||
else
|
||||
msg2 "aur/$pkg"
|
||||
fi
|
||||
done
|
||||
if [[ ${#repo_deps[@]} -gt 0 ]]; then
|
||||
msg "Repository dependencies (${#repo_deps[@]}):"
|
||||
msg2 "${repo_deps[*]}"
|
||||
fi
|
||||
confirm_ask "Proceed with installation?" || {
|
||||
warn "Cancelled by user"
|
||||
sudoloop_stop
|
||||
return 1
|
||||
}
|
||||
|
||||
install_repo_deps "${repo_deps[@]}"
|
||||
|
||||
# Review all packages first (like paru)
|
||||
@@ -157,6 +191,7 @@ install_aur_packages() {
|
||||
done
|
||||
if [[ ${#to_rm[@]} -gt 0 ]]; then
|
||||
msg "Removing make dependencies: ${to_rm[*]}"
|
||||
# Cleanup after an already-confirmed install: avoid a second prompt by default
|
||||
as_root ${MIAUR_PACMAN} -Rns --noconfirm "${to_rm[@]}" || warn "failed to remove make dependencies"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user