diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-02-18 19:28:35 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-02-18 19:28:35 +0000 |
commit | 15a1437a43395cb4e89ca3bc80126a06bdae9425 (patch) | |
tree | 492ae80ead4ba1deb4672ecb3b6c690a1c37d513 /kiss | |
parent | 38020f5af8042a967a5fdecbd5fe23224180e74f (diff) | |
download | cpt-15a1437a43395cb4e89ca3bc80126a06bdae9425.tar.gz |
kiss: revert audit change
FossilOrigin-Name: be353a5975eaec01765962a965f87c16bd98102c1ee08948074857716ea418b2
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 49 |
1 files changed, 17 insertions, 32 deletions
@@ -39,26 +39,14 @@ contains() { case " $1 " in *" $2 "*) return 0; esac; return 1 } -yn() { - log "${1:-Continue?} (y/n)" - - # Enable raw input to allow for a single byte to be read from - # stdin without needing to wait for the user to press Return. - stty -icanon -echo - - # 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 +prompt() { + # Ask the user for some input. + log "Continue?: Press Enter to continue or Ctrl+C to abort here" + + # POSIX 'read' has none of the "nice" options like '-n', '-p' + # etc etc. This is the most basic usage of 'read'. + # '_' is used as 'dash' errors when no variable is given to 'read'. + read -r _ } as_root() { @@ -538,7 +526,7 @@ pkg_build() { log "Building: $*" # 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 "Installing any pre-built dependencies" @@ -572,13 +560,6 @@ pkg_build() { 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 # dependencies. for pkg; do @@ -662,9 +643,13 @@ pkg_build() { set -- $explicit # Only ask for confirmation if more than one package needs to be installed. - [ $# -gt 1 ] && yn "Install built packages? [$*]" && { - args i "$@" - return + [ $# -gt 1 ] && { + log "Install built packages? [$*]" + + prompt && { + args i "$@" + return + } } log "Run 'kiss i $*' to install the package(s)" @@ -1161,7 +1146,7 @@ pkg_updates() { log "Detected package manager update" log "The package manager will be updated first" - yn + prompt pkg_build kiss args i kiss |