1
0
forked from extern/nix-config
donovanglover-nix-config/.fedora/bootstrap.sh
Donovan Glover a6122f8f73
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.
2018-11-14 15:08:20 -05:00

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