Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bin/backup
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ expire_date=
archive_prefix=
quiet=()

# @formatter:off
# TEMP: remove when https://github.com/lovesegfault/beautysh/issues/265 is fixed
while :; do
case "${1:-}" in
-s | --source)
Expand Down Expand Up @@ -170,6 +172,7 @@ while :; do
esac
shift
done
# @formatter:on

check-root

Expand Down
11 changes: 7 additions & 4 deletions bin/benchmark
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
############

# Version
version=1.2.4
version=1.2.5
# Individual benchmark time limit (seconds)
# Quick benchmark
test_run_time_quick=6
Expand Down Expand Up @@ -168,7 +168,7 @@ _cpu-app-test() {
## @param $@ Params for benchmark
#####################################
_run-benchmark() {
local type="${1?:Benchmark type missing}"
local type="${1:?Benchmark type missing}"
local params=("--time=${test_run_time}")

# Compile params
Expand Down Expand Up @@ -200,8 +200,8 @@ _run-benchmark() {
## @param $2 Raw results
#######################################
_filter-results() {
local type="${1?:Benchmark type missing}"
local raw="${2?:Raw results missing}"
local type="${1:?Benchmark type missing}"
local raw="${2:?Raw results missing}"
local filter

case "${type}" in
Expand Down Expand Up @@ -362,6 +362,8 @@ report_file_prefix=
sys_check=
benchmark_depth=
params_file=
# @formatter:off
# TEMP: remove when https://github.com/lovesegfault/beautysh/issues/265 is fixed
while :; do
case "${1:-}" in
-r | --report) create_report=1 ;;
Expand Down Expand Up @@ -399,6 +401,7 @@ while :; do
esac
shift
done
# @formatter:on

if [[ -z "${sys_check}" && -z "${benchmark_depth}" ]]; then
echo "Benchmark depth missing (quick or full)" >&2
Expand Down
3 changes: 3 additions & 0 deletions bin/clean
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ journal_retention=2w
quiet=()
redirection=/dev/stdout

# @formatter:off
# TEMP: remove when https://github.com/lovesegfault/beautysh/issues/265 is fixed
while :; do
case "${1:-}" in
-j | --journal)
Expand Down Expand Up @@ -92,6 +94,7 @@ while :; do
esac
shift
done
# @formatter:on

uid=$(id -u)
if [[ "${uid}" -ne 0 ]]; then
Expand Down
4 changes: 2 additions & 2 deletions bin/generate-moduli
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
## @param $2 Output file path
#########################################
_generate-DH-primes() {
local bit="${1?:Bit missing}"
local output_file="${2?:Output file name missing}"
local bit="${1:?Bit missing}"
local output_file="${2:?Output file name missing}"
local candidates
candidates=$(mktemp --tmpdir DH_candidates.XXXXXXXX)

Expand Down
7 changes: 5 additions & 2 deletions bin/pass-man
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
_usage() {
cat <<HELP

pass-man v1.4.0
pass-man v1.4.1
Written by Sandor Semsey, Copyright (C) 2020, License MIT

Usage: pass-man ACTION [TARGET] [EXTRA]...
Expand Down Expand Up @@ -75,7 +75,7 @@ _vault-generate() {
## @param $@ Extra arguments to 'pass'
##########################################
_vault-retrieve() {
local path="${1?:Path to password missing}"
local path="${1:?Path to password missing}"
shift
_vault-open
pass "${@}" "${path}"
Expand All @@ -97,6 +97,8 @@ action="${1:-}"
[[ -n "${action}" ]] && shift

# Switch action
# @formatter:off
# TEMP: remove when https://github.com/lovesegfault/beautysh/issues/265 is fixed
case "${action}" in
open) _vault-open "${@}" ;;
close) _vault-close "${@}" ;;
Expand All @@ -114,5 +116,6 @@ case "${action}" in
"") print-error Action missing && _usage ;;
*) print-error Invalid action && _usage ;;
esac
# @formatter:on

exit 0
6 changes: 3 additions & 3 deletions bin/sign-kernel-modules
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ IFS=$'\n\t'
source "${ES_SHELL_LOADER}"
check-root

module="${1?:Kernel module missing}"
key="${2?:MOK private key missing}"
cert="${3?:MOK certificate missing}"
module="${1:?Kernel module missing}"
key="${2:?MOK private key missing}"
cert="${3:?MOK certificate missing}"

module_file=$(modinfo -n "${module}")
module_dir=$(dirname "${module_file}")
Expand Down
4 changes: 2 additions & 2 deletions bin/test-dd-write
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ _clean-up() {
## @param $2 Number of blocks to write
##########################################
_test-block-size() {
local bs="${1?:Block size missing}"
local count="${2?:Number of blocks missing}"
local bs="${1:?Block size missing}"
local count="${2:?Number of blocks missing}"

echo Testing block size = "${bs}"
dd if=/dev/urandom of="${test_file_name}" bs="${bs}" count="${count}" iflag=fullblock
Expand Down
42 changes: 21 additions & 21 deletions lib/certificate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
## @param $3 CSR subject
###########################################
csr-create() {
local priv_key="${1?:Private key path missing}"
local csr="${2?:CSR path missing}"
local subject="${3?:CSR subject missing}"
local priv_key="${1:?Private key path missing}"
local csr="${2:?CSR path missing}"
local subject="${3:?CSR subject missing}"
shift 3
openssl req \
-new \
Expand All @@ -36,11 +36,11 @@ csr-create() {
## @param $5 Validity in days
###########################################
csr-sign() {
local ca_priv_key="${1?:CA private key path missing}"
local ca_cert="${2?:CA cert path missing}"
local csr="${3?:CSR path missing}"
local cert="${4?:Certificate path missing}"
local validity="${5?:Valid days missing}"
local ca_priv_key="${1:?CA private key path missing}"
local ca_cert="${2:?CA cert path missing}"
local csr="${3:?CSR path missing}"
local cert="${4:?Certificate path missing}"
local validity="${5:?Valid days missing}"
local subject site tmp_config
shift 5

Expand Down Expand Up @@ -74,7 +74,7 @@ EOF
## @param $1 CSR path
#########################
csr-view() {
local csr="${1?:CSR path missing}"
local csr="${1:?CSR path missing}"
shift
openssl req \
-noout \
Expand All @@ -87,7 +87,7 @@ csr-view() {
## @param $1 Key path
#########################
cert-key() {
local key="${1?:Key path missing}"
local key="${1:?Key path missing}"
shift
openssl genpkey \
-aes-256-cbc \
Expand All @@ -104,10 +104,10 @@ cert-key() {
## @param $4 Certificate subject
####################################
cert-selfsigned() {
local priv_key="${1?:Private key path missing}"
local cert="${2?:Certificate path missing}"
local validity="${3?:Valid days missing}"
local subject="${4?:Certificate subject missing}"
local priv_key="${1:?Private key path missing}"
local cert="${2:?Certificate path missing}"
local validity="${3:?Valid days missing}"
local subject="${4:?Certificate subject missing}"
shift 4
openssl req \
-new \
Expand All @@ -134,12 +134,12 @@ cert-selfsigned() {
## default: RSA,rsa_keygen_bits:4096
####################################################################
cert-create() {
local priv_key="${1?:Private key path missing}"
local subject="${2?:CSR subject missing}"
local ca_priv_key="${3?:CA private key path missing}"
local ca_cert="${4?:CA cert path missing}"
local cert="${5?:Certificate path missing}"
local validity="${6?:Valid days missing}"
local priv_key="${1:?Private key path missing}"
local subject="${2:?CSR subject missing}"
local ca_priv_key="${3:?CA private key path missing}"
local ca_cert="${4:?CA cert path missing}"
local cert="${5:?Certificate path missing}"
local validity="${6:?Valid days missing}"
local priv_key_type="${7:-RSA,rsa_keygen_bits:4096}"
local csr key_opts option
local priv_key_options=()
Expand All @@ -162,7 +162,7 @@ cert-create() {
## @param $1 Cert path
##########################
cert-view() {
local cert="${1?:Certificate path missing}"
local cert="${1:?Certificate path missing}"
shift
openssl x509 \
-noout \
Expand Down
12 changes: 6 additions & 6 deletions lib/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## @param $1 Remote host
###################################
debug-tunnel-open() {
local remote="${1?:Remote missing}"
local remote="${1:?Remote missing}"
ssh-tunnel-open -fqN -R 9003:localhost:9003 "${remote}"
}

Expand All @@ -19,7 +19,7 @@ debug-tunnel-open() {
## @param $1 Remote host
####################################
debug-tunnel-close() {
local remote="${1?:Remote missing}"
local remote="${1:?Remote missing}"
ssh-tunnel-close -fqN -R 9003:localhost:9003 "${remote}"
}

Expand All @@ -30,8 +30,8 @@ debug-tunnel-close() {
## @param $@ Extra args to mkdocs build
###########################################
build-mkdocs() {
local config_file="${1?:mkdocs config file missing}"
local destination="${2?:Build destination missing}"
local config_file="${1:?mkdocs config file missing}"
local destination="${2:?Build destination missing}"
shift 2

mkdocs build -f "${config_file}" -d "${destination}" "${@}"
Expand Down Expand Up @@ -75,8 +75,8 @@ ppretty-json() {
## @param $2 Which part to bump (major, minor, patch)
########################################################
bump-version() {
local version="${1?:Version missing}"
local part="${2?:Version part missing}"
local version="${1:?Version missing}"
local part="${2:?Version part missing}"
local major minor patch

IFS=. read -r major minor patch <<< "${version}"
Expand Down
10 changes: 5 additions & 5 deletions lib/git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ggit-report() {
## @param $1 How many commits from HEAD
###########################################
ggit-fix() {
local commits="${1?:Commits missing}"
local commits="${1:?Commits missing}"
git rebase -i "HEAD~${commits}"
}

Expand Down Expand Up @@ -103,8 +103,8 @@ ggit-update() {
## @param $2 Branch B
#########################
ggit-diff() {
local branch_a="${1?:Branch A missing}"
local branch_b="${2?:Branch B missing}"
local branch_a="${1:?Branch A missing}"
local branch_b="${2:?Branch B missing}"
git diff --stat "${branch_a}" "${branch_b}"
}

Expand Down Expand Up @@ -156,7 +156,7 @@ ggit-base() {
## @default origin
#################################
ggit-tag() {
local name="${1?:Tag name missing}"
local name="${1:?Tag name missing}"
local commit="${2:-HEAD}"
local message="${3:-${name}}"
local remote="${4:-origin}"
Expand All @@ -174,7 +174,7 @@ ggit-tag() {
## @default origin
#########################################################
ggit-version() {
local part="${1?:Version part missing}"
local part="${1:?Version part missing}"
local commit="${2:-HEAD}"
local remote="${3:-origin}"
local version
Expand Down
Loading