task: Script renaming and variable quoting to work on windows and handle paths with spaces.
Signed-off-by: Dillon <35014341+dljm@users.noreply.github.com>
This commit is contained in:
19
.github/ISSUE_TEMPLATE/bug_report.md
vendored
19
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,10 +1,9 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: '[BUG] '
|
||||
labels: 'Type: Bug'
|
||||
title: "[BUG] "
|
||||
labels: "Type: Bug"
|
||||
assignees: jerlendds
|
||||
|
||||
---
|
||||
|
||||
**Bug Description:**
|
||||
@@ -13,10 +12,9 @@ A clear and concise description of what the bug is...
|
||||
|
||||
**How to Reproduce:**
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
**Expected behavior:**
|
||||
|
||||
@@ -24,15 +22,14 @@ A clear and concise description of what the bug is...
|
||||
|
||||
**Screenshots & Logs:**
|
||||
|
||||
Please run `./launcher debug:send` to upload and get a public link to your log files.
|
||||
Please run `./launcher debug_send` to upload and get a public link to your log files.
|
||||
This will help us with debugging and solving any issues.
|
||||
|
||||
**Environment:**
|
||||
- OS: Linux
|
||||
- Browser: Firefox
|
||||
|
||||
- OS: Linux
|
||||
- Browser: Firefox
|
||||
|
||||
**Additional context:**
|
||||
|
||||
...
|
||||
|
||||
|
||||
24
launcher
24
launcher
@@ -44,10 +44,10 @@ usage () {
|
||||
echo -e " $(c YsB)stop$(c): Stop the OSINTBuddy app (or a specific container ./launcher stop janus)."
|
||||
echo -e " $(c YsB)build$(c): Build the OSINTBuddy app (or a specific container ./launcher build ui)."
|
||||
echo -e " $(c YsB)restart$(c): Restart the app (or a specific container: ./launcher restart janus)."
|
||||
echo -e " $(c YsB)api:gen$(c): Generate API client SDK from the backend OpenAPI spec; launch the UI outside of the container"
|
||||
echo -e " $(c YsB)setup:dev$(c): Create python3 venv and install dev dependencies"
|
||||
echo -e " $(c YsB)api_gen$(c): Generate API client SDK from the backend OpenAPI spec; launch the UI outside of the container"
|
||||
echo -e " $(c YsB)setup_dev$(c): Create python3 venv and install dev dependencies"
|
||||
echo -e " $(c YsB)bootstrap$(c): Initialize and download dependencies and check for environment misconfigurations"
|
||||
echo -e " $(c YsB)debug:send$(c): Upload all logs to https://paste.c-net.org for help with debugging"
|
||||
echo -e " $(c YsB)debug_send$(c): Upload all logs to https://paste.c-net.org for help with debugging"
|
||||
echo -e " $(c YsB)cleanup$(c): Remove docker volumes."
|
||||
echo -e " $(c YsB)exec$(c): Execute commands for a container."
|
||||
echo -e " $(c YsB)migrate$(c): Generate a migration."
|
||||
@@ -55,7 +55,7 @@ usage () {
|
||||
echo -e " $(c YsB)ui$(c): Stop the UI container and launch the frontend locally."
|
||||
echo -e " $(c YsB)kill$(c): Kill containers; down the stack."
|
||||
echo -e " $(c YsB)containers$(c): List the names you can access the containers by"
|
||||
echo -e " $(c YsB)pkg:update$(c): Update the osintbuddy package locally and in docker from the osintbuddy-plugins repo (used in dev)"
|
||||
echo -e " $(c YsB)pkg_update$(c): Update the osintbuddy package locally and in docker from the osintbuddy-plugins repo (used in dev)"
|
||||
usage_containers
|
||||
|
||||
exit 1
|
||||
@@ -85,8 +85,8 @@ case "$OB_CMD" in
|
||||
logs)
|
||||
./cmd/logs
|
||||
;;
|
||||
api:gen)
|
||||
./cmd/api:gen
|
||||
api_gen)
|
||||
./cmd/api_gen
|
||||
;;
|
||||
kill)
|
||||
./cmd/downkill
|
||||
@@ -94,8 +94,8 @@ case "$OB_CMD" in
|
||||
ui)
|
||||
./cmd/ui_dev
|
||||
;;
|
||||
debug:send)
|
||||
./cmd/debug:send
|
||||
debug_send)
|
||||
./cmd/debug_send
|
||||
;;
|
||||
cleanup)
|
||||
./cmd/stop
|
||||
@@ -110,11 +110,11 @@ case "$OB_CMD" in
|
||||
migrate)
|
||||
./cmd/migrate
|
||||
;;
|
||||
setup:dev)
|
||||
./cmd/setup:dev
|
||||
setup_dev)
|
||||
./cmd/setup_dev
|
||||
;;
|
||||
pkg:update)
|
||||
./cmd/pkg:update
|
||||
pkg_update)
|
||||
./cmd/pkg_update
|
||||
;;
|
||||
ps)
|
||||
./cmd/ps
|
||||
|
||||
0
ob/cmd/api:gen → ob/cmd/api_gen
Executable file → Normal file
0
ob/cmd/api:gen → ob/cmd/api_gen
Executable file → Normal file
@@ -90,30 +90,29 @@ check_prereqs() {
|
||||
python_min_version='3.11.0'
|
||||
python_rec_version='3.11.4'
|
||||
|
||||
# 0. TODO: Install windows and test git crlf config...
|
||||
# (Please, someone else do this, I really don't want to install windows..)
|
||||
if [[ $(grep -i Microsoft /proc/version) ]]; then
|
||||
# Test git crlf config for windows devices
|
||||
if [ $is_windows ]; then
|
||||
heading "Windows detected! Checking for environment issues..."
|
||||
prepare_windows
|
||||
fi
|
||||
|
||||
if [ -z $docker_path ]; then
|
||||
|
||||
if [ -z "$docker_path" ]; then
|
||||
install_docker
|
||||
fi
|
||||
|
||||
|
||||
# 1. docker daemon running?
|
||||
# we send stderr to /dev/null cause we don't care about warnings,
|
||||
# it usually complains about swap which does not matter
|
||||
test=`$docker_path info 2> /dev/null`
|
||||
test=`"$docker_path" info 2> /dev/null`
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
error "Cannot connect to the docker daemon - verify it is running and you have access"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 2. running recommended docker version
|
||||
test=($($docker_path --version)) # Get docker version string
|
||||
test=($("$docker_path" --version)) # Get docker version string
|
||||
test=${test[2]//,/} # Get version alone and strip comma if exists
|
||||
|
||||
|
||||
# At least minimum docker version
|
||||
if compare_version "${docker_min_version}" "${test}"; then
|
||||
echo "ERROR: Docker version ${test} not supported, please upgrade to at least ${docker_min_version}, or recommended ${docker_rec_version}"
|
||||
@@ -122,19 +121,17 @@ check_prereqs() {
|
||||
|
||||
|
||||
# 3. has node and running recommended node version
|
||||
if [ -z "$(which $node)" ]; then
|
||||
if [ -z "$node" ]; then
|
||||
warning "Node environment not detected! We recommend installing Node 18.18.2 for this project."
|
||||
warning "Some ./launcher commands may not work without a node environment."
|
||||
heading "Attempting to continue without Node..."
|
||||
fi
|
||||
|
||||
test=($($node --version))
|
||||
test=($("$node" --version))
|
||||
test=${test[0]//v/} # Get version alone and strip the prefixed v
|
||||
|
||||
|
||||
|
||||
if compare_version "${node_min_version}" "${test}"; then
|
||||
echo "WARNING: Node version ${test} not supported, please upgrade to at least ${node_min_version}, or recommended ${node_rec_version}"
|
||||
warning "WARNING: Node version ${test} not supported, please upgrade to at least ${node_min_version}, or recommended ${node_rec_version}"
|
||||
fi
|
||||
|
||||
# Recommend best Node version
|
||||
@@ -143,7 +140,7 @@ check_prereqs() {
|
||||
fi
|
||||
|
||||
# 4. running recommended Python version
|
||||
test=($($python3 --version))
|
||||
test=($("$python3" --version))
|
||||
test=${test[1]///} # Get version alone and strip the prefixed v
|
||||
|
||||
if compare_version "${python_min_version}" "${test}"; then
|
||||
@@ -180,7 +177,7 @@ check_prereqs() {
|
||||
esac
|
||||
|
||||
# 4. running recommended git version
|
||||
test=($($git_path --version)) # Get git version string
|
||||
test=($("$git_path" --version)) # Get git version string
|
||||
test=${test[2]//,/} # Get version alone and strip comma if exists
|
||||
|
||||
# At least minimum version
|
||||
@@ -216,7 +213,7 @@ setup_python_env() {
|
||||
|
||||
setup_ui_env() {
|
||||
cd ../frontend/ && yarn && yarn install:hooks
|
||||
info "Generate the UI API client with: ./launcher api:gen"
|
||||
info "Generate the UI API client with: ./launcher api_gen"
|
||||
cd "$OB_DIR"
|
||||
}
|
||||
|
||||
|
||||
0
ob/cmd/debug:send → ob/cmd/debug_send
Executable file → Normal file
0
ob/cmd/debug:send → ob/cmd/debug_send
Executable file → Normal file
@@ -1,11 +1,13 @@
|
||||
#!/usr/bin/bash
|
||||
# used by ./ob/cmd/* scripts ran by this ./launcher
|
||||
. ./cmd/_colors
|
||||
. ./cmd/utils
|
||||
|
||||
export node=`which node`
|
||||
export python3=`which python`
|
||||
export docker_path=`which docker`
|
||||
export git_path=`which git`
|
||||
export is_windows=get_is_windows
|
||||
|
||||
|
||||
# https://docs.docker.com/compose/environment-variables/envvars/
|
||||
@@ -16,7 +18,7 @@ export COMPOSE_FILE="$(pwd)/alpha-compose.yml"
|
||||
export OB_COMPOSE_OVERRIDE="$(pwd)/alpha-compose.override.yml"
|
||||
|
||||
ob_compose() {
|
||||
$docker_path compose -f $COMPOSE_FILE -f $OB_COMPOSE_OVERRIDE "$@"
|
||||
"$docker_path" compose -f $COMPOSE_FILE -f $OB_COMPOSE_OVERRIDE "$@"
|
||||
}
|
||||
|
||||
# Colored logs...
|
||||
|
||||
0
ob/cmd/pkg:update → ob/cmd/pkg_update
Executable file → Normal file
0
ob/cmd/pkg:update → ob/cmd/pkg_update
Executable file → Normal file
0
ob/cmd/setup:dev → ob/cmd/setup_dev
Executable file → Normal file
0
ob/cmd/setup:dev → ob/cmd/setup_dev
Executable file → Normal file
@@ -3,7 +3,7 @@
|
||||
|
||||
run_uidev() {
|
||||
unset ERR
|
||||
cmd/api:gen || ERR=$?
|
||||
cmd/api_gen || ERR=$?
|
||||
if [[ $ERR > 0 ]]; then
|
||||
error "We ran into an error generating the frontends API client. Is the backend running?"
|
||||
fi
|
||||
|
||||
19
ob/cmd/utils
Normal file
19
ob/cmd/utils
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Helpful utility functions used by various scripts
|
||||
|
||||
function get_is_windows() {
|
||||
# Check if the OSTYPE variable is null or unset
|
||||
if [ -z "$OSTYPE" ]; then
|
||||
return 1 # Not Windows
|
||||
else
|
||||
# Check the operating system to determine if it is Windows
|
||||
case "$OSTYPE" in
|
||||
msys*|cygwin*|mingw*|win32*)
|
||||
return 0 # Windows
|
||||
;;
|
||||
*)
|
||||
return 1 # Not Windows
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user