forked from extern/nix-config
a6122f8f73
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.
24 lines
437 B
Bash
Executable File
24 lines
437 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# End the script on any errors
|
|
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 -n dnf install -y make fedpkg
|
|
|
|
# Run make
|
|
make
|
|
|
|
# Revoke privileges
|
|
sudo -K
|