Skip to content

Commit

Permalink
Merge pull request #4075 from bukzor/patch-2
Browse files Browse the repository at this point in the history
get-stack: allow users to use sudo carefully
  • Loading branch information
borsboom committed Jun 18, 2018
2 parents 70d2cb1 + 587117f commit af4f8f5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion etc/scripts/get-stack.sh
Expand Up @@ -127,8 +127,15 @@ print_bindist_notice() {

# Adds a 'sudo' prefix if sudo is available to execute the given command
# If not, the given command is run as is
# When requesting root permission, always show the command and never re-use cached credentials.
sudocmd() {
$(command -v sudo) "$@"
if command -v sudo >/dev/null; then
echo "sudo $@"
# -k: Disable cached credentials.
sudo -k "$@"
else
"$@"
fi
}

# Install dependencies for distros that use Apt
Expand Down

0 comments on commit af4f8f5

Please sign in to comment.