kiss: Only cache root on first need
This commit is contained in:
parent
164afb3b48
commit
7493ccb17b
18
kiss
18
kiss
|
@ -54,9 +54,9 @@ root_cache() {
|
||||||
# permissions where needed without the endless stream of
|
# permissions where needed without the endless stream of
|
||||||
# password prompts.
|
# password prompts.
|
||||||
printf 'Password: '
|
printf 'Password: '
|
||||||
stty -echo
|
stty -F /dev/tty -echo
|
||||||
read -r pass || read -r pass ||:
|
read -r pass </dev/tty ||:
|
||||||
stty echo
|
stty -F /dev/tty echo
|
||||||
printf '\n'
|
printf '\n'
|
||||||
|
|
||||||
# Validate the password now with a simple 'true' command
|
# Validate the password now with a simple 'true' command
|
||||||
|
@ -980,7 +980,7 @@ pkg_updates() {
|
||||||
pkg_clean() {
|
pkg_clean() {
|
||||||
# Clean up on exit or error. This removes everything related
|
# Clean up on exit or error. This removes everything related
|
||||||
# to the build.
|
# to the build.
|
||||||
stty echo 2>/dev/null
|
stty -F /dev/tty echo 2>/dev/null
|
||||||
|
|
||||||
[ "$KISS_DEBUG" != 1 ] || return
|
[ "$KISS_DEBUG" != 1 ] || return
|
||||||
|
|
||||||
|
@ -1017,17 +1017,9 @@ args() {
|
||||||
|
|
||||||
# Parse some arguments earlier to remove the need to duplicate code.
|
# Parse some arguments earlier to remove the need to duplicate code.
|
||||||
case $action in
|
case $action in
|
||||||
c|checksum|s|search)
|
c|checksum|s|search|i|install|r|remove)
|
||||||
[ "$1" ] || die "'kiss $action' requires an argument"
|
[ "$1" ] || die "'kiss $action' requires an argument"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
i|install|r|remove|u|update)
|
|
||||||
[ "$1" ] || [ -z "${action##u*}" ] ||
|
|
||||||
die "'kiss $action' requires an argument"
|
|
||||||
|
|
||||||
# Cache the root password for use where needed.
|
|
||||||
[ "$(id -u)" = 0 ] || root_cache
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Actions can be abbreviated to their first letter. This saves
|
# Actions can be abbreviated to their first letter. This saves
|
||||||
|
|
Loading…
Reference in New Issue