kiss: revert audit change

This commit is contained in:
Dylan Araps 2020-02-18 21:28:35 +02:00
parent 594c54ea09
commit 52f018f01c
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

47
kiss
View File

@ -39,26 +39,14 @@ contains() {
case " $1 " in *" $2 "*) return 0; esac; return 1 case " $1 " in *" $2 "*) return 0; esac; return 1
} }
yn() { prompt() {
log "${1:-Continue?} (y/n)" # Ask the user for some input.
log "Continue?: Press Enter to continue or Ctrl+C to abort here"
# Enable raw input to allow for a single byte to be read from # POSIX 'read' has none of the "nice" options like '-n', '-p'
# stdin without needing to wait for the user to press Return. # etc etc. This is the most basic usage of 'read'.
stty -icanon -echo # '_' is used as 'dash' errors when no variable is given to 'read'.
read -r _
# Read a single byte from stdin using 'dd'. POSIX 'read' has
# no support for single/'N' byte based input from the user.
answer=$(dd ibs=1 count=1 2>/dev/null)
# Disable raw input, leaving the terminal how we *should*
# have found it.
stty icanon echo
# Handle the answer here directly, enabling this function's
# return status to be used in place of checking for '[yY]'
# throughout this program. Also call the function again if
# invalid input is given.
case $answer in y) ;; n) return 1 ;; *) yn "$1"; esac
} }
as_root() { as_root() {
@ -538,7 +526,7 @@ pkg_build() {
log "Building: $*" log "Building: $*"
# Only ask for confirmation if more than one package needs to be built. # Only ask for confirmation if more than one package needs to be built.
[ $# -gt 1 ] || [ "$pkg_update" ] && yn [ $# -gt 1 ] || [ "$pkg_update" ] && prompt
log "Checking to see if any dependencies have already been built" log "Checking to see if any dependencies have already been built"
log "Installing any pre-built dependencies" log "Installing any pre-built dependencies"
@ -572,13 +560,6 @@ pkg_build() {
pkg_verify "$@" pkg_verify "$@"
# Allow user to inspect package files prior to build.
[ "$KISS_AUDIT" != 1 ] ||
for pkg; do
yn "View build file for $pkg?" &&
"${EDITOR:-vi}" "$(pkg_find "$pkg")/build"
done
# Finally build and create tarballs for all passed packages and # Finally build and create tarballs for all passed packages and
# dependencies. # dependencies.
for pkg; do for pkg; do
@ -662,9 +643,13 @@ pkg_build() {
set -- $explicit set -- $explicit
# Only ask for confirmation if more than one package needs to be installed. # Only ask for confirmation if more than one package needs to be installed.
[ $# -gt 1 ] && yn "Install built packages? [$*]" && { [ $# -gt 1 ] && {
args i "$@" log "Install built packages? [$*]"
return
prompt && {
args i "$@"
return
}
} }
log "Run 'kiss i $*' to install the package(s)" log "Run 'kiss i $*' to install the package(s)"
@ -1161,7 +1146,7 @@ pkg_updates() {
log "Detected package manager update" log "Detected package manager update"
log "The package manager will be updated first" log "The package manager will be updated first"
yn prompt
pkg_build kiss pkg_build kiss
args i kiss args i kiss