Files
assetto/process.sh

45 lines
1.4 KiB
Bash
Raw Normal View History

2026-02-08 14:13:30 +01:00
#!/bin/bash
set -euox pipefail
# Define Paths
SOURCE_ROOT="./cars"
2026-02-08 15:16:45 +01:00
TARGET_ROOT="/content/cars"
mkdir -p "$TARGET_ROOT"
2026-02-08 14:13:30 +01:00
tree "$SOURCE_ROOT" # DEBUG
# Find all archives recursively (zip, 7z, rar)
find "$SOURCE_ROOT" -type f \( -name "*.zip" -o -name "*.7z" -o -name "*.rar" \) | while read archive; do
# Get the filename without extension
filename=$(basename -- "$archive")
car_name="${filename%.*}"
echo "--------------------------------------"
echo "Processing: $car_name"
# Create a temp directory for extraction
temp_dir=$(mktemp -d)
# Extract contents
7z x "$archive" -o"$temp_dir" -y > /dev/null
# FILTERING LOGIC
2026-02-08 15:16:45 +01:00
find "$temp_dir/$car_name" -not -path "./skins/*/livery.png" \
-not -path "./skins/*/preview.jpg" \
-not -path "./skins/*/preview.jpeg" \
-not -path "./skins/*/ui_skin.json" \
-not -path "./ui/badge.png" \
-not -path "./ui/ui_car.json" \
-not -path "./data.acd" \
-not -path "./physics/standard/data.acd" \
-not -path "./physics/csp/data.acd" \
-delete;
2026-02-08 14:13:30 +01:00
echo "After filtering:"
2026-02-08 14:31:04 +01:00
tree "$temp_dir/$car_name"
2026-02-08 14:13:30 +01:00
2026-02-08 15:16:45 +01:00
cp -r "$temp_dir/$car_name" "$TARGET_ROOT"
2026-02-08 14:13:30 +01:00
done