From fa17b5b69f709df1fee48cf40592083791b86bda Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 15 Mar 2026 15:19:29 +0100 Subject: [PATCH] Use sudo keepalive to ensure that we don't get a sudo timeout on a long-running install --- bin/omarchy-pkg-aur-install | 3 ++- bin/omarchy-pkg-install | 4 +++- bin/omarchy-sudo-keepalive | 10 ++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100755 bin/omarchy-sudo-keepalive diff --git a/bin/omarchy-pkg-aur-install b/bin/omarchy-pkg-aur-install index 02c506b3..89340162 100755 --- a/bin/omarchy-pkg-aur-install +++ b/bin/omarchy-pkg-aur-install @@ -20,7 +20,8 @@ pkg_names=$(yay -Slqa | fzf "${fzf_args[@]}") if [[ -n $pkg_names ]]; then # Add aur/ prefix to each package name and convert to space-separated for yay - sudo -v + source omarchy-sudo-keepalive + echo "$pkg_names" | sed 's/^/aur\//' | tr '\n' ' ' | xargs yay -S --noconfirm sudo updatedb omarchy-show-done diff --git a/bin/omarchy-pkg-install b/bin/omarchy-pkg-install index 09386161..8399da9c 100755 --- a/bin/omarchy-pkg-install +++ b/bin/omarchy-pkg-install @@ -17,7 +17,9 @@ fzf_args=( pkg_names=$(pacman -Slq | fzf "${fzf_args[@]}") if [[ -n $pkg_names ]]; then - # Convert newline-separated selections to space-separated for yay + source omarchy-sudo-keepalive + + # Convert newline-separated selections to space-separated for pacman echo "$pkg_names" | tr '\n' ' ' | xargs sudo pacman -S --noconfirm omarchy-show-done fi diff --git a/bin/omarchy-sudo-keepalive b/bin/omarchy-sudo-keepalive new file mode 100755 index 00000000..c475198b --- /dev/null +++ b/bin/omarchy-sudo-keepalive @@ -0,0 +1,10 @@ +#!/bin/bash + +# Prompt for sudo once and keep the credential alive in the background. +# Source this script so the trap applies to the calling shell: +# source omarchy-sudo-keepalive + +sudo -v +while true; do sudo -n true; sleep 60; done 2>/dev/null & +SUDO_KEEPALIVE_PID=$! +trap "kill $SUDO_KEEPALIVE_PID 2>/dev/null" EXIT