update Makefile
This commit is contained in:
parent
677466bf72
commit
e66614d4c1
3
Makefile
3
Makefile
@ -82,6 +82,9 @@ scaffold_module:
|
|||||||
read -p "addons Path[eg:addons, extra-addons, exercise]: " ModulePath; \
|
read -p "addons Path[eg:addons, extra-addons, exercise]: " ModulePath; \
|
||||||
${PYTHON} odoo-bin scaffold $$ModuleName && \
|
${PYTHON} odoo-bin scaffold $$ModuleName && \
|
||||||
mv $$ModuleName ${PWD}/$$ModulePath;
|
mv $$ModuleName ${PWD}/$$ModulePath;
|
||||||
|
cleanup_addons:
|
||||||
|
${PWD}/setup/clean_up_addon.sh ${PWD}/exercise
|
||||||
|
|
||||||
##### Docker Deployment #########
|
##### Docker Deployment #########
|
||||||
run_test_docker:
|
run_test_docker:
|
||||||
sudo ${DOCKER_EXEC} ${CONTAINER_ID} odoo --test-tags :TestAccountMove.test_out_invoice_auto_post_monthly,TestAccountMove.test_included_tax --log-level=test --test-enable -d testdb-${TAG} --stop-after-init --config=/etc/odoo/${CONFIG} --xmlrpc-port=8071 && \
|
sudo ${DOCKER_EXEC} ${CONTAINER_ID} odoo --test-tags :TestAccountMove.test_out_invoice_auto_post_monthly,TestAccountMove.test_included_tax --log-level=test --test-enable -d testdb-${TAG} --stop-after-init --config=/etc/odoo/${CONFIG} --xmlrpc-port=8071 && \
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 97630f9e8f3ba689ef0e2984cee440b89fa68e92
|
Subproject commit fe85bbdc1376ddf54d14f6ff0adbe800101c562f
|
9
protected.txt
Normal file
9
protected.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
odoo
|
||||||
|
odoo-bin
|
||||||
|
Makefile
|
||||||
|
*.tf
|
||||||
|
*.go
|
||||||
|
odoo/*
|
||||||
|
requirements.txt
|
||||||
|
Dockerfile
|
||||||
|
automation
|
@ -1,21 +1,51 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Check if a root folder is provided as an argument
|
# Check if at least one root folder is provided as an argument
|
||||||
if [ -z "$1" ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo "Usage: $0 <root_folder>"
|
echo "Usage: $0 <root_folder> [<root_folder>...]"
|
||||||
echo "Please provide a root folder path."
|
echo "Please provide at least one root folder path."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Assign the input root folder to a variable
|
# Define the protected items list file
|
||||||
ROOT_FOLDER="$1"
|
PROTECTED_LIST="protected.txt"
|
||||||
|
if [ ! -f "$PROTECTED_LIST" ]; then
|
||||||
# Check if the root folder exists and is a directory
|
echo "Error: '$PROTECTED_LIST' not found."
|
||||||
if [ ! -d "$ROOT_FOLDER" ]; then
|
echo "Please create 'protected.txt' one directory up with a list of protected files/folders (one per line)."
|
||||||
echo "Error: '$ROOT_FOLDER' is not a valid directory."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Safeguard: Check if any file/folder matching patterns in protected.txt exists in a root folder
|
||||||
|
check_protected_items() {
|
||||||
|
local root_dir="$1"
|
||||||
|
while IFS= read -r pattern; do
|
||||||
|
# Skip empty lines
|
||||||
|
[ -z "$pattern" ] && continue
|
||||||
|
|
||||||
|
# Handle wildcards by using find for pattern matching
|
||||||
|
if [[ "$pattern" == *"*"* ]]; then
|
||||||
|
# Convert pattern to a find-compatible search
|
||||||
|
if [[ "$pattern" == /* ]]; then
|
||||||
|
search_path="${root_dir}${pattern}"
|
||||||
|
else
|
||||||
|
search_path="${root_dir}/${pattern}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use find to check if any files match the pattern
|
||||||
|
if find "$root_dir" -path "$search_path" 2>/dev/null | grep -q .; then
|
||||||
|
echo "Error: Protected pattern '$pattern' matches files in '$root_dir'. Aborting execution."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Exact match for non-wildcard entries
|
||||||
|
if [ -e "$root_dir/$pattern" ]; then
|
||||||
|
echo "Error: Protected item '$pattern' found in '$root_dir'. Aborting execution."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$PROTECTED_LIST"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to check and delete subfolders
|
# Function to check and delete subfolders
|
||||||
delete_non_manifest_folders() {
|
delete_non_manifest_folders() {
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
@ -35,15 +65,37 @@ delete_non_manifest_folders() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Change to the root folder to handle relative paths cleanly
|
# Process each root folder provided as an argument
|
||||||
cd "$ROOT_FOLDER" || {
|
for ROOT_FOLDER in "$@"; do
|
||||||
echo "Error: Could not change to directory '$ROOT_FOLDER'"
|
# Check if the root folder exists and is a directory
|
||||||
exit 1
|
if [ ! -d "$ROOT_FOLDER" ]; then
|
||||||
}
|
echo "Error: '$ROOT_FOLDER' is not a valid directory. Skipping."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
# Call the function with the root folder
|
# Perform the safeguard check for this root folder
|
||||||
delete_non_manifest_folders "."
|
echo "Checking for protected items in '$ROOT_FOLDER' from '$PROTECTED_LIST'..."
|
||||||
|
check_protected_items "$ROOT_FOLDER"
|
||||||
|
|
||||||
echo "Cleanup complete!"
|
# Change to the root folder to handle relative paths cleanly
|
||||||
|
cd "$ROOT_FOLDER" || {
|
||||||
|
echo "Error: Could not change to directory '$ROOT_FOLDER'. Skipping."
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
# Call the function with the current root folder
|
||||||
|
echo "Processing '$ROOT_FOLDER'..."
|
||||||
|
delete_non_manifest_folders "."
|
||||||
|
|
||||||
|
# Return to the original directory to process the next root folder
|
||||||
|
cd - > /dev/null || {
|
||||||
|
echo "Error: Could not return from '$ROOT_FOLDER'. Exiting."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Cleanup complete for '$ROOT_FOLDER'!"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "All root folders processed!"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
Loading…
Reference in New Issue
Block a user