add convenience script
This commit is contained in:
@@ -56,42 +56,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Process Archives
|
- name: Process Archives
|
||||||
run: |
|
run: |
|
||||||
# Define Paths
|
chmod +x process.sh
|
||||||
SOURCE_ROOT="./cars"
|
./process.sh
|
||||||
# This is where the server expects the files
|
|
||||||
DEST_ROOT="./server-data/content/cars"
|
|
||||||
mkdir -p "$DEST_ROOT"
|
|
||||||
|
|
||||||
echo "Searching for archives in $SOURCE_ROOT..."
|
|
||||||
|
|
||||||
# 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 (e.g., "cars/groupA/my_car.zip" -> "my_car")
|
|
||||||
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
|
|
||||||
find "$temp_dir" -type f -not -name "skins/*/livery.png" \
|
|
||||||
-not -name "skins/*/preview.jpeg" \
|
|
||||||
-not -name "skins/*/ui_skin.json" \
|
|
||||||
-not -name "ui/badge.png" \
|
|
||||||
-not -name "ui/ui_car.json" \
|
|
||||||
-not -name "data.acd" \
|
|
||||||
-not -name "physics/standard/data.acd" \
|
|
||||||
-not -name "physics/csp/data.acd" \
|
|
||||||
-delete
|
|
||||||
|
|
||||||
tree "$temp_dir"
|
|
||||||
|
|
||||||
# - name: Verify Installation
|
# - name: Verify Installation
|
||||||
# run: |
|
# run: |
|
||||||
|
|||||||
47
process.sh
Normal file
47
process.sh
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euox pipefail
|
||||||
|
|
||||||
|
# Define Paths
|
||||||
|
SOURCE_ROOT="./cars"
|
||||||
|
DEST_ROOT="./server-data/content/cars"
|
||||||
|
mkdir -p "$DEST_ROOT"
|
||||||
|
|
||||||
|
echo "Searching for archives in $SOURCE_ROOT..."
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
echo "Extracted to: $temp_dir"
|
||||||
|
tree "$temp_dir" # DEBUG
|
||||||
|
|
||||||
|
# FILTERING LOGIC
|
||||||
|
find "$temp_dir" -type f -not -name "skins/*/livery.png" \
|
||||||
|
-not -name "skins/*/preview.jpeg" \
|
||||||
|
-not -name "skins/*/ui_skin.json" \
|
||||||
|
-not -name "ui/badge.png" \
|
||||||
|
-not -name "ui/ui_car.json" \
|
||||||
|
-not -name "data.acd" \
|
||||||
|
-not -name "physics/standard/data.acd" \
|
||||||
|
-not -name "physics/csp/data.acd" \
|
||||||
|
-delete
|
||||||
|
|
||||||
|
echo "After filtering:"
|
||||||
|
tree "$temp_dir"
|
||||||
|
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user