Check if user has sudo rights and keep sudo from timing out
This commit is contained in:
parent
d2a9f4443b
commit
d1c1c51a5e
@ -4,6 +4,22 @@
|
|||||||
# NOTE ignore errors from missing "||". Try getting the line below to work
|
# NOTE ignore errors from missing "||". Try getting the line below to work
|
||||||
#set -euo pipefail
|
#set -euo pipefail
|
||||||
|
|
||||||
|
# function to keep sudo from timing out
|
||||||
|
function func_dont_timeout {
|
||||||
|
while true; do
|
||||||
|
sudo -v
|
||||||
|
sleep 60
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# check if user is root
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
sudo -v
|
||||||
|
fi
|
||||||
|
|
||||||
|
# keep sudo active in background
|
||||||
|
func_dont_timeout &
|
||||||
|
|
||||||
# get current directory
|
# get current directory
|
||||||
setupdir=$(pwd)
|
setupdir=$(pwd)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user