Skip to content

Commit

Permalink
feat: add lsusb (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
serdigital64 authored Dec 7, 2024
1 parent 9b1f928 commit 769f1d9
Show file tree
Hide file tree
Showing 108 changed files with 1,256 additions and 1,553 deletions.
2 changes: 1 addition & 1 deletion .devbin64
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.0
6.1.0
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.15.0]

### Added

- Linux-Dev
- linux-dev-usb-list-tree

## [0.14.0]

### Added
Expand Down
33 changes: 6 additions & 27 deletions bin/dev-git-tag-create
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Dev / GIT / Create and push GIT tag
#
# * Works on the main branch
# * Version: 2.1.1
# * Version: 2.2.0
#
#######################################
# Copyright [2023] [serdigital64@gmail.com]
Expand Down Expand Up @@ -44,30 +44,6 @@ source "${DEV_LIB_BASHLIB64_TARGET}/bashlib64-module-xsv.bash" &&
# Functions
#

function dev_git_get_changes() {
bl64_dbg_app_show_function "$@"
local tag="$1"
bl64_txt_run_awk -v tag="$tag" '
BEGIN {
section = 0
pattern = "## \\[" tag "\\]"
}
/^$/ { next }
section == 0 && $0 ~ pattern {
section = 1
next
}
section == 1 && (/^## \[[0-9]+\.[0-9]\.+[0-9]+\]$/ || /^\[[0-9]+\.[0-9]\.+[0-9]+\]: /) {
exit
}
section == 1 {
gsub(/#/,"*")
print $0
next
}
' "$DEV_BASE_CHANGELOG"
}

function dev_git_tag_create() {
bl64_dbg_app_show_function "$@"
local new_tag="$1"
Expand All @@ -82,8 +58,11 @@ function dev_git_tag_create() {
bl64_msg_show_task "create tag (${new_tag})"
if bl64_lib_flag_is_enabled "$include_changelog"; then
message="$(bl64_fs_create_tmpfile)" &&
dev_git_get_changes "$new_tag" >"$message"
[[ ! -s "$message" ]] && bl64_msg_show_error 'Unable to extract changelog for the requested tag' && status=1
bl64_vcs_changelog_get_release "$DEV_BASE_CHANGELOG" "$new_tag" >"$message"

[[ ! -s "$message" ]] &&
bl64_msg_show_error 'Unable to extract changelog for the requested tag' && status=1

((status == 0)) && git tag "$new_tag" --file "$message" || status=1
bl64_fs_rm_tmpfile "$message"
((status != 0)) && return $status
Expand Down
87 changes: 87 additions & 0 deletions bin/dev-git-tag-destroy
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env bash
#######################################
# Dev / GIT / Remove tag
#
# * Remove from local, origin and upstream
# * Works on the main branch
# * Version: 1.0.0
#
#######################################
# Copyright [2023] [serdigital64@gmail.com]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#######################################

#
# Imports
#

# shellcheck source=bin/dev-set
source ./bin/dev-set || { echo 'dev-set:Error: unable to load dev environment' 2>&1 && exit 1; }
# shellcheck source-path=bin
source ./bin/dev-env-git || exit 1
# shellcheck source-path=lib/bl64
source "${DEV_LIB_BASHLIB64_TARGET}/bashlib64-module-xsv.bash" &&
source "${DEV_LIB_BASHLIB64_TARGET}/bashlib64-module-bsh.bash" &&
source "${DEV_LIB_BASHLIB64_TARGET}/bashlib64-module-fmt.bash" &&
source "${DEV_LIB_BASHLIB64_TARGET}/bashlib64-module-fs.bash" &&
source "${DEV_LIB_BASHLIB64_TARGET}/bashlib64-module-rxtx.bash" &&
source "${DEV_LIB_BASHLIB64_TARGET}/bashlib64-module-txt.bash" &&
source "${DEV_LIB_BASHLIB64_TARGET}/bashlib64-module-api.bash" &&
source "${DEV_LIB_BASHLIB64_TARGET}/bashlib64-module-vcs.bash" &&
source "${DEV_LIB_BASHLIB64_TARGET}/bashlib64-core.bash" || exit 1

#
# Functions
#

function dev_git_tag_destroy() {
bl64_dbg_app_show_function "$@"
local tag="$1"

bl64_msg_show_task "switch to main branch (${DEV_GIT_BRANCH_MAIN})"
bl64_vcs_run_git checkout "$DEV_GIT_BRANCH_MAIN" ||
return $?

bl64_msg_show_task "destroy local tag (${tag})"
bl64_vcs_run_git tag -d "$tag"

bl64_msg_show_task "destroy tag in origin (${DEV_GIT_REMOTE_ORIGIN})"
bl64_vcs_run_git push -d "$DEV_GIT_REMOTE_ORIGIN" "$tag"

if bl64_lib_flag_is_enabled "$DEV_GIT_REMOTE_UPSTREAM_ENABLED"; then
bl64_msg_show_task "destroy tag in upstream (${DEV_GIT_REMOTE_UPSTREAM})"
bl64_vcs_run_git push -d "$DEV_GIT_REMOTE_UPSTREAM" "$tag"
fi
}

function dev_git_initialize() {
bl64_dbg_app_show_function "$@"
local tag="$1"
bl64_check_parameter 'tag' &&
bl64_vcs_setup
}

#
# Main
#

declare dev_git_tag="${1:-}"

[[ -n "$DEV_CICD_DEBUG" ]] && bl64_dbg_all_enable

bl64_msg_all_enable_verbose
bl64_msg_show_batch_start 'dev-git-tag-destroy'
dev_git_initialize "$dev_git_tag" &&
dev_git_tag_destroy "$dev_git_tag"
bl64_msg_show_batch_finish $? 'dev-git-tag-destroy'
2 changes: 1 addition & 1 deletion docs/skeletons/module-lib/module-lib
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" ||
{ echo "Error: unable to load bashlib64" && exit 1; }
{ echo 'Error: unable to load bashlib64' && exit 1; }

#
# Globals
Expand Down
8 changes: 3 additions & 5 deletions docs/skeletons/one-liner-base/module-task
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@

declare command='X_COMMAND_X'

bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" || exit $?
initialize || exit $?

bl64_msg_show_batch_start "${BL64_SCRIPT_ID}"
bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?
bl64_msg_show_batch_start "$BL64_SCRIPT_ID"
# X_COMMAND_PLACEHOLDER_X
bl64_msg_show_batch_finish $? "${BL64_SCRIPT_ID}"
bl64_msg_show_batch_finish $? "$BL64_SCRIPT_ID"
15 changes: 5 additions & 10 deletions docs/skeletons/one-liner/module-task
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@

declare S64_CORE_PATH_ROOT="${S64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/core/core-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/X_MODULE_X/X_MODULE_X-lib" || { echo "Error: unable to load module library" && exit 1; }
source "${S64_CORE_PATH_ROOT}/core/core-lib" && source "${S64_CORE_PATH_ROOT}/core/X_MODULE_X-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" ||
{ echo "Error: unable to load bashlib64" && exit 1; }
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" || { echo 'Error: unable to load bashlib64' && exit 1; }

#
# Functions
Expand All @@ -50,9 +47,7 @@ function initialize() {
# Main
#

bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" || exit $?
initialize || exit $?

bl64_msg_show_batch_start "${BL64_SCRIPT_ID}"
bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?
bl64_msg_show_batch_start "$BL64_SCRIPT_ID"
# X_COMMAND_PLACEHOLDER_X
bl64_msg_show_batch_finish $? "${BL64_SCRIPT_ID}"
bl64_msg_show_batch_finish $? "$BL64_SCRIPT_ID"
21 changes: 10 additions & 11 deletions docs/skeletons/task-generic-base/module-task
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function X_COMMAND_X() {

function initialize() {
bl64_dbg_app_show_function
bl64_check_parameter 'command' ||
bl64_check_parameter 'COMMAND' ||
{ help && return 1; }

# X_INIT_PLACEHOLDER_X
Expand All @@ -67,22 +67,21 @@ function help() {
# Main
#

declare command="$BL64_VAR_NULL"
declare option=''
declare COMMAND="$BL64_VAR_NULL"
declare OPTION=''

(($# == 0)) && help && exit 1
while getopts ':xV:D:h' option; do
case "$option" in
x) command='X_COMMAND_X' ;;
while getopts ':xV:D:h' OPTION; do
case "$OPTION" in
x) COMMAND='X_COMMAND_X' ;;
V) S64_CORE_SET_VERBOSE="$OPTARG" ;;
D) S64_CORE_SET_DEBUG="$OPTARG" ;;
h) help && exit 0 ;;
*) help && exit 1 ;;
esac
done
bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" || exit $?
initialize || exit $?
bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?

bl64_msg_show_batch_start "${BL64_SCRIPT_ID}:$command"
"${command}"
bl64_msg_show_batch_finish $? "${BL64_SCRIPT_ID}:$command"
bl64_msg_show_batch_start "${BL64_SCRIPT_ID}:$COMMAND"
"${COMMAND}"
bl64_msg_show_batch_finish $? "${BL64_SCRIPT_ID}:$COMMAND"
28 changes: 12 additions & 16 deletions docs/skeletons/task-generic/module-task
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@

declare S64_CORE_PATH_ROOT="${S64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/core/core-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/X_MODULE_X/X_MODULE_X-lib" || { echo "Error: unable to load module library" && exit 1; }
source "${S64_CORE_PATH_ROOT}/core/core-lib" && source "${S64_CORE_PATH_ROOT}/core/X_MODULE_X-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" ||
{ echo "Error: unable to load bashlib64" && exit 1; }
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" || { echo 'Error: unable to load bashlib64' && exit 1; }

#
# Globals
Expand All @@ -54,7 +51,7 @@ function X_COMMAND_X() {
function initialize() {
bl64_dbg_app_show_function

bl64_check_parameter 'command' ||
bl64_check_parameter 'COMMAND' ||
{ help && return 1; }

# optional # s64_X_MODULE_X_lib_setup || return $?
Expand All @@ -80,22 +77,21 @@ function help() {
# Main
#

declare command="$BL64_VAR_NULL"
declare option=''
declare COMMAND="$BL64_VAR_NULL"
declare OPTION=''

(($# == 0)) && help && exit 1
while getopts ':xV:D:h' option; do
case "$option" in
x) command='X_COMMAND_X' ;;
while getopts ':xV:D:h' OPTION; do
case "$OPTION" in
x) COMMAND='X_COMMAND_X' ;;
V) S64_CORE_SET_VERBOSE="$OPTARG" ;;
D) S64_CORE_SET_DEBUG="$OPTARG" ;;
h) help && exit 0 ;;
*) help && exit 1 ;;
esac
done
bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" || exit $?
initialize || exit $?
bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?

bl64_msg_show_batch_start "${BL64_SCRIPT_ID}:$command"
"${command}"
bl64_msg_show_batch_finish $? "${BL64_SCRIPT_ID}:$command"
bl64_msg_show_batch_start "${BL64_SCRIPT_ID}:$COMMAND"
"${COMMAND}"
bl64_msg_show_batch_finish $? "${BL64_SCRIPT_ID}:$COMMAND"
2 changes: 1 addition & 1 deletion docs/snippets/module-cli/cli_setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# X_IMPORTS_PLACEHOLDER_X
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" ||
{ echo "Error: unable to load bashlib64" && exit 1; }
{ echo 'Error: unable to load bashlib64' && exit 1; }


# X_CLI_SETUP_PLACEHOLDER_X
Expand Down
8 changes: 3 additions & 5 deletions docs/snippets/task-import/import.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# X_IMPORTS_PLACEHOLDER_X
declare S64_CORE_PATH_ROOT="${S64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/core/core-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/X_MODULE_X/X_MODULE_X-lib" || { echo "Error: unable to load module library" && exit 1; }
source "${S64_CORE_PATH_ROOT}/core/core-lib" &&
source "${S64_CORE_PATH_ROOT}/core/X_MODULE_X-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" ||
{ echo "Error: unable to load bashlib64" && exit 1; }
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" || { echo 'Error: unable to load bashlib64' && exit 1; }
Empty file modified dot.secrets.env
100755 → 100644
Empty file.
15 changes: 5 additions & 10 deletions src/argocd/argocd-app-list
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@
#

declare S64_CORE_PATH_ROOT="${S64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/core/core-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/argocd/argocd-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" ||
{ echo "Error: unable to load bashlib64" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/core/core-lib" && source "${S64_CORE_PATH_ROOT}/core/argocd-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015,SC2154 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" || { echo 'Error: unable to load bashlib64' && exit 1; }

#
# Functions
Expand All @@ -47,9 +44,7 @@ function initialize() {
# Main
#

bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" || exit $?
initialize || exit $?

bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?
bl64_msg_show_batch_start "$BL64_SCRIPT_ID"
s64_argocd_lib_run_argocd \
app \
Expand Down
Loading

0 comments on commit 769f1d9

Please sign in to comment.