Post-install tailoring (PeaZip variants, starship+preset, RobotoMono, services) #13
+7
-3
@@ -140,9 +140,13 @@ ui_quiet_run() {
|
|||||||
local pid=$!
|
local pid=$!
|
||||||
local f=0 cur
|
local f=0 cur
|
||||||
while kill -0 "$pid" 2>/dev/null; do
|
while kill -0 "$pid" 2>/dev/null; do
|
||||||
|
# Match dnf ('Installing: pkg') AND flatpak ('Installing... id', a
|
||||||
|
# Unicode ellipsis) progress lines; sanitize to printable ASCII so a
|
||||||
|
# non-UTF8 console never sees garbage bytes in the live line.
|
||||||
cur=$(sed -n "$((before+1)),\$p" "$log" 2>/dev/null \
|
cur=$(sed -n "$((before+1)),\$p" "$log" 2>/dev/null \
|
||||||
| grep -E '^(Installing|Upgrading|Downgrading|Removing|Verifying|Preparing|Cleanup):' \
|
| grep -aE '^Installing|^Upgrading|^Downgrading|^Removing|^Verifying|^Preparing|^Cleanup' \
|
||||||
| tail -n 1 || true)
|
| tail -n 1 \
|
||||||
|
| tr -cd '\11\12\40-\176' || true)
|
||||||
# Compose ONCE, then clamp to the terminal width: a live line longer
|
# Compose ONCE, then clamp to the terminal width: a live line longer
|
||||||
# than the screen wraps on every redraw and floods the screen with
|
# than the screen wraps on every redraw and floods the screen with
|
||||||
# duplicate partial lines (VM-proven on the 80-col TTY).
|
# duplicate partial lines (VM-proven on the 80-col TTY).
|
||||||
@@ -172,7 +176,7 @@ ui_quiet_run() {
|
|||||||
printf '\r%*s\r' 100 '' >&2
|
printf '\r%*s\r' 100 '' >&2
|
||||||
|
|
||||||
if (( rc == 0 )); then
|
if (( rc == 0 )); then
|
||||||
n=$(sed -n "$((before+1)),\$p" "$log" 2>/dev/null | grep -c '^Installing:' || true)
|
n=$(sed -n "$((before+1)),\$p" "$log" 2>/dev/null | grep -ac '^Installing' || true)
|
||||||
local plural="s"
|
local plural="s"
|
||||||
(( n == 1 )) && plural=""
|
(( n == 1 )) && plural=""
|
||||||
if (( depth == 256 )); then
|
if (( depth == 256 )); then
|
||||||
|
|||||||
@@ -494,9 +494,18 @@ run_advanced_menu() {
|
|||||||
# transaction (VM: brave's no-match took chromium down with it).
|
# transaction (VM: brave's no-match took chromium down with it).
|
||||||
# Repo wiring inside install_category_pkgs runs per item; failures
|
# Repo wiring inside install_category_pkgs runs per item; failures
|
||||||
# warn in red and the remaining picks still install.
|
# warn in red and the remaining picks still install.
|
||||||
local picked lbl it
|
# Read the picks into an ARRAY first, install in a for-loop.
|
||||||
|
# A `while read ... <<< "$sel"` herestring REPLACES stdin for its whole
|
||||||
|
# body — inside it stdin is no longer a TTY, ui_quiet_run saw "piped"
|
||||||
|
# and menu installs ran in plain mode (VM-proven: the advanced menu
|
||||||
|
# was the one place dnf's full output still scrolled).
|
||||||
|
local -a picked_items=()
|
||||||
while IFS= read -r picked; do
|
while IFS= read -r picked; do
|
||||||
[[ -z "$picked" ]] && continue
|
[[ -n "$picked" ]] && picked_items+=("$picked")
|
||||||
|
done <<< "$sel"
|
||||||
|
|
||||||
|
local picked lbl it
|
||||||
|
for picked in "${picked_items[@]}"; do
|
||||||
for entry in "${entries[@]}"; do
|
for entry in "${entries[@]}"; do
|
||||||
rest="${entry#*:}"
|
rest="${entry#*:}"
|
||||||
lbl="${rest%%:*}"
|
lbl="${rest%%:*}"
|
||||||
@@ -516,7 +525,7 @@ run_advanced_menu() {
|
|||||||
pause_if_debug
|
pause_if_debug
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done <<< "$sel"
|
done
|
||||||
done
|
done
|
||||||
# not `&& ok` — a false done_any would return 1 and kill the script under set -e
|
# not `&& ok` — a false done_any would return 1 and kill the script under set -e
|
||||||
if [[ "$done_any" == "true" ]]; then
|
if [[ "$done_any" == "true" ]]; then
|
||||||
@@ -547,7 +556,9 @@ install_category_pkgs() {
|
|||||||
install_category_pkgs_dnf "$cat" "${dp[@]}" || return 1
|
install_category_pkgs_dnf "$cat" "${dp[@]}" || return 1
|
||||||
fi
|
fi
|
||||||
if (( ${#fp[@]} > 0 )); then
|
if (( ${#fp[@]} > 0 )); then
|
||||||
info "Installing flatpaks from Flathub: ${fp[*]}"
|
# quiet like dnf: live block line, full output in the log, red + tail
|
||||||
|
# on failure (ui_quiet_run matches flatpak's 'Installing...' lines)
|
||||||
|
ui_quiet_run "Installing flatpak: ${fp[*]}" \
|
||||||
flatpak install -y flathub "${fp[@]}" || return 1
|
flatpak install -y flathub "${fp[@]}" || return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@@ -579,10 +590,13 @@ install_category_pkgs_dnf() {
|
|||||||
done
|
done
|
||||||
if $needs_chrome && ! pkg_installed google-chrome-stable; then
|
if $needs_chrome && ! pkg_installed google-chrome-stable; then
|
||||||
info "Adding Google Chrome repo..."
|
info "Adding Google Chrome repo..."
|
||||||
sudo dnf install -y fedora-workstation-repositories 2>/dev/null || true
|
install_optional fedora-workstation-repositories
|
||||||
sudo dnf config-manager setopt google-chrome.enabled=1 2>/dev/null || \
|
if ! sudo dnf config-manager setopt google-chrome.enabled=1 >/dev/null 2>&1; then
|
||||||
|
# repo enable failed: install straight from Google's rpm
|
||||||
|
ui_quiet_run "Installing Google Chrome (direct rpm)" \
|
||||||
sudo dnf install -y "https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm"
|
sudo dnf install -y "https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
if $needs_brave && ! pkg_installed brave-browser; then
|
if $needs_brave && ! pkg_installed brave-browser; then
|
||||||
# dnf5 (Fedora 41+) has no 'config-manager add' subcommand —
|
# dnf5 (Fedora 41+) has no 'config-manager add' subcommand —
|
||||||
# the VM showed 'Unknown argument "add"', so the repo never
|
# the VM showed 'Unknown argument "add"', so the repo never
|
||||||
@@ -592,7 +606,7 @@ install_category_pkgs_dnf() {
|
|||||||
if [[ -f /etc/yum.repos.d/brave-browser.repo ]]; then
|
if [[ -f /etc/yum.repos.d/brave-browser.repo ]]; then
|
||||||
ok "Brave repo already present."
|
ok "Brave repo already present."
|
||||||
else
|
else
|
||||||
info "Adding Brave repo (dnf5 addrepo)..."
|
ui_quiet_run "Adding Brave repo (dnf5 addrepo)" \
|
||||||
sudo dnf config-manager addrepo \
|
sudo dnf config-manager addrepo \
|
||||||
--from-repofile=https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo
|
--from-repofile=https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user