bootstrap v1.0.2

This commit is contained in:
Timerix 2025-04-25 21:09:52 +05:00
parent 4488776afe
commit d3d7867736

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CBUILD_BOOTSTRAP_VERSION=1.0.1 CBUILD_BOOTSTRAP_VERSION=1.0.2
set -eo pipefail set -eo pipefail
function version_parse { function version_parse {
@ -34,13 +34,14 @@ function print_version_list {
dir_global="/usr/local/share/cbuild" dir_global="/usr/local/share/cbuild"
files="" files=""
if [ -d "$dir_local" ]; then if [ -d "$dir_local" ]; then
files+="$(find $dir_local -name 'CBUILD_VERSION')" files+=$(find "$dir_local" -maxdepth 2 -name 'CBUILD_VERSION')
fi fi
if [ -d "$dir_global" ]; then if [ -d "$dir_global" ]; then
files+="$(find $dir_global -name 'CBUILD_VERSION')" files+=$(find "$dir_global" -maxdepth 2 -name 'CBUILD_VERSION')
fi fi
for f in $files; do for f in $files; do
cat $f | sed '$a\' cat $f
echo " at $(dirname $f)"
done | sort -V done | sort -V
} }
@ -68,18 +69,18 @@ do
case "${args[i]}" in case "${args[i]}" in
'-v' | '--version') '-v' | '--version')
echo "cbuild-bootstrap v$CBUILD_BOOTSTRAP_VERSION" echo "cbuild-bootstrap v$CBUILD_BOOTSTRAP_VERSION"
echo "list of installed cbuild versions:"
print_version_list
exit 0
;; ;;
'-h' | '--help') '-h' | '--help')
print_help print_help
exit 0
;; ;;
'-c' | '--config') '-c' | '--config')
i=$((i+1)) i=$((i+1))
project_config_path="${args[i]}" project_config_path="${args[i]}"
;; ;;
'--list-versions')
print_version_list
exit 0
;;
*) *)
;; ;;
esac esac
@ -93,9 +94,9 @@ if [ -z "$CBUILD_VERSION" ]; then
else else
echo "project config not found" echo "project config not found"
echo "list of installed cbuild versions:" echo "list of installed cbuild versions:"
versions=$(print_version_list) print_version_list
# cut installation directories from list
echo "$versions" versions=$(print_version_list | cut -d ' ' -f 1)
latest_version=$(echo "$versions" | tail -n 1) latest_version=$(echo "$versions" | tail -n 1)
echo "select version (default=$latest_version):" echo "select version (default=$latest_version):"
read -r CBUILD_VERSION read -r CBUILD_VERSION