1
0
forked from extern/nix-config

fedora: Add persistent sudo to bootstrap.sh

Since sudo times out after 5 minutes, and since we don't want to run
every command as root, we can instead create a "persistent sudo" by
invoking the sudo command at least once within 5 minute time frames.

This script does just that, and solves the problem of sudo timing out
after a long command.
This commit is contained in:
Donovan Glover 2018-11-14 15:05:25 -05:00
parent a985bf68e5
commit a6122f8f73
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -6,8 +6,18 @@ set -e
# Change the working directory to this one
cd "$(dirname "$0")"
# Get administrative privileges
sudo -v
# Keep pinging sudo until this script finishes
# Source: https://gist.github.com/cowboy/3118588
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Install dependencies
sudo dnf install -y make fedpkg
sudo -n dnf install -y make fedpkg
# Run make
make
# Revoke privileges
sudo -K