Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add '-k' option #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add '-k' option #13

wants to merge 1 commit into from

Conversation

fclivaz42
Copy link

Useful for eg. Arch Linux's makepkg which uses -k during its process.

@fclivaz42
Copy link
Author

Forgot to mention that this fixes #12.

@@ -4,8 +4,8 @@ set -u
help() {
cat <<-EOF
Usage:
sudo (-i | -s) [-n] [-u <user>] [<command> [--] [<args>...]]
sudo [-ins] [-u <user>] <command> [--] [<args>...]
sudo (-i | -s) [-n] [-k] [-u <user>] [<command> [--] [<args>...]]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sudo (-i | -s) [-n] [-k] [-u <user>] [<command> [--] [<args>...]]
sudo (-i | -k | -s) [-n] [-u <user>] [<command> [--] [<args>...]]

else
_doas $flag_s
fi
elif [ "$flag_i" ]; then
_doas -- "$(user_shell)" -l -c 'cd "$HOME"; "$0" "$@"' "$@"
elif [ "$flag_s" ]; then
_doas -- "${SHELL:-$(user_shell)}" -c '"$0" "$@"' "$@"
elif [ "$flag_k" ]; then
doas $flag_k ${user:+-u "$user"}
doas $flag_n ${user:+-u "$user"} "$@"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is not correct. According to sudo(8), it seems that -k can be combined with -i or -s.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been testing on my own and according to doas(1), using -L exits immediately, hence why the need of two separate calls. I haven't personally found a better solution yet.

@@ -21,8 +21,8 @@ sudo - execute a command as another user using doas

== SYNOPSIS

*sudo* (-i | -s) [-n] [-u <__user__>] [<__command__> [--] [<__args__>...]] +
*sudo* [-ins] [-u <__user__>] <__command__> [--] [<__args__>...] +
*sudo* (-i | -s) [-n] [-k] [-u <__user__>] [<__command__> [--] [<__args__>...]] +
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*sudo* (-i | -s) [-n] [-k] [-u <__user__>] [<__command__> [--] [<__args__>...]] +
*sudo* (-i | -k | -s) [-n] [-u <__user__>] [<__command__> [--] [<__args__>...]] +

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants