Skip to content

Commit

Permalink
Add quiet option and defer logs
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabbenD committed Nov 15, 2023
1 parent e7bcfff commit 26a3132
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ostree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
set -o pipefail # Exit code from last command
set -e # Exit on non-zero status
set -u # Error on unset variables
set -x # Print executed commands

# [ENVIRONMENT]: OVERRIDE DEFAULTS
function ENV_CREATE_OPTS {
[[ -n ${CLI_QUIET='false'} ]]; set -x # Print executed commands while performing tasks

if [[ ! -d '/ostree' ]]; then
# Do not touch disks in a booted system:
declare OSTREE_DEV_DISK=${OSTREE_DEV_DISK:="/dev/disk/by-id/${OSTREE_DEV_SCSI}"}
Expand Down Expand Up @@ -234,8 +235,8 @@ function BOOTLOADER_CREATE {
function CLI_SETUP {
ARGS=$(getopt \
--alternative \
--options='b:,c:,d:,f:,k:,t:,m::,n::' \
--longoptions='base-os:,cmdline:,dev:,file:,keymap:,time:,merge::,no-cache::,no-pacman-cache::,no-podman-cache::' \
--options='b:,c:,d:,f:,k:,t:,m::,n::,q::' \
--longoptions='base-os:,cmdline:,dev:,file:,keymap:,time:,merge::,no-cache::,no-pacman-cache::,no-podman-cache::,quiet::' \
--name="$(basename ${0})" \
-- "${@}"
)
Expand Down Expand Up @@ -291,6 +292,10 @@ function CLI_SETUP {
declare PODMAN_OPT_CACHE=${2:-}
;;

'-q' | '--quiet')
declare CLI_QUIET=${2:-}
;;

# Positional inputs (end of options)

'--')
Expand Down Expand Up @@ -355,6 +360,7 @@ function CLI_SETUP {
' -n, --no-cache : (install/upgrade) : Skip any cached data (note: implied for first deployment)'
' --no-pacman-cache : (install/upgrade) : Skip Pacman package cache'
' --no-podman-cache : (install/upgrade) : Skip Podman layer cache'
' -q, --quiet : (install/upgrade) : Reduce verbosity'
)
printf >&1 '%s\n' "${usage[@]}"
;;&
Expand Down

0 comments on commit 26a3132

Please sign in to comment.