aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-27 09:24:58 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-27 09:24:58 +0000
commit24c33e6ad99fae10f33a2b7dd5c3f4b100f44706 (patch)
tree07729274661ba72c8011c40996b81065db4c8dfe /kiss
parentfdc238d49e192f7ed28b43cb6efc98c831ba752a (diff)
downloadcpt-24c33e6ad99fae10f33a2b7dd5c3f4b100f44706.tar.gz
kiss: Only cache root on first need
FossilOrigin-Name: 6cf67a86f8bcff7c01a162b751a31a81e62f982bc3745da00152211cc9a94c91
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss18
1 files changed, 5 insertions, 13 deletions
diff --git a/kiss b/kiss
index cb6753c..5107ff7 100755
--- a/kiss
+++ b/kiss
@@ -54,9 +54,9 @@ root_cache() {
# permissions where needed without the endless stream of
# password prompts.
printf 'Password: '
- stty -echo
- read -r pass || read -r pass ||:
- stty echo
+ stty -F /dev/tty -echo
+ read -r pass </dev/tty ||:
+ stty -F /dev/tty echo
printf '\n'
# Validate the password now with a simple 'true' command
@@ -980,7 +980,7 @@ pkg_updates() {
pkg_clean() {
# Clean up on exit or error. This removes everything related
# to the build.
- stty echo 2>/dev/null
+ stty -F /dev/tty echo 2>/dev/null
[ "$KISS_DEBUG" != 1 ] || return
@@ -1017,17 +1017,9 @@ args() {
# Parse some arguments earlier to remove the need to duplicate code.
case $action in
- c|checksum|s|search)
+ c|checksum|s|search|i|install|r|remove)
[ "$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
# Actions can be abbreviated to their first letter. This saves